This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Call Stack Trace


Brian McGrew <brian@visionpro.com> writes:

> I need to take a look at a call stack, but without using gdb.  Is there a
> macro or something similar to __FILE__ or __LINE__ that will tell me who
> called the function that I'm in???
>
> So if I have a function called foo() that gets called 100 different ways
> from differnet shared libraries and executables, how can I find out who
> called foo(), without gdb and without touching all my source code and
> putting printf's???

What processor?  It matters.

I don't quite understand the bit about "without touching all my source
code".  If you don't want to touch your source code, and you don't
want to use gdb, what do you want to use?

If you can change the source code a bit, see __builtin_return_address
in the docs; consider using it with the addr2line program.  See also
the -finstrument-functions option.

Ian


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