Missing DW_AT_MIPS_linkage_name specifier for constructor debug info

Jeff Johnston jjohnstn@redhat.com
Fri Dec 3 20:31:00 GMT 2004


I have noticed that both gcc 3.2.3 and gcc 3.4.1 don't generate a physical 
mangled name for the debuginfo of a class constructor whereas they do for every 
other member function of the class.

For example, in a class Test:

class Test
{
     private:
         const char * string;
         int   numChars;

     public:

         Test(const char * text);

         const char * getText() const;
         const char * getText(int a) const;

         void genException() throw(int);
};

compiled -O0 and -g, we get the following snippet from readelf -wi

  <1><9d9d>: Abbrev Number: 89 (DW_TAG_structure_type)
      DW_AT_sibling     : <9ec7>
      DW_AT_name        : Test
      DW_AT_byte_size   : 16
      DW_AT_decl_file   : 2
      DW_AT_decl_line   : 9
  <2><9daa>: Abbrev Number: 78 (DW_TAG_member)
      DW_AT_name        : string
      DW_AT_decl_file   : 2
      DW_AT_decl_line   : 11
      DW_AT_type        : <a1>
      DW_AT_data_member_location: 2 byte block: 23 0     (DW_OP_plus_uconst: 0)
      DW_AT_accessibility: 3     (private)
  <2><9dbc>: Abbrev Number: 78 (DW_TAG_member)
      DW_AT_name        : numChars
      DW_AT_decl_file   : 2
      DW_AT_decl_line   : 12
      DW_AT_type        : <9a>
      DW_AT_data_member_location: 2 byte block: 23 8     (DW_OP_plus_uconst: 8)
      DW_AT_accessibility: 3     (private)
  <2><9dd0>: Abbrev Number: 67 (DW_TAG_subprogram)
      DW_AT_sibling     : <9dea>
      DW_AT_external    : 1
      DW_AT_name        : Test
      DW_AT_decl_file   : 2
      DW_AT_decl_line   : 16
      DW_AT_declaration : 1
  <3><9dde>: Abbrev Number: 18 (DW_TAG_formal_parameter)
      DW_AT_type        : <9ec7>
      DW_AT_artificial  : 1
  <3><9de4>: Abbrev Number: 19 (DW_TAG_formal_parameter)
      DW_AT_type        : <a1>
  <2><9dea>: Abbrev Number: 37 (DW_TAG_subprogram)
      DW_AT_sibling     : <9e1a>
      DW_AT_external    : 1
      DW_AT_name        : getText
      DW_AT_decl_file   : 2
      DW_AT_decl_line   : 18
      DW_AT_MIPS_linkage_name: _ZNK4Test7getTextEv
      DW_AT_type        : <a1>
      DW_AT_declaration : 1


Note the difference between getText and the Test constructor.

This causes some problems for gdb which demangles the physical name when looking 
up symbols.  Since the name given in the debug info is just the member name, gdb 
doesn't find the constructor when asked to (e.g. list Test::Test).  A gdb kludge 
would be required to make this work properly.

Is there a reason for this or is it simply an oversight?

Please cc: me in any response.

-- Jeff J.



More information about the Gcc mailing list