Try this command at GDB's prompt:

        call SOS("DumpStack")

The SOS debugging package (documented at sscli/docs/debugging/sos.html) is very useful 
for post-mortem debugging, after a crash has taken place.

Also, the jit places a data structure immediately before the x86 code.  In the 
fastchecked and checked builds, this data structure contains pointers to the class and 
method name.  Here is an example from Windows using NTSD to look up the method by 
hand.  This example is of "clix hello.exe", stopped at the first call to 
kernel32!WriteFile.

0:000> k                                                        <- dump the call stack
ChildEBP RetAddr
WARNING: Stack unwind information not available. Following frames may be wrong.
0006de88 79407a72 kernel32!WriteFile
0006debc 02d8bd9c sscoree!COMStreams__ConsoleHandleIsValid+0x5c
0006dedc 02d8bc58 0x2d8bd9c
0006defc 02d8b7c4 0x2d8bc58                             <- I'm interested in this 
method
0006df24 793000cc 0x2d8b7c4
0006df2c 7930482c sscoree!CallDescrWorkerInternal+0x28
0006e358 792fb4da sscoree!CallDescrWorker+0x6a
0006e500 792fbea4 sscoree!MethodDesc__CallDescr+0x301
0006e524 7930df1b sscoree!MethodDesc__Call+0x31

0:000> u 0x2d8bc58-40                                   <- I kept disassembling 
backwards until I found
                                                                   "push ebp / mov 
ebp,esp", which is usually a
                                                                   function prolog.
0:000> u 0x2d8bc58-40
02d8bc18 c8930707         enter   0x793,0x7
02d8bc1c 55               push    ebp           <- here is the prolog!
02d8bc1d 8bec             mov     ebp,esp
02d8bc1f 56               push    esi
02d8bc20 33f6             xor     esi,esi
02d8bc22 56               push    esi
02d8bc23 b901000000       mov     ecx,0x1

0:000> dd 02d8bc1c-4 l 1                                <- dump one 4-byte value 
immediately in front of
                                                                   the prolog
02d8bc18  070793c8

0:000> dd 070793c8 l 2                                  <- dump the two 4-byte values 
it points to
070793c8  02c5735f 02c4f4c6
0:000> da 02c5735f                                      <- dump those two pointers as 
Ansi strings
02c5735f  "OpenStandardOutput"
0:000> da 02c4f4c6
02c4f4c6  "Console"

So the method at 02d8bc1c is Console.OpenStandardOutput.

Barry
This posting is provided "AS IS" with no warranties, and confers no rights.



-----Original Message-----
From: Discussion of the Rotor Shared Source CLI implementation [mailto:[EMAIL 
PROTECTED] On Behalf Of Archana
Sent: Thursday, July 24, 2003 8:53 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET-ROTOR] help needed wrt debugging

Hi,
 Referring to the gdb output below, Is there any way to trace the
Function thats making a call to JIT_Stelem_Ref? [on BSD]

gdb trace:
Program received signal SIGSEGV, Segmentation fault.
Object::GetTypeHandle (this=0x80000000)
    at /usr/home/archana/concgc/sscli/clr/src/vm/wks/../class.h:369
369         BOOL            IsArray()           { return(m_wFlags &
enum_flag_Array); }
(gdb) bt
#0  Object::GetTypeHandle (this=0x80000000)
    at /usr/home/archana/concgc/sscli/clr/src/vm/wks/../class.h:369
#1  0x2857e2bf in ObjIsInstanceOf (pElement=0x80000000, toTypeHnd={{
        m_asInt = 684172000, m_asPtr = 0x28c7a2e0, m_asTypeDesc =
0x28c7a2e0,
        m_asMT = 0x28c7a2e0}})
    at
/usr/home/archana/rotor/sscli/clr/src/vm/wks/../jitinterface.cpp:6108
#2  0x28583696 in JIT_Stelem_Ref (array=0x28f661e8, idx=3, val=0x80000000)
    at
/usr/home/archana/rotor/sscli/clr/src/vm/wks/../jitinterface.cpp:7143
#3  0x2b1445e4 in ?? ()
#4  0x2b143efa in ?? ()
#5  0x2b160c0b in ?? ()
#6  0x2b1523ea in ?? ()
#7  0x2b15a645 in ?? ()
#8  0x2b14c7ce in ?? ()
#9  0x2b14c123 in ?? ()
#10 0x2b14bfc1 in ?? ()
#11 0x2838b351 in donestack ()
   from
/usr/home/archana/concgc/sscli/build/v1.x86fstchk.rotor/libsscoree.so
#12 0x28421923 in CallDescrWorker (pSrcEnd=0x8186798, numStackSlots=2,
    pArgumentRegisters=0x8186760, pTarget=0x2f3ec873)
    at /usr/home/archana/concgc/sscli/clr/src/vm/wks/../class.cpp:9769
#13 0x2858f26a in MethodDesc::CallDescr (this=0x2f3ec878,
    pTarget=0x2f3ec873 "è¬W\207ù\211â\002+Ð\201\002+pÊ>/\224Â?/\024É>/",


Regards
archana

Reply via email to