Regression from g++-4.3 for GNU C++ 4.4.0 20090315 (experimental)
(+also for 4.4.0 20090313 (Red Hat 4.4.0-0.26))
For full namespace import one should use DW_TAG_imported_module.

1:namespace A
2:{
3:  int i = 1;
4:}
5:
6:int
7:main ()
8:{
9:  using namespace A;
10:  i = 2;
11:  return 0;
12:}

Using g++-4.4 DWARF one must use `A::i' at `main' in the debugger.
The whole namespace `A' should be imported there instead.

WRONG g++-4.4 debuginfo:
    < c>   DW_AT_producer    : (indirect string, offset: 0x0): GNU C++ 4.4.0
20090315 (experimental)
 <1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2f>   DW_AT_name        : (indirect string, offset: 0x7d): main    
 <2><51>: Abbrev Number: 3 (DW_TAG_lexical_block)
    <52>   DW_AT_low_pc      : 0x4      
    <5a>   DW_AT_high_pc     : 0x13     
 <3><62>: Abbrev Number: 4 (DW_TAG_imported_declaration)
    <65>   DW_AT_name        : A        
    <67>   DW_AT_import      : <0x74>   [Abbrev Number: 6 (DW_TAG_namespace)]
 <1><74>: Abbrev Number: 6 (DW_TAG_namespace)
    <75>   DW_AT_name        : A        
 <2><7d>: Abbrev Number: 7 (DW_TAG_variable)
    <7e>   DW_AT_name        : i        
    <82>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x74): _ZN1A1iE   

Correct g++-4.3 debuginfo:
    < c>   DW_AT_producer    : (indirect string, offset: 0x0): GNU C++ 4.3.2
20081105 (Red Hat 4.3.2-7)
 <1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2f>   DW_AT_name        : (indirect string, offset: 0x80): main    
 <2><51>: Abbrev Number: 3 (DW_TAG_imported_module)
    <54>   DW_AT_import      : <0x60>   [Abbrev Number: 5 (DW_TAG_namespace)]
 <1><60>: Abbrev Number: 5 (DW_TAG_namespace)
    <61>   DW_AT_name        : A        
 <2><69>: Abbrev Number: 6 (DW_TAG_variable)
    <6a>   DW_AT_name        : i        
    <6e>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x77): _ZN1A1iE   
    <72>   DW_AT_type        : <0x59>   

It causes regressions on gdb.cp/namespace-using.exp for the GDB project Archer.


-- 
           Summary: DW_TAG_imported_module should be used (not
                    DW_TAG_imported_declaration)
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan dot kratochvil at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39471

Reply via email to