This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: How to map offset address to source code line number?
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: mmr <m_muralimohan at hotmail dot com>
- Cc: gdb at sourceware dot org
- Date: Wed, 24 Jul 2013 14:33:55 +0200
- Subject: Re: How to map offset address to source code line number?
- References: <1374598334177-239156 dot post at n7 dot nabble dot com>
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