elf - Showing high and low PC of every program functions using DWARF library -


i trying make code work : https://github.com/eliben/code-for-blog/blob/master/2011/dwarf_get_func_addr.c extracted tutorial made eli bendersky on http://eli.thegreenplace.net/2011/02/07/how-debuggers-work-part-3-debugging-information unfortunately, low pc , high pc return same address 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 manages link line , address not find real address of functions. idea why ?

thank help,

the code in dwarf_get_func_addr.c has @ least 1 bug: assumes every function has dw_at_low_pc , dw_at_high_pc attributes, , print uninitialized values if not case.

you should initialize lowpc = highpc = -1; on line 42, not print unintialized values.

other that, it's impossible without access lulesh_normal binary.

you should readelf -wi lulesh_normal, , step through list_func_in_die in debugger, , compare program reading there output readelf -- should match 1 one. if don't, version of libdwarf possibly buggy.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -