This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][C++] Fix PR29433, make C++ use a lot less time/memory


On Mon, Dec 11, 2006 at 09:29:05PM +0100, Richard Guenther wrote:
> You are aware that, in it's current form for the testcase in PR29433 the
> largest such string is 2MB in size?  Also the specification
> "whose value is a string representing the name as it appears in the
> source program" is not exactly clear to me.  Would gdb prefer
> "std::string" or "string" or "std::basic_string" or even
> "basic_string<char,std::char_traits<char>,std::allocator<char> >"
> (which is what we currently have).
> 
> I believe that gdb could be more friendly in printing templated types
> if they are presented in a better to machine-analyze manner, like in
> mangled form rather than "arbitraryly" choosing one of the above.

If you want, you could take this opportunity to output template
information correctly :-)  But it might not help...  The DWARF
specification is somewhat ambiguous about what ought to go in the name.

GCC doesn't output explicit information for template type parameters.
ICC does, but uses the same long names that GCC does anyway (probably
for compatibility).

 <1><a6>: Abbrev Number: 3 (DW_TAG_class_type)
     DW_AT_decl_line   : 1
     DW_AT_decl_column : 26
     DW_AT_decl_file   : 1
     DW_AT_accessibility: 1     (public)
     DW_AT_byte_size   : 4
     DW_AT_name        : X<int>
 <2><c1>: Abbrev Number: 5 (DW_TAG_template_type_param)
     DW_AT_decl_line   : 1
     DW_AT_decl_column : 17
     DW_AT_decl_file   : 1
     DW_AT_name        : T
     DW_AT_type        : <cc>
 <1><cc>: Abbrev Number: 6 (DW_TAG_base_type)
     DW_AT_byte_size   : 4
     DW_AT_encoding    : 5      (signed)
     DW_AT_name        : int

ARM RVCT on the other hand only produces the short names but lists
template parameters:

 <1><5e>: Abbrev Number: 5 (DW_TAG_class_type)
     DW_AT_sibling     : <a6>
     DW_AT_name        : X
     DW_AT_byte_size   : 4
 <2><64>: Abbrev Number: 130 (DW_TAG_template_type_param)
     DW_AT_type        : DW_FORM_ref1 <9e>
 <2><9e>: Abbrev Number: 4 (DW_TAG_base_type)
     DW_AT_byte_size   : 4
     DW_AT_encoding    : 5      (signed)
     DW_AT_name        : int

I guess we could switch from the first form to the second form, if
someone added GDB support for DW_TAG_template_type_param and
DW_TAG_template_value_param.  GDB could handle both cases, because
a valid DW_AT_name in C++ would never have '<' in it if there
were explicit params.  What do you think?

Anyway, if that's more than you want to bite off right now, I think
we need to hold on to what we have now.

As for "string", that's a typedef; it should show up in the debug info
separately.

> where DW_AT_name is a very simplified form of DW_AT_MIPS_linkage_name.

Correct.  I have been working on pruning GDB's dependence on
DW_AT_MIPS_linkage_name; in the future, it would be nice to drop it
from our output.  But I haven't had time to go back to that project
this year.  I may in 2007, though, since it just came up again for
another project.

> The question is where gdb uses the DW_AT_name in DW_TAG_structure_type
> specifiers - I couldn't find an entry in the gdb testsuite that looks
> at it.

I may have missed this, but if you haven't, maybe try just outputing a
bare identifier, running gdb.cp/*.exp before and after, and diffing
gdb.log? I would even expect failures.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]