Consider this program, compiled with -feliminate-dwarf2-dups ---------------------------- #include <iostream> #include <string>
using namespace std; int main(){ string s1 = "Hello"; } ----------------------------- readelf -wi produces: <0><103c>: Abbrev Number: 91 (DW_TAG_compile_unit) DW_AT_stmt_list : 712 DW_AT_producer : (indirect string, offset: 0xff3): GNU C++ 3.4.1 DW_AT_language : 4 (C++) DW_AT_name : ../../src/tx_ttf_string.cxx DW_AT_comp_dir : /home/nikolay/builds/xander-linux-x86/totalview/debugger/src/tests/bld/gcc_3.4.1_32 ......................... <1><2153>: Abbrev Number: 119 (DW_TAG_subprogram) DW_AT_sibling : <2186> DW_AT_external : 1 DW_AT_name : main DW_AT_decl_file : 54 DW_AT_decl_line : 8 DW_AT_type : <10b6> DW_AT_low_pc : 0x8048970 134515056 DW_AT_high_pc : 0x80489f3 134515187 DW_AT_frame_base : 1 byte block: 55 (DW_OP_reg5; ) <2><216e>: Abbrev Number: 116 (DW_TAG_lexical_block) DW_AT_low_pc : 0x804898d 134515085 DW_AT_high_pc : 0x80489e9 134515177 <3><2177>: Abbrev Number: 120 (DW_TAG_variable) DW_AT_name : s1 DW_AT_decl_file : 54 DW_AT_decl_line : 9 DW_AT_type : <#a92e> DW_AT_location : 2 byte block: 91 68 (DW_OP_fbreg: -24; ) Notice, that variable s1 is of type <#a92e>, The problem is, that type <#a92e> is defined as typedef in different CU (which is fine) and inside the scope of some "arbitrary" structure (which is wrong). Effectively type of s1 is not visible (out of scope) in main and is reported as <void> by the debugger. -- Summary: -feliminate-dwarf2-dups produces debug entries in wrong scope Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nikolay at etnus dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18112