How do I find the ELF section for a DWARF symbol?

922 views Asked by At

I have an ELF file with DWARF debug info. Given a DWARF symbol (say function foo()) I want to find out which ELF section it resides in. I cannot do a PC match against each section's range, because the file has overlay sections, so there are multiple sections with the same mapped address range. In other words, if the symbol lies in one of the overlay sections, its address will match in all of the overlay sections' address ranges.

Thanks in advance for any help.

1

There are 1 answers

1
Tom Tromey On

I don't think there is a way to do this. DWARF just does not encode this information.

gdb requires the user to say which overlays are currently active. I believe this is how it gets this information.