This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
c++/1063: ptype C prints too much or too little when C is a templated class
- From: carlton at math dot stanford dot edu
- To: gdb-gnats at sources dot redhat dot com
- Date: 15 Feb 2003 00:58:10 -0000
- Subject: c++/1063: ptype C prints too much or too little when C is a templated class
- Reply-to: carlton at math dot stanford dot edu
>Number: 1063
>Category: c++
>Synopsis: ptype C prints too much or too little when C is a templated class
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Feb 15 01:08:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: carlton@math.stanford.edu
>Release: GNU gdb 2003-02-14-cvs
>Organization:
>Environment:
i686, Red Hat 7.3, GCC 3.1, DWARF-2
>Description:
If C is a templated class and you do 'ptype C' (without
specifying a type, so not 'ptype C<int>' or whatever)
then sometimes GDB doesn't print anything while
sometimes GDB picks a type to instantiate it on
and prints out the value of the class for that type.
It seems to me that printing out nothing at all is
defensible; picking a type to instantiate it on,
though, is suboptimal; and not having a consistent
behavior is even less optimal
>How-To-Repeat:
Compile this:
template<typename T>
class C {
public:
T t;
};
int main()
{
C<int> ci;
C<char> cc;
}
Then:
jackfruit$ /extra/gdb/mirror/src/gdb/gdb a.out
GNU gdb 2003-02-14-cvs
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) ptype C
No symbol "C" in current context.
(gdb) b main
Breakpoint 1 at 0x80484a0: file foo.cc, line 11.
(gdb) r
Starting program: /home/carlton/tmp/a.out
Breakpoint 1, main () at foo.cc:11
11 }
(gdb) ptype C
type = class C<int> {
public:
int t;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: