[lug] Stack trace question

Dan Wilson danwilson100 at hotmail.com
Wed Aug 16 18:30:13 MDT 2000


I want to implement that myself in myfunction().  I cannot assume all
the applications which call my library are compiled using -g.
most likely they don't have even symbols.  I just need to know the call 
stack
that calls myfunction() and see which module it is coming from.

Thanks
Dan

>From: "D. Stimits" <stimits at idcomm.com>
>Reply-To: lug at lug.boulder.co.us
>To: lug at lug.boulder.co.us
>Subject: Re: [lug] Stack trace question
>Date: Wed, 16 Aug 2000 17:46:46 -0600
>
>Dan Wilson wrote:
> >
> > Hi All,
> >
> > In my program I want to trace the stack and see every function within
> > the stack and what module it is coming from.  If main() calls foo() from
> > foo.so and foo called bar() from bar.so and bar() called myfunction() 
>from
> > mylibrary.so,  In myfunction() I want to see bar() coming from bar.so
> > and foo() coming from foo.so and so on.  No clue how to do this any
> > help is greatly appreciated.
> >
> > Thank you
> > Dan
> >
> > ________________________________________________________________________
> > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
> >
> > _______________________________________________
> > Web Page:  http://lug.boulder.co.us
> > Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
>
>gdb is the beast you need. Compile with -g, and don't use -O2 (or
>-OsomethingOptimized).
>
>What you are looking for is "bt". Inside the debugger, type "help bt".
>It should give you info sufficient to see not only the calls, but the
>arguments passed. If you are using threads, it gets more complicated,
>and generally you'd need a patch for threads under stock gdb.
>
>_______________________________________________
>Web Page:  http://lug.boulder.co.us
>Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com





More information about the LUG mailing list