[LCP]Accessing stack info.

Jack Lloyd lloyd at acm.jhu.edu
Fri Jul 23 22:57:01 UTC 2004


On Fri, Jul 23, 2004 at 12:08:23PM +0530, Suresh Jayaram wrote:
> How to access stack info. in a C program?
> Is there a legal way, implementation independent way ?

Nope, it's going to be very implementation dependent.

> If it is implementation dependent, then how to access it
> in x86/gcc

GCC has a bunch of builtins that might do what you want. For example
__builtin_return_address, __buitin_frame_address, and a bunch of others.

If you want more detailed information, you'll probably have to compile your
application with debugging and then use something like libbfd to introspect
your program. That will be tricky, but I don't know of any reason it won't
work.

-Jack

> 
> TIA
> 
> JS
> 
> _______________________________________________
> This is the Linux C Programming List
> :  http://lists.linux.org.au/listinfo/linuxcprogramming List




More information about the linuxCprogramming mailing list