[Dwarf-Discuss] Obtain DIE based on physical file offset
davea42 at earthlink.net
Sat Jul 25 09:02:07 PDT 2009
Florian Weimer wrote:
> Is there a simple way to obtain a DIE based on physical file offset,
> using libdwarf? (My actual goal is to obtain source file and line
> number from a programm counter value, and this seems to be a required
> intermediate step.)
Yes, pretty simple in a sense, but your note is a bit hard to understand.
The .debug_line section relates program counter values to
source file and line. Why you mention physical file
offset is unclear (at least at this high level of discourse).
You can read the dwarfdump source to see how dwarfdump uses libdwarf
to get to all the source file and line-position (line number and
offset in the line) data and how it prints the program-counter
for each source position.
More information about the Dwarf-Discuss