Getting call stack (like dbx where cmd)

From: Adrian (notvalid_at_null.net)
Date: 10/29/04


Date: Fri, 29 Oct 2004 11:27:55 -0700

Is there a way (understandably non-portable) to get the
call stack from within a function? That is, assuming the
application has been compiled with symbols, get the list
of calling function names (similar to dbx "where" command").

I am working with IBM compiler and AIX but any other
OS/compiler solution would be interesting as well.

To answer the inevitable question why I want this,
I am writing a simple profiler for my library. However,
within the library I want to distinguish which part of
the application I was called from....

Thanks for any ideas or pointers,
Adrian



Relevant Pages

  • Re: Do buffers always start with the lowest memory address being the first element?
    ... > The C standard does not assume a downward-growing stack, ... > an upward-growing stack. ... C allows but does not require that the array produced ... > machine depends on both the C compiler and the machine. ...
    (comp.lang.c)
  • Re: switch statement, was compiler, status...
    ... Primary Register, Secondary Register, ... Stack, and abit of storage does it. ... This version of Small-C is copyrighted as a revision to Ron Cain's ... Croatia) is "Calculator Compiler" by Senko Rasik. ...
    (alt.lang.asm)
  • Re: subroutine stack and C machine model
    ... On a typical system the stack on entry to the function looks like this ... balance to specify the order of evaluation). ... compiler developer to find out when code can be moved around. ... I think the Standards people used compiler optimization as an excuse ...
    (comp.lang.c)
  • Re: Virtual machine: assembly instructions
    ... >) I am writing a compiler, ... > won't be extra junk on the stack. ... > stack with the Nth position on the stack. ...
    (comp.programming)
  • Re: back online again...
    ... really "acceptable") convention. ... stack machine, but the design ... target with my compiler (may need a different name for this though, ... most of this code is not likely to ever go to object files anyways... ...
    (alt.lang.asm)