Thank you so much!

On Wed, 7 Jul 2004, Jan Kotas wrote:

> Unfortunately, we did not have enough time to implement DumpStack on FreeBSD. The 
> workaround is to use a regular backtrace, and then use IP2MD SOS command to get the 
> names for managed methods.
>
> Below is transcript of debugging session that demonstrates it.
>
> -Jan
>
> (gdb) break main
> Breakpoint 1 at 0x8048ca9: file ../../../src/inc/palstartup.h, line 38.
> (gdb) r
> Starting program: /home/jkotas/sscli/build/v1.x86fstchk.rotor/clix hello.exe
>
> Breakpoint 1, main (argc=2, argv=0xbfbff350)
>     at ../../../src/inc/palstartup.h:38
> 38      int __cdecl main(int argc, char **argv) {
> (gdb) break WriteFile
> Breakpoint 2 at 0x2808ad81: file ../file.c, line 1548.
> (gdb) c
> Continuing.
>
> Breakpoint 2, WriteFile (hFile=0x10, lpBuffer=0xbfbfc957,
>     nNumberOfBytesToWrite=0, lpNumberOfBytesWritten=0xbfbfc958,
>     lpOverlapped=0x0) at ../file.c:1548
> 1548    {
> Current language:  auto; currently c
> (gdb) bt 10
> #0  WriteFile (hFile=0x10, lpBuffer=0xbfbfc957, nNumberOfBytesToWrite=0,
>     lpNumberOfBytesWritten=0xbfbfc958, lpOverlapped=0x0) at ../file.c:1548
> #1  0x284c49a3 in COMStreams::ConsoleHandleIsValid (handle=0x10)
>     at /home/jkotas/sscli/clr/src/vm/wks/../comstreams.cpp:161
> #2  0x2b0b9398 in ?? ()
> #3  0x2b0b9254 in ?? ()
> #4  0x2b0b8dc0 in ?? ()
> #5  0x28386855 in donestack () at ../../../inc/../md/inc/liteweightstgdb.h:82
> #6  0x2841ccff in CallDescrWorker (pSrcEnd=0xbfbfcfb0, numStackSlots=0,
>     pArgumentRegisters=0xbfbfcf80, pTarget=0x2f29e473)
>     at /home/jkotas/sscli/clr/src/vm/wks/../class.cpp:9769
> #7  0x2858a0aa in MethodDesc::CallDescr (this=0x2f29e478,
>     pTarget=0x2f29e473 "é\234~áÿj\037ý*VÊü*", pModule=0x8110400,
>     pMetaSigOrig=0x2b0ae704, fIsStatic=1, pArguments=0x0)
>     at /home/jkotas/sscli/clr/src/vm/wks/../method.cpp:738
> #8  0x28589910 in MethodDesc::Call (this=0x2f29e478, pArguments=0x0,
>     sig=0x2b0ae704) at /home/jkotas/sscli/clr/src/vm/wks/../method.cpp:567
> #9  0x2841de96 in EEClass::RunClassInit (this=0x2b041d0c, pEntry=0x811f280,
>     pThrowable=0xbfbfdf60)
>     at /home/jkotas/sscli/clr/src/vm/wks/../class.cpp:10010
> (More stack frames follow...)
> (gdb) call SOS("IP2MD 0x2b0b9254")
> MethodDesc: 0x2f29e608
> Jitted by EJIT
> Method Name : [DEFAULT] Class System.IO.Stream System.Console.OpenStandardOutput(I4)
> Class : 2b041d0c
> MethodTable 2f29ed78
> mdToken: 060004ef
> Flags : 10
> Method VA : 2f0b6324
> (gdb)
>
>
> -----Original Message-----
> From: Discussion of the Rotor Shared Source CLI implementation [mailto:[EMAIL 
> PROTECTED] On Behalf Of Archana
> Sent: Wednesday, July 07, 2004 9:07 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [DOTNET-ROTOR] tracking the source of an alloc
>
> Hi,
>  i checked the environment vars, they are all set right, but gdb complains
> about DumpStack?
> do i have anything extra to make it work?
>
> (gdb) call SOS("DumpStack")
> SOS:  Command 'DumpStack' not found.
>
> thanks
> archana
>
> On Wed, 7 Jul 2004, Barry Bond wrote:
>
> > SOS does work on FreeBSD - you invoke it differently than you do on Windows 
> > though.  From the GDB prompt, switch to thread #5 and type:
> >         call SOS("DumpStack")
> > that is equivalent to doing this in NTSD:
> >         !sos.DumpStack
> >
> >
> > To find the start of the jitted function, disassemble backwards until you find a 
> > "push %ebp" opcode followed by "mov %esp, %ebp".  Subtract 4 from the address of 
> > the "push %ebp" opcode and you'll find a 4-byte pointer stored there, which points 
> > to a pair of pointers to strings.  I don't have a FreeBSD box handy, but I think 
> > "disas 0x290be09d-0x40 0x290be09d" will disassemble 0x40 bytes worth of code just 
> > before the machine code in #5.  If you don't see the "push %ebp / mov %esp, %ebp" 
> > there, then keep going backwards until you do find it.
> >
> > Barry
> >
> > -----Original Message-----
> > From: Discussion of the Rotor Shared Source CLI implementation [mailto:[EMAIL 
> > PROTECTED] On Behalf Of Archana
> > Sent: Wednesday, July 07, 2004 9:03 AM
> > To: [EMAIL PROTECTED]
> > Subject: [DOTNET-ROTOR] tracking the source of an alloc
> >
> > Hi,
> >  How can one find out where the call to GcHEap::Alloc is
> > originating from?
> > i had sent a similar mail regarding how to debug in
> > such cases long time back (ref:help needed wrt debugging, Jul24,2003,
> > that Barry Bond helped me with). i tried the method that was
> > suggested. but i am not able to locate the prolog here. and i dont know if
> > i can use SOS in the Free BSD platform?
> > i am running the application through gdb (Free BSD) and
> > doing a backtrace, this is what i get...
> >
> > Looking at the machine code at #5 in the following output
> > [ #5  0x290be09d in ?? ()], which is
> > Dump of assembler code from 0x290be09d to 0x290be19d:
> >     0x290be09d: add    $0x8,%esp
> >     0x290be0a0: add    $0x4,%esp
> >     0x290be0a3: push   %eax
> >     0x290be0a4: mov    $0x290b5bc4,%eax
> >     0x290be0a9: push   %eax
> >     0x290be0aa: mov    $0x28541678,%eax
> >     0x290be0af: call   *%eax
> >     0x290be0b1: add    $0x4,%esp
> >     0x290be0b4: mov    $0x290b564c,%eax
> >     0x290be0b9: push   %eax
> >     0x290be0ba: mov    $0x28539b50,%eax
> >     0x290be0bf: call   *%eax
> >     0x290be0c1: add    $0x4,%esp
> >     0x290be0c4: push   %eax
> >     0x290be0c5: mov    $0x2d0d0568,%eax
> >     0x290be0ca: call   *%eax
> >     0x290be0cc: add    $0x8,%esp
> >     0x290be0cf: push   %esp
> >     0x290be0d0: push   %ebp
> >     0x290be0d1: mov    $0xc,%eax
> >     0x290be0d6: push   %eax
> >     0x290be0d7: mov    $0x2d0d02b4,%eax
> >     0x290be0dc: call   *%eax
> >     0x290be0de: add    $0xc,%esp
> >     0x290be0e1: mov    0xfffffffc(%ebp),%esi
> >     0x290be0e4: mov    %ebp,%esp
> >     0x290be0e6: pop    %ebp
> >     0x290be0e7: ret
> >     0x290be0e8: add    %al,(%eax)
> >     0x290be0ea: add    %al,(%eax)
> >     0x290be0ec: add    %al,(%eax)
> > ...............
> >
> >
> > Program received signal SIGTRAP, Trace/breakpoint trap.
> > 0x280cff40 in DBG_DebugBreak () at ../context.c:390
> > (gdb) bt
> > #0  0x280cff40 in DBG_DebugBreak () at ../context.c:390
> > #1  0x28081cb2 in DebugBreak () at ../debug.c:220
> > #2  0x28737a66 in Alloc (size=16, bFinalize=0, bContainsPointers=0) at
> > /usr/home/archana/fastgc/sscli/clr/src/vm/wks/../gcscan.cpp:82
> > #3  0x28513e63 in FastAllocateObject (pMT=0x2909fb94) at
> > /usr/home/archana/fastgc/sscli/clr/src/vm/wks/../gcscan.cpp:975
> > #4  0x2853fd70 in JIT_Box (type=0x2909fb94, unboxedData=0xbfbfb254) at
> > /usr/home/archana/fastgc/sscli/clr/src/vm/wks/../jitinterface.cpp:6737
> > #5  0x290be09d in ?? ()
> > #6  0x2834bc05 in donestack () from
> > /usr/home/archana/fastgc/sscli/build/v1.x86fstchk.rotor/libsscoree.so
> > #7  0x283e18eb in CallDescrWorker (pSrcEnd=0xbfbfb844, numStackSlots=0,
> > pArgumentRegisters=0xbfbfb814, pTarget=0x290b5a93) at
> > /usr/home/archana/fastgc/sscli/clr/src/vm/wks/../class.cpp:9769
> > #8  0x2854ea3e in MethodDesc::CallDescr (this=0x290b5a98,
> > pTarget=0x290b5a93 "él\205", pModule=0x81b2c00, pMetaSigOrig=0x290b6b44,
> > fIsStatic=1, pArguments=0x0) at
> > /usr/home/archana/fastgc/sscli/clr/src/vm/wks/../method.cpp:740
> > #9  0x2854e274 in MethodDesc::Call (this=0x290b5a98, pArguments=0x0,
> > sig=0x290b6b44) at
> > /usr/home/archana/fastgc/sscli/clr/src/vm/wks/../method.cpp:567
> > #10 0x283e2a96 in EEClass::RunClassInit (this=0x29047d6c,
> > pEntry=0x81f9200, pThrowable=0xbfbfc784) at
> > /usr/home/archana/fastgc/sscli/clr/src/vm/wks/../class.cpp:10010
> > #11 0x283e322a in EEClass::DoRunClassInitHelper (this=0x29047d6c,
> > pThrowable=0xbfbfc784, pLocalBlock=0x806cc3c, pEntry=0x81f9200,
> > fRunClassInit=1) at
> > /usr/home/archana/fastgc/sscli/clr/src/vm/wks/../class.cpp:10064
> > ...........
> >
> > thanks & Regards
> > archana
> >
> > ===================================
> > This list is hosted by DevelopMentor®  http://www.develop.com
> > ASP.NET courses you may be interested in:
> >
> > Guerrilla ASP.NET
> > 15 March 2004, in Boston, MA
> > 17 May 2004 in Torrance, CA
> > 7 June 2004, London, UK
> >
> > http://www.develop.com/courses/gaspdotnetls
> >
> > View archives and manage your subscription(s) at http://discuss.develop.com
> >
> > ===================================
> > This list is hosted by DevelopMentor®  http://www.develop.com
> > ASP.NET courses you may be interested in:
> >
> > Guerrilla ASP.NET
> > 15 March 2004, in Boston, MA
> > 17 May 2004 in Torrance, CA
> > 7 June 2004, London, UK
> >
> > http://www.develop.com/courses/gaspdotnetls
> >
> > View archives and manage your subscription(s) at http://discuss.develop.com
> >
>
> --
> Regards,
> Archana
>
> ===================================
> This list is hosted by DevelopMentor®  http://www.develop.com
> ASP.NET courses you may be interested in:
>
> Guerrilla ASP.NET
> 15 March 2004, in Boston, MA
> 17 May 2004 in Torrance, CA
> 7 June 2004, London, UK
>
> http://www.develop.com/courses/gaspdotnetls
>
> View archives and manage your subscription(s) at http://discuss.develop.com
>
> ===================================
> This list is hosted by DevelopMentor®  http://www.develop.com
> ASP.NET courses you may be interested in:
>
> Guerrilla ASP.NET
> 15 March 2004, in Boston, MA
> 17 May 2004 in Torrance, CA
> 7 June 2004, London, UK
>
> http://www.develop.com/courses/gaspdotnetls
>
> View archives and manage your subscription(s) at http://discuss.develop.com
>

--
Regards,
Archana

===================================
This list is hosted by DevelopMentor®  http://www.develop.com
ASP.NET courses you may be interested in:

Guerrilla ASP.NET
15 March 2004, in Boston, MA
17 May 2004 in Torrance, CA
7 June 2004, London, UK

http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to