[Dwarf-discuss] Question about differentiate instruction address in different sections

HaiFeng He hehaifeng
Wed Apr 12 18:04:07 GMT 2006


Hi,

I'm a new learner of dwarf. In my current project, I'm trying to use dwarf
information
to link the instructions in a relocate binary to the corresponding source
code line number.
And I choose to use libdwarf to do that.

For simple program, my analysis works fine. However, I met a problem
when I worked on a relocate binary with debug information on multiple code
sections.
I can not distinguish at which section an instruction locates by looking at
the address
provided by libdwarf.

For example, using dwarfdump -l (dwarfdump came with libdwarf), part of the
output of vmlinux
relocate binary looks as:
...
linux-compact/mm/shmem.c:  [1670,-1]   0x6df6  // new statement    // end of
text sequence
linux-compact/mm/shmem.c:  [ 79,-1]    0x26190 // new statement
linux-compact/mm/shmem.c:  [ 79,-1]    0x26193 // new statement
...
The first column and second column are the file name and line no of source
code. The
third column is the pc (or address of instruction). In the first entry, the
instruction
with address 0x6df6 is  in .text.init section and the  instructions in the
next two entries
 are in .text section. However, the output does not tell me in which section
these instructions
are. The addresses listed there are actually the offset to the beginning of
the code section,
where the instructions locate. I can not find a way to differentiate whether
an instruction is in .text or .text.init by looking at the address. Anybody
can help me out?

haifeng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freestandards.org/pipermail/dwarf-discuss/attachments/20060412/904fe007/attachment.htm



More information about the Dwarf-discuss mailing list