This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] fix spurious FAIL in templates.exp


When I created the test "print Foo<volatile char*>::foo" in
gdb.c++/templates.exp (mimicking the same test with a space between
"char" and "*"), it turned out to FAIL under DWARF-2, for reasons that
weren't clear to me at the time.  I've investigated further, and it's
a testsuite bug: the output contains

  volatile char *(Foo<volatile char*> * const, int, volatile char *)

and the testsuite doesn't expect the ' const' there.  But it's
perfectly reasonable for that to occur there: the first argument is an
artificial parameter that corresponds to 'this', and you're not
allowed to set 'this' to refer to something else.  (Note: the 'const'
means that you can't modify the pointer itself, not the object pointed
to by the pointer.)

So this patch modifies that test and its twin to accept an optional
const there.  With this patch in place, the test PASSes under
GCC3.1/DWARF-2 and its twin still PASSes under GCC2.95.3/stabs.  (And
both of them PASS in both situations once you've patched GDB to fix PR
gdb/33; I'll send out a patch for that shortly.)

I'm planning to commit this tomorrow.  Only 5 templates.exp FAILs left
to analyze...

David Carlton
carlton at math dot stanford dot edu

2003-02-27  David Carlton  <carlton at math dot stanford dot edu>

	* gdb.c++/templates.exp (do_tests): Allow const in the two
	Foo<volatile char *>::foo tests.

Index: templates.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/templates.exp,v
retrieving revision 1.15
diff -u -p -r1.15 templates.exp
--- templates.exp	26 Feb 2003 20:30:05 -0000	1.15
+++ templates.exp	27 Feb 2003 21:27:30 -0000
@@ -301,7 +301,7 @@ gdb_expect {   
 
 send_gdb "print Foo<volatile char *>::foo\n"   
 gdb_expect {   
-    -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<volatile char ?\\*> \\*, int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char *>::foo" }
+    -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<volatile char ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char *>::foo" }
     -re "No symbol \"Foo<volatile char \\*>\" in current context.\r\n$gdb_prompt $"
     { kfail "gdb/33" "print Foo<volatile char *>::foo" }
     -re "$gdb_prompt $"                     { fail "print Foo<volatile char *>::foo" }
@@ -310,7 +310,7 @@ gdb_expect {   
 
 send_gdb "print Foo<volatile char*>::foo\n"   
 gdb_expect {   
-    -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<volatile char ?\\*> \\*, int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char*>::foo" }
+    -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<volatile char ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char*>::foo" }
     -re "No symbol \"Foo<volatile char\\*>\" in current context.\r\n$gdb_prompt $"
     { kfail "gdb/33" "print Foo<volatile char*>::foo" }
     -re "$gdb_prompt $"                     { fail "print Foo<volatile char*>::foo" }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]