This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to map offset address to source code line number?


On Tue, 23 Jul 2013 18:52:14 +0200, mmr wrote:
> suppose think that the binary is in release mode. 
> Here is sample crash location.. 
> #0 0x080485b9 in main () 
> 
> how to map this address to line number in the source code.

You can map it by "info line *0x80485b9" but that will not work with the
binary you have above.


You need full debug information - for simplicity let's call it DWARF.
This is normally generated by compiler - for simplicity gcc - when you specify
its -g option:
	gcc -o test test.c -Wall -g

You also need to ensure there is no option -s or that there is no "strip"
command applied afterwards.


If you ask where to get line number information for a binary you got in
GNU/Linux distribution (Fedora, Ubuntu etc.) you need to install separate
debug info package for that package you are debugging - such packages are
called *-debuginfo.rpm in Fedora, exact naming depends on the distro.


"binary is in release mode" may mean many things, difficult to guess that.


Jan Kratochvil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]