This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Stack Window Problem [was: Re: DLLs and Insight...]


On Thu, Nov 01, 2001 at 02:05:26PM -0800, Keith Seitz wrote:
>
>Well, I've got a recent cygwin (1.3.4 DLL checked out yesterday) and a
>relatively recent gdb (also from yesterday).
>
>I run gdb on itself and I set a break at Tcl_Realloc. The stack is
>immediately wrong. The SrcWin shows the right place, but the StackWin and
>gdb show the wrong place:
>
>(gdb) bt
>#0  Tcl_Realloc (
>    ptr=0x2679a0 "C:/cygwin/home/keiths/sources/gdb/built/H-i686-pc-cygwin/share
>/tcl8.3 C:/cygwin/home/keiths/sources/gdb/built/H-i686-pc-cygwin/share/tcl8.3 C:
>/cygwin/home/keiths/sources/gdb/built/share/tcl8.3 C:/cygw"..., size=800)
>    at ../../../src/tcl/win/../generic/tclCkalloc.c:897
>#1  0x10058d09 in Tcl_DStringSetLength (dsPtr=0x22f644, length=799)
>    at ../../../src/tcl/win/../generic/tclUtil.c:1651
>#2  0x10026a95 in DestroyButton ()
>    at ../../../src/tcl/win/../generic/tclEncoding.c:986
>#3  0x10028314 in ComputeArcBbox ()
>    at ../../../src/tcl/win/../generic/tclEncoding.c:2744
>#4  0x10026c0b in ConfigureButton ()
>    at ../../../src/tcl/win/../generic/tclEncoding.c:1131
>#5  0x005021b5 in gdbtk_init (
>    argv0=0x22fd78 "/home/keiths/sources/gdb/built/H-i686-pc-cygwin/bin/gdb")
>    at ../../src/gdb/gdbtk/generic/gdbtk.c:379
>#6  0x00405783 in gdb_init (
>    argv0=0x22fd78 "/home/keiths/sources/gdb/built/H-i686-pc-cygwin/bin/gdb")
>    at ../../src/gdb/top.c:2055
>#7  0x00401a35 in captured_main (data=0x22fd4c) at ../../src/gdb/main.c:460
>#8  0x00402ae4 in do_catch_errors (uiout=0x5b0668, data=0x22fd0c)
>    at ../../src/gdb/top.c:488
>#9  0x0040294f in catcher (func=0x402ad0 <do_catch_errors>,
>    func_uiout=0x5b0668, func_args=0x22fd0c, func_val=0x22fd04,
>---Type <return> to continue, or q <return> to quit---
>    func_caught=0x22fd08, errstring=0x4011a6 "", mask=6)
>    at ../../src/gdb/top.c:420
>#10 0x00402b23 in catch_errors (func=0x401350 <captured_main>,
>    func_args=0x22fd4c, errstring=0x4011a6 "", mask=6)
>    at ../../src/gdb/top.c:500
>#11 0x00401fae in main (argc=1, argv=0x10281568) at ../../src/gdb/main.c:702
>#12 0x61003f82 in dll_crt0_1 () at ../../../../src/winsup/cygwin/dcrt0.cc:769
>#13 0x61004199 in _dll_crt0 () at ../../../../src/winsup/cygwin/dcrt0.cc:850
>#14 0x610041d8 in dll_crt0 (uptr=0x0)
>    at ../../../../src/winsup/cygwin/dcrt0.cc:862
>#15 0x005ae0d3 in cygwin_crt0 ()
>    at /cygnus/netrel/src/cygwin-1.3.3-2/winsup/cygwin/lib/cygwin_crt0.c:33
>
>You can see right here that frame #2 is wrong. It should be:
>
>(gdb) tk gdb_loc
>../../../src/tcl/win/../generic/tclEncoding.c Tcl_UtfToExternalString /home/keiths/sources/gdb/net/tcl/win/../../../src/tcl/win/../generic/tclEncoding.c 986 0x10026a95 0x10010f68 {}
>
>(gdb) p/x $pc
>$1 = 0x10026a95
>(gdb) info symbol 0x10026a95
>DestroyButton + 173 in section .text
>DestroyButton + 173 in section .text
>(gdb) disas
>Dump of assembler code for function DestroyButton:
>0x100269e8 <DestroyButton>:           movl   $0x3,0xffffffec(%ebp)
>...
>0x10026b41 <Tcl_FindExecutable+81>:   lea    0xffffff20(%ebp),%esi
>(gdb) disas Tcl_UtfToExternalDString
>Dump of assembler code for function Tcl_UtfToExternalDString:
>0x10026948 <Tcl_UtfToExternalDString>: push %ebp
>...
>0x100269e5 <Tcl_UtfToExternalDString+157>: lea  0xfffffff0(%ebp),%eax
>0x100269e8 <DestroyButton>:            movl    $0x3,0xffffffec(%ebp)
>...
>0x10026ab1 <DestroyButton+201>:        ret
>(gdb)
>
>As you can see, the output is really messed up. The PC is clearly in
>Tcl_UtfToExternalDString, yet gdb claims it is in DestroyButton.
>Additionally gdb disassembles more than it should.

Everybody is building without optimization, right?  Otherwise I wouldn't
be surprised to hear that there could be screwed up.

It there an -fomit-frame-pointer in there somewhere by any chance?

Also, sorry to ask such a basic question but did you step a few lines
into Tcl_Realloc and check the back trace again?

Final question:  What does the latest cygwin release version of gdb
show?

>(gdb) info shared
>/home/keiths/sources/gdb/built/H-i686-pc-cygwin/bin/cygtcl83.dll      10001000
>/usr/bin/cygwin1.dll                                                  61001000
>/cygdrive/c/WINNT/system32/kernel32.dll                               77e81000
>/cygdrive/c/WINNT/system32/advapi32.dll                               77db1000
>/cygdrive/c/WINNT/system32/rpcrt4.dll                                 77d41000
>/cygdrive/c/WINNT/system32/user32.dll                                 77e11000
>/cygdrive/c/WINNT/system32/gdi32.dll                                  77f41000
>/home/keiths/sources/gdb/built/H-i686-pc-cygwin/bin/cygtix4183.dll    66601000
>/home/keiths/sources/gdb/built/H-i686-pc-cygwin/bin/cygtk83.dll       00b11000
>/cygdrive/c/WINNT/system32/comdlg32.dll                               76b31000
>/cygdrive/c/WINNT/system32/shlwapi.dll                                70bd1000
>/cygdrive/c/WINNT/system32/msvcrt.dll                                 78001000
>/cygdrive/c/WINNT/system32/comctl32.dll                               71781000
>/cygdrive/c/WINNT/system32/shell32.dll                                782f1000
>/cygdrive/c/WINNT/system32/psapi.dll                                  690a1000
>
>[Is msvcrt.dll allowed???]

Nope.  I wonder what's loading msvcrt.dll.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]