Regarding Map Files

Ian Lance Taylor ian@airs.com
Thu Dec 20 13:13:00 GMT 2001


"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



More information about the Binutils mailing list