[cfe-dev] Type suffixes should be generated for non-type template parameters in Debug info.

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Mon Feb 5 13:04:29 PST 2018


Seems fair (though I feel like/wish, perhaps there should be an implicit
type parameter in cases like this, but ah well).

I still think the idea that DWARF producers should create names that match
exactly some specific demangler's pretty printing is problematic... but in
this case there's clearly information loss that needs to be addressed.

On Sat, Feb 3, 2018 at 12:38 AM Roman Popov via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hello,
> I've noticed that Clang does not emits type suffixes to debug info,
> so types foo<1u> and foo<1> will be both saved to debug info as foo<1>.
>
> Unfortunately this leaves no chance to debugger to correctly identify
> dynamic type. Consider example:
>
> struct base {
>     virtual ~base() {}
> };
>
> template< auto IVAL>
> struct foo : base {
>     decltype(IVAL) x = -IVAL;
> };
>
> int main()
> {
>     base * fi = new foo<10>();
>     base * fu = new foo<10u>();
>
> //  BREAKPOINT HERE:
>     return 0;
> }
>
>
> Running in GDB:
>
> (gdb) p *fi
> $1 = (foo<10>) {<base> = {_vptr$base = 0x4009d8 <vtable for foo<10>+16>}, *x
> = 4294967286*}
>
> Wrong type!!, x == -10!!
>
> (gdb) p *fu
> warning: RTTI symbol not found for class 'foo<10u>'
> $2 = warning: RTTI symbol not found for class 'foo<10u>'
> warning: RTTI symbol not found for class 'foo<10u>'
> {_vptr$base = 0x400a58 <vtable for foo<10u>+16>}
>
> Dynamic type not identified.
>
>
> -Roman
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180205/82e94bf5/attachment.html>


More information about the cfe-dev mailing list