This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Regarding Map Files
- From: Ian Lance Taylor <ian at airs dot com>
- To: <sachin_agrawal at persistent dot co dot in>
- Cc: <binutils at sources dot redhat dot com>, <ananda dot motte at philips dot com>, "Devendra Badhani \(E-mail\)" <deven at pspl dot co dot in>, "Shridhar Bhat \(E-mail\)" <penguin at pspl dot co dot in>
- Date: 20 Dec 2001 09:30:42 -0800
- Subject: Re: Regarding Map Files
- References: <000b01c18959$4de4a7d0$2a05a8c0@balapur>
"Sachin O. Agrawal" <sachin_agrawal@persistent.co.in> writes:
> Actually my intention is to find the functions and approximate
> range of line numbers in sources given an address.
Look at addr2line.
> Usually all commercial products use logging to trace their code
> flow in case of error at customer site. My opinion is that in
> error conditions program itself can log stack back trace just
> like a debugger (but within an optimized code).
Note that doing a stack backtrace on optimized code is nontrivial in
the general case. It's obviously possible, and gdb does it, but in
general you either need debugging information to describe the stack
frame or you need to disassemble the code to work out the stack frame.
A running program generally doesn't have easy access to the debugging
information, and it's hard to disassemble code backward.
Of course if you are using a processor which uses a consistent frame
pointer, and you don't compile with -fomit-frame-pointer, then it's
not too tough.
Ian