GDB - map address to line and column in source code

1k Views Asked by At

Both gcc and clang have option -gcolumn-info, which is described this way:

Emit location column information into DWARF debugging information, rather than just file and line.

I have compiled my binary with this option. Now I have address of some instruction and want to translate it back to source file, line number and column. Is there a way to do it in gdb? Is there some other tool that can extract this information?

I know that I can use info line *0xabcd1234 in gdb to get the source file and line corresponding to that address, but it does not show the column.

1

There are 1 best solutions below

0
On BEST ANSWER

Answering my guestion, I found one way to get the information using lldb and image lookup command:

(lldb) image lookup --address 0x134adc
      Address: libaaa.so[0x0000000000134adc] (libaaa.so.PT_LOAD[0]..text + 1030908)
      Summary: libaaa.so`test() + 272 at test.cpp:1842:124