This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/19320] New: RTTI symbols not found for non-type templates
- From: "scovich at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Tue, 01 Dec 2015 13:39:36 +0000
- Subject: [Bug c++/19320] New: RTTI symbols not found for non-type templates
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=19320
Bug ID: 19320
Summary: RTTI symbols not found for non-type templates
Product: gdb
Version: 7.10
Status: NEW
Severity: normal
Priority: P2
Component: c++
Assignee: unassigned at sourceware dot org
Reporter: scovich at gmail dot com
Target Milestone: ---
Consider the following simple test case:
=== bug.cpp ==========
struct Base {
virtual ~Base() { }
virtual int getN()=0;
};
template <char N>
struct Child : Base {
virtual int getN() { return N; };
};
int main() {
Base *b = new Child<5>;
return b->getN();
}
======================
Then the following cleaned-up typescript illustrates the problem:
=== typescript ========
$ g++ -g bug.cpp
$ gdb a.out
GNU gdb (GDB) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
...
(gdb) b bug.cpp:11
Breakpoint 1 at 0x1004010ee: file bug.cpp, line 11.
(gdb) r
`/tmp/a.out' has changed; re-reading symbols.
Starting program: /tmp/a.out
Breakpoint 1, main () at bug.cpp:11
(gdb) set print object
(gdb) p *b
warning: RTTI symbol not found for class 'Child<(char)5>'
$1 = warning: RTTI symbol not found for class 'Child<(char)5>'
warning: RTTI symbol not found for class 'Child<(char)5>'
{_vptr.Base = 0x1004030f0 <vtable for Child<(char)5>+16>}
(gdb) whatis foo::Child^I^I
foo::Child<(char)foo::Child<(char)'\005'>
foo::Child<(char)foo::Child<(char)5>::Child()
foo::Child<(char)foo::Child<(char)5>::getN()
foo::Child<(char)foo::Child<(char)5>::~Child()
=======================
Changing the template parameter type to `unsigned char` produces:
(gdb) p *b
(gdb) p *b
warning: RTTI symbol not found for class 'Child<(unsigned char)5>'
$4 = warning: RTTI symbol not found for class 'Child<(unsigned char)5>'
warning: RTTI symbol not found for class 'Child<(unsigned char)5>'
{_vptr.Base = 0x1004030f0 <vtable for Child<(unsigned char)5>+16>}
(gdb) whatis Child<^I^I
Child<5u>
Child<(unsigned char)5>::Child()
Child<(unsigned char)5>::getN()
Child<(unsigned char)5>::~Child()
Changing to an enum produces:
Changing to a bare `int` produces the desired behavior:
(gdb) p *b
$2 = (Child<5>) {<Base> = {
_vptr.Base = 0x1004030f0 <vtable for Child<5>+16>}, <No data fields>}
As does a bare `unsigned int`:
(gdb) p *b
$3 = (Child<5u>) {<Base> = {
_vptr.Base = 0x1004030f0 <vtable for Child<5u>+16>}, <No data fields>}
As does an enum `foo`:
(gdb) p *b
$5 = (Child<(foo)5>) {<Base> = {
_vptr.Base = 0x1004030f0 <vtable for Child<(foo)5>+16>}, <No data fields>}
The type names given for members of of such a template class do seem to be
represented consistently.
--
You are receiving this mail because:
You are on the CC list for the bug.