1

(Probably unneeded context:) I want to combine information obtained within a gcc plugin with the addresses of the actual basic blocks. Because the final addresses are not known within the plugin unfortunately but only after linking, I need to recover the basic blocks from the .elf file. One way to do so is by using DWARF's basic_block markers for instructions at the start of basic blocks stored in the .debug_line section. These can then be read (e.g., with the elftools Python library) and (potentially, I haven't tried yet) matched with file+line+column data available in DWARF as well as the plugin.

My problem is that I cannot get gcc or ld (or even clang) to emit the basic_block markers directly for the whole binary but have to generate the assembly code (e.g., gcc -S -g3), add .loc_mark_labels 1 on top, and then assemble this file. Is there a better way to force the basic_block tags?

stefanct
  • 2,503
  • 1
  • 28
  • 32

0 Answers0