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

Marc Glisse
2018-02-07T17:31:23Z

On Wed, 7 Feb 2018, Simon Marchi wrote:

> On 2018-02-07 12:08, Jonathan Wakely wrote:
>> Why would they not have a mangled name?
>>
>>> Interesting. What do they look like, and in what context do they appear?
>>
>> Anywhere you need a name for linkage purposes, such as in a function
>> signature, or as a template argument of another type, or in the
>> std::type_info::name() for the type etc. etc.
>>
>> $ g++ -o test.o -c -x c++ - <<< 'struct X {}; void f(X) {}
>> template<typename T> struct Y { }; void g(Y<X>) {}' && nm
>> --defined-only test.o
>> 0000000000000000 T _Z1f1X
>> 0000000000000007 T _Z1g1YI1XE
>>
>> The mangled name for X is "X" and the mangled name for Y<X> is "YI1XE"
>> which includes the name "X".
>>
>> This isn't really on-topic for solving the GDB type lookup problem though.
>
> Ah ok, the class name appears mangled in other entities' mangled name. But
> from what I understand there's no mangled name for the class such that
>
> echo <class mangled name> | c++filt
>
> outputs the class name (e.g. "Foo<10>"). That wouldn't make sense, since
> there's no symbol for the class itself.

$ echo _Z1YI1XE | c++filt
Y<X>

--
Marc Glisse