Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [patch/rfc] gdb.c++/templates.exp, pr gdb/1063
  2003-02-26  0:35 [patch/rfc] gdb.c++/templates.exp, pr gdb/1063 David Carlton
@ 2003-02-26  0:15 ` Daniel Jacobowitz
  2003-02-26  1:35   ` David Carlton
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2003-02-26  0:15 UTC (permalink / raw)
  To: gdb-patches

On Tue, Feb 25, 2003 at 03:44:05PM -0800, David Carlton wrote:
> I'm starting to clean up FAILs and XFAILs in gdb.c++/templates.exp.  I
> see several (especially in DWARF-2), with various causes, and they're
> kind of subtle, so I'll probably do multiple patches for this.
> (Frankly, the whole file is full of HP'isms and regexps that I'm
> suspicious of, but never mind that.)
> 
> Anyways: there are 5 tests that were all originally XFAILed that all
> exhibit the same behavior.  Basically, there's a templated classes C,
> with a few instantiations.  Then the test does 'ptype C'.
> 
> Right now, with GCC 3.1/DWARF-2, GDB arbitrarily picks one of the
> instantiations and does ptype of that.  (Though not always, as I
> commented in PR gdb/1063.)  With GCC 2.95.3/stabs+, however, GDB says
> that there's no type in question.  What the testsuite is requesting is
> that GDB actually know that it's a templated type, and print out
> something related to that.
> 
> For example, say that C is:
> 
> template <class T>
> class C {
>   T x;
> };
> 
> Then if you do 'ptype C', then in some circumstances, GDB will print
> out the type of C<int>, in some circumstances GDB won't print out
> anything (presumably because it knows about the types C<int>, C<char>,
> or whatever, but not about just C), and the test suite wants output
> that looks like what I wrote above.

Note that we can't print out the above in stabs or dwarf-2; neither of
them puts the abstract type in the debug info, only the referenced
type.  DWARF-2 can say a bit more than it does now - specifically, that
"int" is a template paramater for C - but "DWARF does not represent the
generic template definition, but does represent each instantiation"
according to the v3 draft.

The reason we often print out one of the instantiations is because each
C<T> contains a nested typedef for C in the DWARF-2.  We don't handle
nested types right yet.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch/rfc] gdb.c++/templates.exp, pr gdb/1063
  2003-02-26  1:35   ` David Carlton
@ 2003-02-26  0:34     ` Daniel Jacobowitz
  2003-02-26  1:03       ` David Carlton
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2003-02-26  0:34 UTC (permalink / raw)
  To: gdb-patches

On Tue, Feb 25, 2003 at 04:30:29PM -0800, David Carlton wrote:
> On Tue, 25 Feb 2003 19:15:36 -0500, Daniel Jacobowitz <drow@mvista.com> said:
> 
> > Note that we can't print out the above in stabs or dwarf-2; neither of
> > them puts the abstract type in the debug info, only the referenced
> > type.  DWARF-2 can say a bit more than it does now - specifically, that
> > "int" is a template paramater for C - but "DWARF does not represent the
> > generic template definition, but does represent each instantiation"
> > according to the v3 draft.
> 
> Thanks for the info; I hadn't gotten around to looking at the relevant
> parts of the DWARF standard yet.
> 
> > The reason we often print out one of the instantiations is because each
> > C<T> contains a nested typedef for C in the DWARF-2.  We don't handle
> > nested types right yet.
> 
> Ah.  Hmm.  Why does it contain a nested typedef for C?  I guess that
> makes sense: 14.6p2 gives an example of how you can use C to refer to
> C<T> within the definition of C<T>.
> 
> In that case, I don't think that the desire of the original test case
> (i.e. printing out actual template info) is reasonable: it's not the
> job of GDB's test suite to lobby for improvements in debugging
> formats.  So I think the proper behavior is to delete the original
> success regexps, to decide that, in this situation, GDB shouldn't
> print out any information (which is what currently happens with GCC
> 2.95.3/stabs), to KFAIL the situations where it does print out an
> instantiation with reference to a PR about nested classes (I assume we
> have such a PR, if not I'll create one), and to close PR 1063 with an
> appropriate comment.
> 
> How does that sound?

Or run the test only for HP, which _does_ have this information.

Does any of the code still work?  I've got no idea.  I only ran the C
testsuites on HP/UX, not the C++ ones.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [patch/rfc] gdb.c++/templates.exp, pr gdb/1063
@ 2003-02-26  0:35 David Carlton
  2003-02-26  0:15 ` Daniel Jacobowitz
  0 siblings, 1 reply; 9+ messages in thread
From: David Carlton @ 2003-02-26  0:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: Michael Elizabeth Chastain, Daniel Jacobowitz

I'm starting to clean up FAILs and XFAILs in gdb.c++/templates.exp.  I
see several (especially in DWARF-2), with various causes, and they're
kind of subtle, so I'll probably do multiple patches for this.
(Frankly, the whole file is full of HP'isms and regexps that I'm
suspicious of, but never mind that.)

Anyways: there are 5 tests that were all originally XFAILed that all
exhibit the same behavior.  Basically, there's a templated classes C,
with a few instantiations.  Then the test does 'ptype C'.

Right now, with GCC 3.1/DWARF-2, GDB arbitrarily picks one of the
instantiations and does ptype of that.  (Though not always, as I
commented in PR gdb/1063.)  With GCC 2.95.3/stabs+, however, GDB says
that there's no type in question.  What the testsuite is requesting is
that GDB actually know that it's a templated type, and print out
something related to that.

For example, say that C is:

template <class T>
class C {
  T x;
};

Then if you do 'ptype C', then in some circumstances, GDB will print
out the type of C<int>, in some circumstances GDB won't print out
anything (presumably because it knows about the types C<int>, C<char>,
or whatever, but not about just C), and the test suite wants output
that looks like what I wrote above.

To be honest, I can imagine how any of the three possible outputs
would be a reasonable choice for GDB.  But certainly being
inconsistent about this isn't reasonable!  So, for now, I've filed a
bug report (which I will add to momentarily, giving the additional
information about GCC 2.95.3/stabs+), and I'm proposing to KFAIL the
tests, sending all current GDB output to that PR.  If at some point in
the future, we actually decide on the correct output, then we can
change the test suite accordingly.

(By the way, the patch involved a little bit of reindenting, so the
patch looks a little busier than it actually is: I left all existing
cases alone.)

Comments?  Suggestions?  I'll apply this patch tomorrow unless anybody
has a particular feeling that this isn't an appropriate approach.

More patches to this file are in the works; like I said, there are
various issues involved.

David Carlton
carlton@math.stanford.edu

2003-02-25  David Carlton  <carlton@math.stanford.edu>

	* gdb.c++/templates.exp (do_tests): Convert XFAILs corresponding
	to PR c++/1063 into KFAILs.  Tweak indentation.
	Update copyright.

Index: templates.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/templates.exp,v
retrieving revision 1.13
diff -u -p -r1.13 templates.exp
--- templates.exp	13 Feb 2003 21:33:20 -0000	1.13
+++ templates.exp	25 Feb 2003 23:19:41 -0000
@@ -1,4 +1,4 @@
-# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002
+# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -242,17 +242,22 @@ gdb_expect {   
 
 # Template Foo<T>
 
-setup_xfail hppa64-*-* CLLbs16092
 # g++ can't do the template instantiation in debug info trick, so we
 # fail this because it's not a real type.
-if {!$hp_aCC_compiler} { setup_xfail *-*-* }
 send_gdb "ptype Foo\n"   
 gdb_expect {   
-   -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo<volatile char \\*>\r\n\[ \t\]*(class |)Foo<char>\r\n\[ \t\]*(class |)Foo<int>\r\n$gdb_prompt $" { pass "ptype Foo" }
-   -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Foo" }
-   -re "$gdb_prompt $"                     { fail "ptype Foo" }
-   timeout                             { fail "(timeout) ptype Foo" }
+    -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo<volatile char \\*>\r\n\[ \t\]*(class |)Foo<char>\r\n\[ \t\]*(class |)Foo<int>\r\n$gdb_prompt $" { pass "ptype Foo" }
+    -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Foo" }
+    -re "type = class Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+	kfail "gdb/1063" "ptype Foo" }
+    -re "No symbol \"Foo\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+	kfail "gdb/1063" "ptype Foo" }
+    -re "$gdb_prompt $"                     { fail "ptype Foo" }
+    timeout                             { fail "(timeout) ptype Foo" }
 }
+#    -re "type = class Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo(int, int);\r\n\\}\r\n$gdb_prompt $"
 
 # ptype Foo<int>
 
@@ -292,15 +297,19 @@ gdb_expect {   
 
 # Template Bar<T, int>
 
-setup_xfail hppa64-*-* CLLbs16092
 # same as Foo for g++
-if {!$hp_aCC_compiler} { setup_xfail *-*-* }
 send_gdb "ptype Bar\n"   
 gdb_expect {   
-   -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)1>\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)33>\r\n$gdb_prompt $" { pass "ptype Bar" }
-   -re "type = <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Bar" }
-   -re "$gdb_prompt $"                     { fail "ptype Bar" }
-   timeout                             { fail "(timeout) ptype Bar" }
+    -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)1>\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)33>\r\n$gdb_prompt $" { pass "ptype Bar" }
+    -re "type = <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Bar" }
+    -re "ptype Bar\r\ntype = class Bar<int,33> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+	kfail "gdb/1063" "ptype Bar" }
+    -re "No symbol \"Bar\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+	kfail "gdb/1063" "ptype Bar" }
+    -re "$gdb_prompt $"                     { fail "ptype Bar" }
+    timeout                             { fail "(timeout) ptype Bar" }
 }
 
 
@@ -324,15 +333,19 @@ gdb_expect {   
 
 # Template Baz<T, char>
 
-setup_xfail hppa64-*-* CLLbs16092
 # Same as Foo, for g++
-if {!$hp_aCC_compiler} { setup_xfail *-*-* }
 send_gdb "ptype Baz\n"   
 gdb_expect {   
-   -re "type = template <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz<char,(\\(char\\)|)97>\r\n\[ \t\]*(class |)Baz<int,(\\(char\\)|)115>\r\n$gdb_prompt $" { pass "ptype Baz" }
-   -re "type = <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Baz" }
-   -re "$gdb_prompt $"                     { fail "ptype Baz" }
-   timeout                             { fail "(timeout) ptype Baz" }
+    -re "type = template <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz<char,(\\(char\\)|)97>\r\n\[ \t\]*(class |)Baz<int,(\\(char\\)|)115>\r\n$gdb_prompt $" { pass "ptype Baz" }
+    -re "type = <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Baz" }
+    -re "type = class Baz<int,'s'> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+	kfail "gdb/1063" "ptype Baz" }
+    -re "No symbol \"Baz\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+	kfail "gdb/1063" "ptype Baz" }
+    -re "$gdb_prompt $"                     { fail "ptype Baz" }
+    timeout                             { fail "(timeout) ptype Baz" }
 }
 
 
@@ -356,13 +369,18 @@ gdb_expect {   
 
 # Template Qux<T, int (*f)(int) >
 # Same as Foo for g++
-if {!$hp_aCC_compiler} {setup_xfail *-*-*}
 send_gdb "ptype Qux\n"   
 gdb_expect {   
-   -re "type = template <(class |)T, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux<int,&string>\r\n\[ \t\]*(class |)Qux<char,&string>\r\n$gdb_prompt $" { pass "ptype Qux" }
-   -re ".*type = template <(class |)T.*, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}.*$gdb_prompt $" { pass "ptype Qux" }
-   -re "$gdb_prompt $"                     { fail "ptype Qux" }
-   timeout                             { fail "(timeout) ptype Qux" }
+    -re "type = template <(class |)T, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux<int,&string>\r\n\[ \t\]*(class |)Qux<char,&string>\r\n$gdb_prompt $" { pass "ptype Qux" }
+    -re ".*type = template <(class |)T.*, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}.*$gdb_prompt $" { pass "ptype Qux" }
+    -re "type = class Qux<char,&string> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+	kfail "gdb/1063" "ptype Qux" }
+    -re "No symbol \"Qux\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+	kfail "gdb/1063" "ptype Qux" }
+    -re "$gdb_prompt $"                     { fail "ptype Qux" }
+    timeout                             { fail "(timeout) ptype Qux" }
 }
 
 # pt Qux<int,&string>
@@ -387,15 +405,19 @@ gdb_expect {   
 
 # Template Spec<T1, T2>
 
-setup_xfail hppa64-*-* CLLbs16092
 # Same as Foo for g++
-if {!$hp_aCC_compiler} { setup_xfail *-*-* }
 send_gdb "ptype Spec\n"   
 gdb_expect {   
-   -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec<int,int \\*>\r\n\[ \t\]*(class |)Spec<int,char>\r\n$gdb_prompt $" { pass "ptype Spec" }
-   -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Spec" }
-   -re "$gdb_prompt $"                     { fail "ptype Spec" }
-   timeout                             { fail "(timeout) ptype Spec" }
+    -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec<int,int \\*>\r\n\[ \t\]*(class |)Spec<int,char>\r\n$gdb_prompt $" { pass "ptype Spec" }
+    -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Spec" }
+    -re "type = class Spec<int,char> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(char\\);\r\n}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+	kfail "gdb/1063" "ptype Spec" }
+    -re "No symbol \"Spec\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+	kfail "gdb/1063" "ptype Spec" }
+    -re "$gdb_prompt $"                     { fail "ptype Spec" }
+    timeout                             { fail "(timeout) ptype Spec" }
 }
 
 # pt Spec<char,0>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch/rfc] gdb.c++/templates.exp, pr gdb/1063
  2003-02-26  0:34     ` Daniel Jacobowitz
@ 2003-02-26  1:03       ` David Carlton
  2003-02-26 20:27         ` David Carlton
  0 siblings, 1 reply; 9+ messages in thread
From: David Carlton @ 2003-02-26  1:03 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

On Tue, 25 Feb 2003 19:34:26 -0500, Daniel Jacobowitz <drow@mvista.com> said:
> On Tue, Feb 25, 2003 at 04:30:29PM -0800, David Carlton wrote:

>> In that case, I don't think that the desire of the original test case
>> (i.e. printing out actual template info) is reasonable: it's not the
>> job of GDB's test suite to lobby for improvements in debugging
>> formats.  So I think the proper behavior is to delete the original
>> success regexps, to decide that, in this situation, GDB shouldn't
>> print out any information (which is what currently happens with GCC
>> 2.95.3/stabs), to KFAIL the situations where it does print out an
>> instantiation with reference to a PR about nested classes (I assume we
>> have such a PR, if not I'll create one), and to close PR 1063 with an
>> appropriate comment.
>> 
>> How does that sound?

> Or run the test only for HP, which _does_ have this information.

> Does any of the code still work?  I've got no idea.  I only ran the C
> testsuites on HP/UX, not the C++ ones.

I confess, I'm not too thrilled about the idea of maintaining
HP-specific tests or regexps in the test suite.  There's way too much
HP-specific code in GDB already, and it's a pain to have to figure out
whether or not that code is doing something that can't be done in the
non-HP situation, that should be done in the non-HP situation, that
could (possibly is) be done identically in the HP- and non-HP
situation but is gratuitously incompatible for no good reason, or
whatever.  It's hard enough work getting GDB to work decently with GCC
2.95.3 and GCC 3.1 or newer with stabs+ and DWARF-2, which is what we
officially support; I really don't want to spend any effort on
anything else.

Having said that, one could certainly argue that leaving those regexps
in place doesn't count as "spending any effort"!  But I'd rather leave
those tests in place, and run them on all platforms, instead of
running the test only for HP.  In which case we should either PASS or
XFAIL the non-HP regexps; I'd vote for PASS.  (Though of course we
should KFAIL the case where GDB gets it wrong because of nested
types.)

Hmm.  I guess, for now, just leaving the HP regexps in place is
correct.  At some point, we should consider making a policy decision
on this: in an ideal world, we would go through the current PASS
regexps in all the tests just to make sure that we really think those
PASS regexps are proper behavior that might be observed by GDB.  And,
at that point, the HP regexps will actively get in our way.  But until
then, I suppose it doesn't hurt to leave them there.

So my current plan is to leave the HP regexps (but add a comment), to
PASS the case where GDB can't print out the type info, to KFAIL the
case where GDB incorrectly prints out one of the specializations (with
reference to a nested types PR), and to close PR gdb/1063 (with an
appropriate comment).  How does that sound?

David Carlton
carlton@math.stanford.edu


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch/rfc] gdb.c++/templates.exp, pr gdb/1063
  2003-02-26  0:15 ` Daniel Jacobowitz
@ 2003-02-26  1:35   ` David Carlton
  2003-02-26  0:34     ` Daniel Jacobowitz
  0 siblings, 1 reply; 9+ messages in thread
From: David Carlton @ 2003-02-26  1:35 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

On Tue, 25 Feb 2003 19:15:36 -0500, Daniel Jacobowitz <drow@mvista.com> said:

> Note that we can't print out the above in stabs or dwarf-2; neither of
> them puts the abstract type in the debug info, only the referenced
> type.  DWARF-2 can say a bit more than it does now - specifically, that
> "int" is a template paramater for C - but "DWARF does not represent the
> generic template definition, but does represent each instantiation"
> according to the v3 draft.

Thanks for the info; I hadn't gotten around to looking at the relevant
parts of the DWARF standard yet.

> The reason we often print out one of the instantiations is because each
> C<T> contains a nested typedef for C in the DWARF-2.  We don't handle
> nested types right yet.

Ah.  Hmm.  Why does it contain a nested typedef for C?  I guess that
makes sense: 14.6p2 gives an example of how you can use C to refer to
C<T> within the definition of C<T>.

In that case, I don't think that the desire of the original test case
(i.e. printing out actual template info) is reasonable: it's not the
job of GDB's test suite to lobby for improvements in debugging
formats.  So I think the proper behavior is to delete the original
success regexps, to decide that, in this situation, GDB shouldn't
print out any information (which is what currently happens with GCC
2.95.3/stabs), to KFAIL the situations where it does print out an
instantiation with reference to a PR about nested classes (I assume we
have such a PR, if not I'll create one), and to close PR 1063 with an
appropriate comment.

How does that sound?

David Carlton
carlton@math.stanford.edu


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch/rfc] gdb.c++/templates.exp, pr gdb/1063
  2003-02-26  1:03       ` David Carlton
@ 2003-02-26 20:27         ` David Carlton
  0 siblings, 0 replies; 9+ messages in thread
From: David Carlton @ 2003-02-26 20:27 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

On 25 Feb 2003 17:02:52 -0800, David Carlton <carlton@math.Stanford.EDU> said:

> So my current plan is to leave the HP regexps (but add a comment), to
> PASS the case where GDB can't print out the type info, to KFAIL the
> case where GDB incorrectly prints out one of the specializations (with
> reference to a nested types PR), and to close PR gdb/1063 (with an
> appropriate comment).

I've committed the patch below; now it PASSes for stabs and KFAIL's
(wrt PR gdb/57) for DWARF-2.

David Carlton
carlton@math.stanford.edu

2003-02-26  David Carlton  <carlton@math.stanford.edu>

	* gdb.c++/templates.exp (do_tests): Convert XFAILs about printing
	template types into either PASSes or KFAILs (corresponding to PR
	c++/57).  Tweak indentation.  Update copyright.

Index: templates.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/templates.exp,v
retrieving revision 1.13
diff -u -p -r1.13 templates.exp
--- templates.exp	13 Feb 2003 21:33:20 -0000	1.13
+++ templates.exp	26 Feb 2003 20:20:27 -0000
@@ -1,4 +1,4 @@
-# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002
+# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -242,17 +242,30 @@ gdb_expect {   
 
 # Template Foo<T>
 
-setup_xfail hppa64-*-* CLLbs16092
-# g++ can't do the template instantiation in debug info trick, so we
-# fail this because it's not a real type.
-if {!$hp_aCC_compiler} { setup_xfail *-*-* }
+# Neither stabs nor DWARF-2 contains type information about templates
+# (as opposed to instantiations of templates), so in those
+# circumstances we expect GDB to not find a symbol.  HP has a debug
+# format that contains more info, though, so it's also correct to
+# print out template info.  (This affects several subsequent tests as
+# well.)
+
+# NOTE: carlton/2003-02-26: However, because of a bug in the way GDB
+# handles nested types, we don't get this right in the DWARF-2 case.
+
 send_gdb "ptype Foo\n"   
 gdb_expect {   
-   -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo<volatile char \\*>\r\n\[ \t\]*(class |)Foo<char>\r\n\[ \t\]*(class |)Foo<int>\r\n$gdb_prompt $" { pass "ptype Foo" }
-   -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Foo" }
-   -re "$gdb_prompt $"                     { fail "ptype Foo" }
-   timeout                             { fail "(timeout) ptype Foo" }
+    -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo<volatile char \\*>\r\n\[ \t\]*(class |)Foo<char>\r\n\[ \t\]*(class |)Foo<int>\r\n$gdb_prompt $" { pass "ptype Foo" }
+    -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Foo" }
+    -re "type = class Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+	kfail "gdb/57" "ptype Foo" }
+    -re "No symbol \"Foo\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+	pass "ptype Foo" }
+    -re "$gdb_prompt $"                     { fail "ptype Foo" }
+    timeout                             { fail "(timeout) ptype Foo" }
 }
+#    -re "type = class Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo(int, int);\r\n\\}\r\n$gdb_prompt $"
 
 # ptype Foo<int>
 
@@ -292,15 +305,19 @@ gdb_expect {   
 
 # Template Bar<T, int>
 
-setup_xfail hppa64-*-* CLLbs16092
 # same as Foo for g++
-if {!$hp_aCC_compiler} { setup_xfail *-*-* }
 send_gdb "ptype Bar\n"   
 gdb_expect {   
-   -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)1>\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)33>\r\n$gdb_prompt $" { pass "ptype Bar" }
-   -re "type = <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Bar" }
-   -re "$gdb_prompt $"                     { fail "ptype Bar" }
-   timeout                             { fail "(timeout) ptype Bar" }
+    -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)1>\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)33>\r\n$gdb_prompt $" { pass "ptype Bar" }
+    -re "type = <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Bar" }
+    -re "ptype Bar\r\ntype = class Bar<int,33> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+	kfail "gdb/57" "ptype Bar" }
+    -re "No symbol \"Bar\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+	pass "ptype Bar" }
+    -re "$gdb_prompt $"                     { fail "ptype Bar" }
+    timeout                             { fail "(timeout) ptype Bar" }
 }
 
 
@@ -324,15 +341,19 @@ gdb_expect {   
 
 # Template Baz<T, char>
 
-setup_xfail hppa64-*-* CLLbs16092
 # Same as Foo, for g++
-if {!$hp_aCC_compiler} { setup_xfail *-*-* }
 send_gdb "ptype Baz\n"   
 gdb_expect {   
-   -re "type = template <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz<char,(\\(char\\)|)97>\r\n\[ \t\]*(class |)Baz<int,(\\(char\\)|)115>\r\n$gdb_prompt $" { pass "ptype Baz" }
-   -re "type = <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Baz" }
-   -re "$gdb_prompt $"                     { fail "ptype Baz" }
-   timeout                             { fail "(timeout) ptype Baz" }
+    -re "type = template <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz<char,(\\(char\\)|)97>\r\n\[ \t\]*(class |)Baz<int,(\\(char\\)|)115>\r\n$gdb_prompt $" { pass "ptype Baz" }
+    -re "type = <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Baz" }
+    -re "type = class Baz<int,'s'> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+	kfail "gdb/57" "ptype Baz" }
+    -re "No symbol \"Baz\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+	pass "ptype Baz" }
+    -re "$gdb_prompt $"                     { fail "ptype Baz" }
+    timeout                             { fail "(timeout) ptype Baz" }
 }
 
 
@@ -356,13 +377,18 @@ gdb_expect {   
 
 # Template Qux<T, int (*f)(int) >
 # Same as Foo for g++
-if {!$hp_aCC_compiler} {setup_xfail *-*-*}
 send_gdb "ptype Qux\n"   
 gdb_expect {   
-   -re "type = template <(class |)T, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux<int,&string>\r\n\[ \t\]*(class |)Qux<char,&string>\r\n$gdb_prompt $" { pass "ptype Qux" }
-   -re ".*type = template <(class |)T.*, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}.*$gdb_prompt $" { pass "ptype Qux" }
-   -re "$gdb_prompt $"                     { fail "ptype Qux" }
-   timeout                             { fail "(timeout) ptype Qux" }
+    -re "type = template <(class |)T, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux<int,&string>\r\n\[ \t\]*(class |)Qux<char,&string>\r\n$gdb_prompt $" { pass "ptype Qux" }
+    -re ".*type = template <(class |)T.*, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}.*$gdb_prompt $" { pass "ptype Qux" }
+    -re "type = class Qux<char,&string> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+	kfail "gdb/57" "ptype Qux" }
+    -re "No symbol \"Qux\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+	pass "ptype Qux" }
+    -re "$gdb_prompt $"                     { fail "ptype Qux" }
+    timeout                             { fail "(timeout) ptype Qux" }
 }
 
 # pt Qux<int,&string>
@@ -387,15 +413,19 @@ gdb_expect {   
 
 # Template Spec<T1, T2>
 
-setup_xfail hppa64-*-* CLLbs16092
 # Same as Foo for g++
-if {!$hp_aCC_compiler} { setup_xfail *-*-* }
 send_gdb "ptype Spec\n"   
 gdb_expect {   
-   -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec<int,int \\*>\r\n\[ \t\]*(class |)Spec<int,char>\r\n$gdb_prompt $" { pass "ptype Spec" }
-   -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Spec" }
-   -re "$gdb_prompt $"                     { fail "ptype Spec" }
-   timeout                             { fail "(timeout) ptype Spec" }
+    -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec<int,int \\*>\r\n\[ \t\]*(class |)Spec<int,char>\r\n$gdb_prompt $" { pass "ptype Spec" }
+    -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Spec" }
+    -re "type = class Spec<int,char> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(char\\);\r\n}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+	kfail "gdb/57" "ptype Spec" }
+    -re "No symbol \"Spec\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+	pass "ptype Spec" }
+    -re "$gdb_prompt $"                     { fail "ptype Spec" }
+    timeout                             { fail "(timeout) ptype Spec" }
 }
 
 # pt Spec<char,0>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch/rfc] gdb.c++/templates.exp, pr gdb/1063
@ 2003-02-26  2:00 Michael Elizabeth Chastain
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Elizabeth Chastain @ 2003-02-26  2:00 UTC (permalink / raw)
  To: carlton, drow; +Cc: gdb-patches

David C writes:

> In that case, I don't think that the desire of the original test case
> (i.e. printing out actual template info) is reasonable: it's not the
> job of GDB's test suite to lobby for improvements in debugging
> formats.

I agree with this philosophy.

> So I think the proper behavior is to delete the original success
> regexps, to decide that, in this situation, GDB shouldn't print out any
> information (which is what currently happens with GCC 2.95.3/stabs), to
> KFAIL the situations where it does print out an instantiation with
> reference to a PR about nested classes (I assume we have such a PR, if
> not I'll create one), and to close PR 1063 with an appropriate comment.

Sounds okay.

I'll throw away your first patch then and chill out for the second one.
Test bed and eyeballs are standing by.  :)

Michael C


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch/rfc] gdb.c++/templates.exp, pr gdb/1063
  2003-02-26  1:15 Michael Elizabeth Chastain
@ 2003-02-26  1:23 ` David Carlton
  0 siblings, 0 replies; 9+ messages in thread
From: David Carlton @ 2003-02-26  1:23 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: drow, gdb-patches

On Tue, 25 Feb 2003 19:15:23 -0600, Michael Elizabeth Chastain <mec@shout.net> said:

> The old style was to use gdb_test as much as possible.  But I actually
> like this new multi-armed gdb_expect style.  Maybe when things calm down
> we can move to Daniel's new gdb_test_multiple, too.

Yeah, totally.  I've been sticking with the old way out of laziness,
justifying my behavior by the fact that I've been modifying existing
tests rather than adding new tests, but certainly we should switch
over to gdb_test_multiple at some point.  I'm just too busy right now
to think about it; once somebody else actually writes a test using it,
then I'll probably adopt it myself, too.

David Carlton
carlton@math.stanford.edu


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch/rfc] gdb.c++/templates.exp, pr gdb/1063
@ 2003-02-26  1:15 Michael Elizabeth Chastain
  2003-02-26  1:23 ` David Carlton
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Elizabeth Chastain @ 2003-02-26  1:15 UTC (permalink / raw)
  To: carlton, drow; +Cc: gdb-patches

David C writes:

> Hmm.  I guess, for now, just leaving the HP regexps in place is
> correct.

That sounds good to me.

I have heard that HP has a new compiler which follows the multi-vendor
standard C++ ABI.  In my dreams, that means that the gcc v3 code will
work with that new compiler.

At some point we'll have to face the HP music.

> So my current plan is to leave the HP regexps (but add a comment), to
> PASS the case where GDB can't print out the type info, to KFAIL the
> case where GDB incorrectly prints out one of the specializations (with
> reference to a nested types PR), and to close PR gdb/1063 (with an
> appropriate comment).  How does that sound?

Again that sounds good to me.

The old style was to use gdb_test as much as possible.  But I actually
like this new multi-armed gdb_expect style.  Maybe when things calm down
we can move to Daniel's new gdb_test_multiple, too.

I'll be reviewing the patch later this evening after I re-do my
HAVE_UINTPTR_T patch.

Michael C


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-02-26 20:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-26  0:35 [patch/rfc] gdb.c++/templates.exp, pr gdb/1063 David Carlton
2003-02-26  0:15 ` Daniel Jacobowitz
2003-02-26  1:35   ` David Carlton
2003-02-26  0:34     ` Daniel Jacobowitz
2003-02-26  1:03       ` David Carlton
2003-02-26 20:27         ` David Carlton
2003-02-26  1:15 Michael Elizabeth Chastain
2003-02-26  1:23 ` David Carlton
2003-02-26  2:00 Michael Elizabeth Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox