I am trying to make this code work : https://github.com/eliben/code-for-blog/blob/master/2011/dwarf_get_func_addr.c It is extracted from a tutorial made by Eli Bendersky on http://eli.thegreenplace.net/2011/02/07/how-debuggers-work-part-3-debugging-information Unfortunately, low pc and high pc return always the same address for almost every function:
DW_TAG_subprogram: 'aFunctionName'
low pc : 0x00000001
high pc : 0x7f3a00000001
Whereas if objdump --dwarf=decodedline ./lulesh_normal >> dump_dwarf.txt gives me :
File name Line number Starting address
lulesh.cc 1297 0x402e00
lulesh.cc 1297 0x402e11
lulesh.cc 1299 0x402ee4
lulesh.cc 1300 0x402ef0
lulesh.cc 1301 0x402ef6
lulesh.cc 1299 0x402f00
[...]
So it manages to link line and address but not to find the real address of the functions. Any idea why ?
Thank you for your help,