From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Received: (qmail 32637 invoked from network); 10 Jan 2003 21:19:58 -0000 Received: from unknown (HELO jackfruit.Stanford.EDU) (171.64.38.136) by 209.249.29.67 with SMTP; 10 Jan 2003 21:19:58 -0000 Received: (from carlton@localhost) by jackfruit.Stanford.EDU (8.11.6/8.11.6) id h0ALJkT24113; Fri, 10 Jan 2003 13:19:46 -0800 X-Authentication-Warning: jackfruit.Stanford.EDU: carlton set sender to carlton@math.stanford.edu using -f To: gdb Cc: Daniel Jacobowitz Subject: how canonical are template names? From: David Carlton Date: Fri, 10 Jan 2003 21:19:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-01/txt/msg00172.txt.bz2 I'm testing a patch on my branch that tries to figure out when a class lives inside a namespace by looking at the demangled names of the methods of the classes. When I tested the patch, I saw some regressions in gdb.c++/templates.exp. But, on looking at the situation further, I'm not sure that they qualify as regressions. Basically, there are different ways to write the same types; it turns out that G++'s debug info and the demangler choose different ways in some circumstances. In an ideal world, maybe GDB would always print types in one canonical way and allow users as much flexibility as possible in how they input types. But, for now, it seems quite reasonable to allow GDB to print types however it wishes and to require users to input types the same way that GDB outputs them in some circumstances. Usually, users can figure out what name GDB thinks a templated class has by calling 'ptype' on a variable of the appropriate type. Here's the differences in question, taken from gdb.logs in testsuite runs (with control-M's stripped). I'll do it test by test, listing the current output first and my new output second. ptype fvpchar type = class Foo { public: int x; volatile char *t; volatile char * foo(int, char volatile*); } (gdb) PASS: gdb.c++/templates.exp: ptype fvpchar ptype fvpchar type = class Foo { public: int x; volatile char *t; volatile char * foo(int, char volatile*); } (gdb) FAIL: gdb.c++/templates.exp: ptype fvpchar **** Current print Foo::foo No symbol "Foo" in current context. (gdb) FAIL: gdb.c++/templates.exp: print Foo::foo ptype Bar type = class Bar { public: int x; int t; int bar(int, int); } (gdb) XFAIL: gdb.c++/templates.exp: ptype Bar ptype bint type = class Bar { public: int x; int t; int bar(int, int); } (gdb) PASS: gdb.c++/templates.exp: ptype bint ptype bint2 type = class Bar { public: int x; int t; int bar(int, int); } (gdb) PASS: gdb.c++/templates.exp: ptype bint2 ptype Baz type = class Baz { public: int x; int t; int baz(int, int); } (gdb) XFAIL: gdb.c++/templates.exp: ptype Baz ptype bazint type = class Baz { public: int x; int t; int baz(int, int); } (gdb) PASS: gdb.c++/templates.exp: ptype bazint ptype bazint2 type = class Baz { public: int x; char t; char baz(int, char); } (gdb) PASS: gdb.c++/templates.exp: ptype bazint2 ptype Qux type = class Qux { public: int x; char t; char qux(int, char); } (gdb) XFAIL: gdb.c++/templates.exp: ptype Qux ptype quxint type = class Qux { public: int x; int t; int qux(int, int); } (gdb) PASS: gdb.c++/templates.exp: ptype quxint ptype Spec type = class Spec { public: int x; int spec(char); } (gdb) XFAIL: gdb.c++/templates.exp: ptype Spec ptype siip type = class Spec { public: int x; int spec(int*); } (gdb) PASS: gdb.c++/templates.exp: ptype siip ptype Garply type = class Garply { public: int x; int t; int garply(int, int); } (gdb) PASS: gdb.c++/templates.exp: ptype Garply ptype Garply > type = class Garply > { public: int x; Garply t; Garply garply(int, Garply); } (gdb) PASS: gdb.c++/templates.exp: ptype Garply > print Garply >::garply $4 = {Garply (Garply > * const, int, Garply)} 0x8049516 >::garply(int, Garply)> (gdb) FAIL: gdb.c++/templates.exp: print Garply >::garply break Garply >::garply Breakpoint 5 at 0x8049528: file gdb.c++/templates.cc, line 696. (gdb) PASS: gdb.c++/templates.exp: break Garply >::garply testcase ./gdb.c++/templates.exp completed in 7 seconds === gdb Summary === # of expected passes 16 # of unexpected failures 6 # of expected failures 5 Executing on host: /extra/gdb/mirror/src/gdb/testsuite/../../gdb/gdb -nw --command gdb_cmd (timeout = 300) spawn /extra/gdb/mirror/src/gdb/testsuite/../../gdb/gdb -nw --command gdb_cmd GNU gdb 2003-01-09-cvs Copyright 2002 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". /extra/gdb/mirror/src/gdb/testsuite/../../gdb/gdb version 2003-01-09-cvs -nx runtest completed at Fri Jan 10 12:51:33 2003 **** New print Foo::foo $4 = {volatile char *(Foo * const, int, volatile char *)} 0x80493be ::foo(int, char volatile*)> (gdb) FAIL: gdb.c++/templates.exp: print Foo::foo ptype Bar type = class Bar { public: int x; int t; int bar(int, int); } (gdb) XFAIL: gdb.c++/templates.exp: ptype Bar ptype bint type = class Bar { public: int x; int t; int bar(int, int); } (gdb) FAIL: gdb.c++/templates.exp: ptype bint ptype bint2 type = class Bar { public: int x; int t; int bar(int, int); } (gdb) FAIL: gdb.c++/templates.exp: ptype bint2 ptype Baz type = class Baz { public: int x; int t; int baz(int, int); } (gdb) XFAIL: gdb.c++/templates.exp: ptype Baz ptype bazint type = class Baz { public: int x; int t; int baz(int, int); } (gdb) FAIL: gdb.c++/templates.exp: ptype bazint ptype bazint2 type = class Baz { public: int x; char t; char baz(int, char); } (gdb) FAIL: gdb.c++/templates.exp: ptype bazint2 ptype Qux type = class Qux { public: int x; char t; char qux(int, char); } (gdb) XFAIL: gdb.c++/templates.exp: ptype Qux ptype quxint type = class Qux { public: int x; int t; int qux(int, int); } (gdb) FAIL: gdb.c++/templates.exp: ptype quxint ptype Spec type = class Spec { public: int x; int spec(char); } (gdb) XFAIL: gdb.c++/templates.exp: ptype Spec ptype siip type = class Spec { public: int x; int spec(int*); } (gdb) FAIL: gdb.c++/templates.exp: ptype siip ptype Garply type = class Garply { public: int x; int t; int garply(int, int); } (gdb) PASS: gdb.c++/templates.exp: ptype Garply ptype Garply > type = class Garply > { public: int x; Garply t; Garply garply(int, Garply); } (gdb) PASS: gdb.c++/templates.exp: ptype Garply > print Garply >::garply $5 = {Garply (Garply > * const, int, Garply)} 0x8049516 >::garply(int, Garply)> (gdb) FAIL: gdb.c++/templates.exp: print Garply >::garply break Garply >::garply Breakpoint 5 at 0x8049528: file gdb.c++/templates.cc, line 696. (gdb) PASS: gdb.c++/templates.exp: break Garply >::garply testcase ./gdb.c++/templates.exp completed in 7 seconds === gdb Summary === # of expected passes 9 # of unexpected failures 13 # of expected failures 5 Executing on host: /extra/gdb/dictionary/src/gdb/testsuite/../../gdb/gdb -nw --command gdb_cmd (timeout = 300) spawn /extra/gdb/dictionary/src/gdb/testsuite/../../gdb/gdb -nw --command gdb_cmd GNU gdb 2002-12-23-cvs Copyright 2002 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". /extra/gdb/dictionary/src/gdb/testsuite/../../gdb/gdb version 2002-12-23-cvs -nx runtest completed at Fri Jan 10 12:45:54 2003