The attached test case compiled thus: g++ -g class.c class2.c -o class produces the following debuginfo:
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit) < c> DW_AT_producer : (indirect string, offset: 0x36): GNU C++ 4.3.0 20080428 (Red Hat 4.3.0-8) <10> DW_AT_language : 4 (C++) <11> DW_AT_name : (indirect string, offset: 0x0): class.c <15> DW_AT_comp_dir : (indirect string, offset: 0x19): /notnfs/swagiaal/tests/class <19> DW_AT_low_pc : 0x40055c <21> DW_AT_high_pc : 0x400568 <29> DW_AT_stmt_list : 0x0 <1><2d>: Abbrev Number: 2 (DW_TAG_class_type) <2e> DW_AT_name : A <30> DW_AT_byte_size : 1 <31> DW_AT_decl_file : 2 <32> DW_AT_decl_line : 4 <33> DW_AT_sibling : <0x49> <2><37>: Abbrev Number: 3 (DW_TAG_variable) <38> DW_AT_name : (indirect string, offset: 0x5f): elsewhere <3c> DW_AT_decl_file : 2 <3d> DW_AT_decl_line : 6 <3e> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x8): _ZN1A9elsewhereE <42> DW_AT_type : <0x49> <46> DW_AT_external : 1 <47> DW_AT_declaration : 1 [...] <1><86>: Abbrev Number: 3 (DW_TAG_variable) <87> DW_AT_name : (indirect string, offset: 0x5f): elsewhere <8b> DW_AT_decl_file : 2 <8c> DW_AT_decl_line : 6 <8d> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x8): _ZN1A9elsewhereE <91> DW_AT_type : <0x49> <95> DW_AT_external : 1 <96> DW_AT_declaration : 1 [...] <0><a3>: Abbrev Number: 1 (DW_TAG_compile_unit) <a4> DW_AT_producer : (indirect string, offset: 0x36): GNU C++ 4.3.0 20080428 (Red Hat 4.3.0-8) <a8> DW_AT_language : 4 (C++) <a9> DW_AT_name : (indirect string, offset: 0x6e): class2.c <ad> DW_AT_comp_dir : (indirect string, offset: 0x19): /notnfs/swagiaal/tests/class <b1> DW_AT_low_pc : 0x400568 <b9> DW_AT_high_pc : 0x400568 <c1> DW_AT_stmt_list : 0x46 <1><c5>: Abbrev Number: 2 (DW_TAG_class_type) <c6> DW_AT_name : A <c8> DW_AT_byte_size : 1 <c9> DW_AT_decl_file : 1 <ca> DW_AT_decl_line : 4 <cb> DW_AT_sibling : <0xe1> <2><cf>: Abbrev Number: 3 (DW_TAG_variable) <d0> DW_AT_name : (indirect string, offset: 0x5f): elsewhere <d4> DW_AT_decl_file : 1 <d5> DW_AT_decl_line : 6 <d6> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x8): _ZN1A9elsewhereE <da> DW_AT_type : <0xe1> <de> DW_AT_external : 1 <df> DW_AT_declaration : 1 [...] <1><ed>: Abbrev Number: 6 (DW_TAG_variable) <ee> DW_AT_specification: <0xcf> <f2> DW_AT_decl_file : 2 <f3> DW_AT_decl_line : 4 <f4> DW_AT_location : 9 byte block: 3 68 6 40 0 0 0 0 0 (DW_OP_addr: 400668) [...] The File Name Table: Entry Dir Time Size Name 1 0 0 0 class.c 2 0 0 0 class.h [...] The File Name Table: Entry Dir Time Size Name 1 0 0 0 class.h 2 0 0 0 class2.c As can be seen from the debug info there is an extra die (0x86). This die is misleading to the debugger. In that compile unit there are two die's representing declarations of the variable 'elsewhere' 0x37 and 0x86. The second one is in the incorrect scope and has no reference to the correct die. Please advise. Thanks -- Summary: Extranious DW_TAG_variable tag Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: swagiaal at redhat dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37982