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

Roman Popov
2018-02-03T05:02:03Z

Yes, problem is still there in g++7.3 / gdb 8.1. I wonder why they decided
to emit different strings to RTTI and debug info? What is the technical
reason behind this?

-Roman

2018-02-02 20:54 GMT-08:00 Simon Marchi <simon.marchi@polymtl.ca>:

> On 2018-02-02 22:17, Roman Popov wrote:
>
>> Hello,
>> I'm trying to switch from g++ 5.4 to g++ 7.2.
>> GDB 8.0.1 however does not understand RTTI generated by g++7.2, so my
>> Python scripts for GDB are not working.
>>
>> Here is a code example:
>>
>> struct base { virtual ~base(){} };
>>
>> template< int IVAL, unsigned UVAL, unsigned long long ULLVAL>
>> struct derived : base {
>> int x = IVAL + + UVAL + ULLVAL;
>> };
>>
>> int main()
>> {
>> base * o = new derived<1,2,3>{};
>> return 0;
>> }
>>
>> When compiled with g++5.4 I can read value of x in debugger.
>> When compiled with g++7.2 gdb reports:
>> warning: RTTI symbol not found for class 'derived<1, 2u, 3ull>'
>>
>> Problem here is that type name saved in debug information is
>> *derived<1, 2, 3>*, not *derived<1, 2u, 3ull>*
>>
>> Do you plan to fix this anytime soon?
>>
>> Thanks,
>> Roman
>>
>
> Hi Roman,
>
> Your problem is probably linked to these issues, if you want to follow
> them:
>
> gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81932
> gdb: https://sourceware.org/bugzilla/show_bug.cgi?id=22013
>
> As Carl said, it's a good idea to try with the latest version of both
> tools, but I think the issue will still be present.
>
> GCC changed how it outputs unsigned template parameters in the debug info
> (from 2u to just 2), and it doesn't look like it's going to change it
> back. So I suppose we'll have to find a way to make GDB deal with it.
>
> Simon
>