GCC debug information -
i'm using gcc arm cross-compiler (arm-none-eabi-*
) , using proprietary debugger. debugger can highlight resultant assembly selected source line. using nm , objdump, can see binary has more 1 .debug_*
sections. it's obvious conclude debugger using information contained in these sections map source lines disassembly (and vice versa). i'd how. i'd know information these sections contain, how they're related, , how make sense out of them. in short, how read sections , make use of them, if write debugger (or @ least, tool can display these mappings: source disassembly, , back, number of disassembly lines per source line). assume 0 compilation optimization.
presumably there's doc describes format of these sections?
the .debug_* sections contain data in format described dwarf debugging standard. standard has web site can download standard specification: http://www.dwarfstd.org/
there libraries available parsing stored format (which highly condensed save space), 1 such libdwarf available here: http://reality.sgiweb.org/davea/dwarf.html
in short, different sections contain different aspects of source program, , how map target machine architecture (code , data addresses). information typically lost in compilation process represented tree of debug information entries, structures identifying tag, , various attributes. example, die variable declaration represented die dw_tag_variable
tag, , can have such attributes as: name, file/line/column declared, memory location in object file, etc.
the .debug_info , .debug_abbrev sections represent tree of debug information entries. .debug_line section contains information allows debugger reconstruct complete table mapping source code line object code address (and contains other information, whether or not source code line start of statement, , start of basic block, etc.).
other sections contain call frame information, , accelerated lookup tables finding variable dies , types name, , more. it's described in standard.
Comments
Post a Comment