Call Stack (Reflection)

Andreas Jaeger aj@arthur.rhein-neckar.de
Sun Jan 31 23:58:00 GMT 1999


>>>>> Frank Pilhofer writes:

 >   Hi,

 >  I'd like to have some information/examples of accessing the debugging/
 > profiling data produced by gcc within the program itself. I'm interested
 > in writing code that prints a back trace of cleartext function names,
 > like gdb does. The general idea is, in C++, to overload the new and
 > delete operators, and to associate each chunk of memory with a back
 > trace, to check for memory leakage.
 >  After browsing libgcc2.c, it seems that there are already hooks that
 > generate the necessary information. But from reading the source, I
 > don't know how to activate, use or evaluate it. In a simple test program,
 > compiled and linked with -a -pg -g (linux-glibc1), __bb.blocks is always
 > NULL.
 >  Is there some documentation, or is there some example source that
 > could help me? Or is there a package that already does what I intend
 > to do? -- I doubt I'm the first one to think of this possibility.

Have a look at glibc 2.1 (a test release called glibc-2.0.110 is
available from ftp://alpha.gnu.org/gnu ).  It provides output of the
backtrace for different architectures.  The implementation can be
found in the debug and sysdeps subdirs (backtrace* functions).

Andreas
-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de



More information about the Gcc mailing list