For the example below, when using gcc 4.5 and svn head, gcc -gdwarf-4 is not
emitting the class definition in an enclosing namespace parent die.

foo.cc:

namespace thread {

class Executor {
 public:
  static Executor* CurrentExecutor();
};

}

namespace thread {

Executor* Executor::CurrentExecutor() {
  return 0;
}

}

thread::Executor *te;

int
main ()
{
  return 0;
}

bash$ gcc -g -c -o foo.o foo.cc
bash$ readelf -w foo.o >foo.w

-->

 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
   < c>   DW_AT_producer    : (indirect string, offset: 0x13): GNU C++ 4.6.0
20100914 (experimental)
   <10>   DW_AT_language    : 4        (C++)
   <11>   DW_AT_name        : (indirect string, offset: 0x69): foo.cc
   <15>   DW_AT_comp_dir    : (indirect string, offset: 0x0):
/home/dje/src/play
   <19>   DW_AT_low_pc      : 0x0
   <21>   DW_AT_high_pc     : 0xb
   <29>   DW_AT_stmt_list   : 0x0
 <1><2d>: Abbrev Number: 2 (DW_TAG_namespace)
   <2e>   DW_AT_name        : (indirect string, offset: 0x70): thread
   <32>   DW_AT_decl_file   : 1
   <33>   DW_AT_decl_line   : 2
   <34>   DW_AT_sibling     : <0x3f>
 <2><38>: Abbrev Number: 3 (DW_TAG_class_type)
   <39>   DW_AT_name        : (indirect string, offset: 0x39): Executor
   <3d>   DW_AT_declaration : 1
 <1><3f>: Abbrev Number: 4 (DW_TAG_class_type)
   <40>   DW_AT_specification: <0x38>
   <44>   DW_AT_byte_size   : 1
   <45>   DW_AT_decl_file   : 1
   <46>   DW_AT_decl_line   : 4
   <47>   DW_AT_sibling     : <0x5d>
 <2><4b>: Abbrev Number: 5 (DW_TAG_subprogram)
   <4c>   DW_AT_external    : 1
   <4d>   DW_AT_name        : (indirect string, offset: 0x77): CurrentExecutor
   <51>   DW_AT_decl_file   : 1
   <52>   DW_AT_decl_line   : 6
   <53>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x42):
_ZN6thread8Executor15CurrentExecutorEv
   <57>   DW_AT_type        : <0x5d>
   <5b>   DW_AT_declaration : 1
 <1><5d>: Abbrev Number: 6 (DW_TAG_pointer_type)
   <5e>   DW_AT_byte_size   : 8
   <5f>   DW_AT_type        : <0x3f>
 <1><63>: Abbrev Number: 7 (DW_TAG_subprogram)
   <64>   DW_AT_specification: <0x4b>
   <68>   DW_AT_decl_line   : 13
   <69>   DW_AT_low_pc      : 0x0
   <71>   DW_AT_high_pc     : 0xb
   <79>   DW_AT_frame_base  : 0x0      (location list)

bash$ gcc -gdwarf-4 -c -o foo.o foo.cc
bash$ readelf -w foo.o >foo.w

-->

 <0><b>: Abbrev Number: 7 (DW_TAG_compile_unit)
   < c>   DW_AT_producer    : (indirect string, offset: 0x13): GNU C++ 4.6.0
20100914 (experimental)
   <10>   DW_AT_language    : 4        (C++)
   <11>   DW_AT_name        : (indirect string, offset: 0x69): foo.cc
   <15>   DW_AT_comp_dir    : (indirect string, offset: 0x0):
/home/dje/src/play
   <19>   DW_AT_low_pc      : 0x0
   <21>   DW_AT_high_pc     : 0xb
   <29>   DW_AT_stmt_list   : 0x0
 <1><2d>: Abbrev Number: 8 (DW_TAG_namespace)
   <2e>   DW_AT_name        : (indirect string, offset: 0x70): thread
   <32>   DW_AT_decl_file   : 1
   <33>   DW_AT_decl_line   : 2
 <1><34>: Abbrev Number: 9 (DW_TAG_class_type)
   <35>   DW_AT_name        : (indirect string, offset: 0x39): Executor
   <39>   DW_AT_declaration : 1
   <39>   DW_AT_sibling     : <0x4d>
 <2><3d>: Abbrev Number: 5 (DW_TAG_subprogram)
   <3e>   DW_AT_external    : 1
   <3e>   DW_AT_name        : (indirect string, offset: 0x77): CurrentExecutor
   <42>   DW_AT_decl_file   : 1
   <43>   DW_AT_decl_line   : 6
   <44>   DW_AT_linkage_name: (indirect string, offset: 0x42):
_ZN6thread8Executor15CurrentExecutorEv
   <48>   DW_AT_type        : <0x4d>
   <4c>   DW_AT_declaration : 1
 <1><4d>: Abbrev Number: 10 (DW_TAG_pointer_type)
   <4e>   DW_AT_byte_size   : 8
   <4f>   DW_AT_type        : signature: a547508193f2f296
 <1><57>: Abbrev Number: 11 (DW_TAG_subprogram)
   <58>   DW_AT_specification: <0x3d>
   <5c>   DW_AT_decl_line   : 13
   <5d>   DW_AT_low_pc      : 0x0
   <65>   DW_AT_high_pc     : 0xb
   <6d>   DW_AT_frame_base  : 1 byte block: 9c         (DW_OP_call_frame_cfa)

Notice that in the -gdwarf-4 case the die for class Executor is missing an
enclosing namespace parent die.


-- 
           Summary: missing namespace parent die when using -gdwarf-4
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dje at google dot com
 GCC build triplet: amd64-linux
  GCC host triplet: amd64-linux
GCC target triplet: amd64-linux


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

Reply via email to