How to extract debugging information from ELF/DWARF files?

joerg.fischer@systemonic.de (Joerg Fischer)
6 Mar 2004 14:03:11 -0500

          From comp.compilers

Related articles
How to extract debugging information from ELF/DWARF files? joerg.fischer@systemonic.de (2004-03-06)
Re: How to extract debugging information from ELF/DWARF files? ppluzhnikov@charter.net (Paul Pluzhnikov) (2004-03-11)
Re: How to extract debugging information from ELF/DWARF files? jcownie@etnus.com (James Cownie) (2004-03-11)
| List of all articles for this month |
From: joerg.fischer@systemonic.de (Joerg Fischer)
Newsgroups: comp.compilers
Date: 6 Mar 2004 14:03:11 -0500
Organization: http://groups.google.com
Keywords: linker, debug, question
Posted-Date: 06 Mar 2004 14:03:11 EST

Hi ng,


I am writing an ARM-ELF reader in Java for an own debugging tool. I am
able to read the section header, program header, string and symbol
tables but I do not understand how I have to interpret the Dwarf2
debugging information sections, like ".debug_info", ".debug_line", and
so on. I have already downloaded some dwarf PDF's and a dwarfdump
utility to make sure that such debugging information are really stored
in my simple example (file "main2.c"):


int main () {


    int a = 5;
    return a;
}


Dwarfdump produces


line number info
<source> [row,column] <pc> //<new statement or basic block
main2.c: [ 1,-1] 0 // new statement // end of text sequence


line number info
<source> [row,column] <pc> //<new statement or basic block
main2.c: [ 1,12] 0x80a8 // new statement
main2.c: [ 3, 1] 0x80a8 // new statement
main2.c: [ 4,-1] 0x80ac // new statement
main2.c: [ 5,-1] 0x80ac // new statement
main2.c: [ 5,-1] 0x80b0 // new statement // end of text sequence


That is exactly what I need, the mapping between line number and pc.
Unfortunately, the dwarf PDF dwarf-2.0.0.pdf contains no examples how
to interpret the sections of interest and how to extract information
in a way dwarfdump does.


Thank you for your help.


Regards,
Joerg


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.