gdb 8.x - g++ 7.x compatibility

Simon Marchi simon.marchi@polymtl.ca
Wed Feb 7 17:13:00 GMT 2018


On 2018-02-07 11:50, Jonathan Wakely wrote:
> On 7 February 2018 at 16:36, Simon Marchi wrote:
>> On 2018-02-07 11:26, Michael Matz wrote:
>>> 
>>> Hi,
>>> 
>>> On Wed, 7 Feb 2018, Simon Marchi wrote:
>>> 
>>>> This addresses the issue of how to do good software design in GDB to
>>>> support different producers cleanly, but I think we have some issues
>>>> even before that, like how to support g++ 7.3 and up.  I'll try to
>>>> summarize the issue quickly. It's now possible to end up with two
>>>> templated classes with the same name that differ only by the 
>>>> signedness
>>>> of their non-type template parameter.  One is Foo<int N> and the 
>>>> other
>>>> is Foo<unsigned int N> (the 10 is unsigned).  Until 7.3, g++ would
>>>> generate names like Foo<10> for the former and names like Foo<10u> 
>>>> for
>>>> the later (in the DW_AT_name attribute of the classes' DIEs). Since 
>>>> 7.3,
>>>> it produces Foo<10> for both.
>>> 
>>> 
>>> Yeah, gdb needs a way to lookup types by name, and since the change
>>> DW_AT_name can't be used for this anymore.  Either that needs to be
>>> fixed/reverted, or we do the more obvious thing: since types in C++ 
>>> have
>>> linkage it makes sense to add the linkage (i.e. mangled) name to the 
>>> types
>>> DIE using the traditional DW_AT_MIPS_linkage_name.
>>> 
>>> That latter solution would have the advantage that you don't need to
>>> demangle anything anymore.  From vtable you get to typeinfo, from 
>>> there
>>> for typeinfo name, and that contains the mangled type name (without 
>>> _Z
>>> prefix).
>> 
>> 
>> But do struct/classes have mangled names?
> 
> Yes.

Interesting.  What do they look like, and in what context do they 
appear?

Simon



More information about the Gcc mailing list