This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Getting back trace inside the program itself
- From: Andreas Jaeger <aj at suse dot de>
- To: <sachin_agrawal at persistent dot co dot in>
- Cc: <binutils at sources dot redhat dot com>,"'Devendra Badhani (E-mail)'" <deven at pspl dot co dot in>,"'Shridhar Bhat (E-mail)'" <penguin at pspl dot co dot in>,"Masaoud Taher Moonim (E-mail)" <masaoud at pspl dot co dot in>
- Date: Wed, 26 Dec 2001 21:41:56 +0100
- Subject: Re: Getting back trace inside the program itself
- References: <001101c18a00$512755d0$2a05a8c0@balapur>
"Sachin O. Agrawal" <sachin_agrawal@persistent.co.in> writes:
> Hello,
>
> Is there a way for a program (optimized and with no debugging info)
> to get the back trace information?
>
> Before every function call processor pushes the return address on
> the stack. I would like to get these return address. And later
> use them for tracing the code flow using map files.
If you're using the GNU C library, use the functions from
<execinfo.h>, there's even a backtrace function.
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj