From: Dhaval O. <dha...@co...> - 2005-12-13 23:29:24
|
Hello All: I am having problems with DWARF2 debug information, so I am not sure if my question belongs in here or in the GCC mailing list. I did a search and came across problems with dwarf2 output that were fixed in the 3.4.4 version. However, I built a cross-compiler for the MIPS targets so I don't know if anyone else came across the problems which I am seeing. These are the following packages I am using: gcc-core-3.4.4-20050522 gcc-g++-3.4.4-20050522 binutils-2.16.91-20050827 newlib-1.12.0 These are the compile time flags I am using - CFLAGS = -g2 -mips2 -gdwarf-2 -fno-omit-frame-pointer -O0 -c -G 0 \ -$(ENDIAN) -D$(ENDIAN) -Wall -I. -I$(INCLUDE_DIR) Once I built my elf-image I noticed that when using our in-house debugger, some of the C++ files in my project had no debug source line information associated with it. The globals information is fine. I used read-elf to dump the DWARF2 debug information output for a single object file. I had the following questions after going through the DWARF2 output. 1) In the line number statements there are multiple "Extended opcode 1: End of Sequence" statments. I am not sure what this means even after reading the spec? How do I differentiate between multiple "End of Sequence" statments, that correspond to one DW_AT_stmt_list attribute? 2) In the line number statements there are multiple "Set File Name to entry x in the File Name Table" entries. However, there is no statement to set the File Name to the entry 1, which corresponds to the source file that we are getting information for? Is the DWARF output here incorrect or am I missing something here? BTW I am not an expert:) I am attaching parts of the output. > readelf -W class.o The section .debug_info contains: Compilation Unit @ 0: Length: 20172 Version: 2 Abbrev Offset: 0 Pointer Size: 4 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_stmt_list : 0 DW_AT_producer : GNU C++ 3.4.4 (mingw special) -g DW_AT_language : 4 (C++) DW_AT_name : Class.cpp DW_AT_comp_dir : C:\dev\Test_mips .... Dump of debug contents of section .debug_line: Length: 1064 DWARF Version: 2 Prologue Length: 620 Minimum Instruction Length: 1 Initial value of 'is_stmt': 1 Line Base: -5 Line Range: 14 Opcode Base: 10 (Pointer size: 4) Opcodes: Opcode 1 has 0 args Opcode 2 has 1 args Opcode 3 has 1 args Opcode 4 has 1 args Opcode 5 has 1 args Opcode 6 has 0 args Opcode 7 has 0 args Opcode 8 has 0 args Opcode 9 has 1 args The Directory Table: c:/corelis/gnu/build/bin/../lib/gcc/mips-elf/3.4.4/../../../../include/c++/3.4.4 c:/corelis/gnu/build/bin/../lib/gcc/mips-elf/3.4.4/../../../../include/c++/3.4.4/bits c:/corelis/gnu/build/bin/../lib/gcc/mips-elf/3.4.4/include c:/corelis/gnu/build/bin/../lib/gcc/mips-elf/3.4.4/../../../../include/c++/3.4.4/ext c:/corelis/gnu/build/bin/../lib/gcc/mips-elf/3.4.4/../../../../include/c++/3.4.4/mips-elf/bits The File Name Table: Entry Dir Time Size Name 1 0 0 0 Class.cpp 2 0 0 0 Class0.h 3 0 0 0 PtrTest.h 4 0 0 0 <internal> 5 1 0 0 new 6 1 0 0 exception 7 1 0 0 limits 8 2 0 0 basic_string.h 9 3 0 0 stddef.h 10 4 0 0 new_allocator.h 11 2 0 0 allocator.h 12 2 0 0 stringfwd.h 13 2 0 0 basic_string.tcc 14 5 0 0 atomic_word.h Line Number Statements: Set File Name to entry 2 in the File Name Table Extended opcode 2: set Address to 0x0 Advance Line by 72 to 73 Copy Special opcode 229: advance Address by 16 to 0x10 and Line by 0 to 73 Advance PC by 20 to 24 Extended opcode 1: End of Sequence Set File Name to entry 3 in the File Name Table Extended opcode 2: set Address to 0x0 Advance Line by 58 to 59 Copy Advance PC by constant 17 to 0x11 Special opcode 103: advance Address by 7 to 0x18 and Line by 0 to 59 Advance PC by 44 to 44 Extended opcode 1: End of Sequence Set File Name to entry 3 in the File Name Table Extended opcode 2: set Address to 0x0 Advance Line by 62 to 63 Copy Advance PC by constant 17 to 0x11 Special opcode 47: advance Address by 3 to 0x14 and Line by 0 to 63 Advance PC by 32 to 34 Extended opcode 1: End of Sequence Set File Name to entry 3 in the File Name Table Extended opcode 2: set Address to 0x0 Advance Line by 64 to 65 Copy Advance PC by constant 17 to 0x11 Special opcode 47: advance Address by 3 to 0x14 and Line by 0 to 65 Advance PC by 32 to 34 Extended opcode 1: End of Sequence Set File Name to entry 3 in the File Name Table Extended opcode 2: set Address to 0x0 Advance Line by 66 to 67 Copy Advance PC by constant 17 to 0x11 Special opcode 47: advance Address by 3 to 0x14 and Line by 0 to 67 Advance PC by 32 to 34 Extended opcode 1: End of Sequence Set File Name to entry 3 in the File Name Table Extended opcode 2: set Address to 0x0 Advance Line by 68 to 69 Copy Advance PC by constant 17 to 0x11 Special opcode 47: advance Address by 3 to 0x14 and Line by 0 to 69 Advance PC by 44 to 40 Extended opcode 1: End of Sequence .... Advance PC by 44 to b38 Special opcode 3: advance Address by 0 to 0xb38 and Line by -2 to 15 Advance Line by 44 to 59 Advance PC by 92 to b94 Copy Advance PC by constant 17 to 0xba5 Special opcode 104: advance Address by 7 to 0xbac and Line by 1 to 60 Special opcode 229: advance Address by 16 to 0xbbc and Line by 0 to 60 Advance PC by 40 to be4 Special opcode 6: advance Address by 0 to 0xbe4 and Line by 1 to 61 Special opcode 229: advance Address by 16 to 0xbf4 and Line by 0 to 61 Advance PC by 40 to c1c Extended opcode 1: End of Sequence The section .debug_frame contains: Thanks, Dhaval |