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/rfc] convert enum XFAILs in gdb.c++/classes.exp to KFAILs


This patch deals with the remaining XFAILs that I see in
gdb.c++/classes.exp.  They deal with a class ClassWithEnum that has a
nested type PrivEnum, which we of course don't handle currently.

The first XFAIL comes when you do 'ptype obj_with_enum'.  You get
output starting with this:

type = class ClassWithEnum {
  public:
    PrivEnum priv_enum;

The test suite expects ClassWithEnum::PrivEnum instead of just
PrivEnum.  Now, in some sense, this is correct: in fact, that's
exactly how the source code declares the priv_enum member!  But we get
this right for the wrong reason: rather than knowing that PrivEnum's
full name is ClassWithEnum::PrivEnum but that we don't have to print
ClassWithEnum because we're already within ClassWithEnum, GDB is
simply blithely unaware that PrivEnum's full name is
ClassWithEnum::PrivEnum.

So one could make an argument for either PASSing this or KFAILing
this.  It seems to me that KFAIL is appropriate here: there really is
a GDB bug going on, and I don't want to use PASS for situations where
we get it right for the wrong reason.

The other XFAIL is on the test that does

  print (ClassWithEnum::PrivEnum) 42

This, we fail because of a parse error: GDB doesn't understand
expressions like that inside of casts.  But even if GDB parsed it
correctly, it would still fail because of the nested types issue.  So
what I've done is KFAIL the test with respect to PR 826 (about
parsing), and to add a test as follows:

  print ('ClassWithEnum::PrivEnum') 42

to get past the parser, and then to KFAIL _that_ test with respect to
PR 57 (which is what I'm using for nested types bugs).

Here's a patch; I've tested it with GCC3.1/DWARF2 and
GCC2.95.3/stabs.  I'm planning to commit it on Monday unless somebody
disagrees with me about that first KFAIL (or about something else!).

David Carlton
carlton at math dot stanford dot edu

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

	* gdb.c++/classes.exp (test_enums): KFAIL "ptype obj_with_enum"
	with respect to PR c++/57.
	KFAIL "print (ClassWithEnum::PrivEnum) 42" with respect to PR
	c++/826.
	Create "print ('ClassWithEnum::PrivEnum') 42"; KFAIL it with
	respect to PR c++/57.

Index: classes.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/classes.exp,v
retrieving revision 1.16
diff -u -p -r1.16 classes.exp
--- classes.exp	28 Feb 2003 17:59:18 -0000	1.16
+++ classes.exp	28 Feb 2003 19:58:47 -0000
@@ -657,22 +657,44 @@ proc test_enums {} {
     }
 
     # ptype on the object
-    # g++ is putting out the wrong debug info.  This works with aCC
-    if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
     send_gdb "ptype obj_with_enum\n"
     gdb_expect {
 	-re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*(enum |)ClassWithEnum::PrivEnum priv_enum;\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { pass "ptype obj_with_enum" }
+	-re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*(enum |)PrivEnum priv_enum;\r\n\[ \t\]*int x;.*\\}\r\n$gdb_prompt $"
+	{
+	    # NOTE: carlton/2003-02-28: One could certainly argue that
+	    # this output is acceptable: PrivEnum is a member of
+	    # ClassWithEnum, so there's no need to explicitly qualify
+	    # its name with "ClassWithEnum::".  The truth, though, is
+	    # that GDB is simply forgetting that PrivEnum is a member
+	    # of ClassWithEnum, so we do that output for a bad reason
+	    # instead of a good reason.  Under stabs, we probably
+	    # can't get this right; under DWARF-2, we can.
+	    kfail "gdb/57" "ptype obj_with_enum"
+	}
 	-re "$gdb_prompt $"                     { fail "ptype obj_with_enum" }
 	timeout                             { fail "(timeout) ptype obj_with_enum" }
     }
 
-    # g++ is putting out the wrong debug info.  This works with aCC
-    if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
+    # We'll do this test twice, because of a parser bug: see
+    # PR gdb/826.
+
     send_gdb "print (ClassWithEnum::PrivEnum) 42\n"
     gdb_expect {
 	-re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print (ClassWithEnum::PrivEnum) 42" }
+	-re "A parse error in expression, near `42'.\r\n$gdb_prompt $"
+	{ kfail "gdb/826" "print (ClassWithEnum::PrivEnum) 42" }
 	-re "$gdb_prompt $"                     { fail "print (ClassWithEnum::PrivEnum) 42" }
 	timeout                             { fail "(timeout) print (ClassWithEnum::PrivEnum) 42" }
+    }
+
+    send_gdb "print ('ClassWithEnum::PrivEnum') 42\n"
+    gdb_expect {
+	-re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print ('ClassWithEnum::PrivEnum') 42" }
+	-re "No symbol \"ClassWithEnum::PrivEnum\" in current context.\r\n$gdb_prompt $"
+	{ kfail "gdb/57" "print ('ClassWithEnum::PrivEnum') 42" }
+	-re "$gdb_prompt $"                     { fail "print ('ClassWithEnum::PrivEnum') 42" }
+	timeout                             { fail "(timeout) print ('ClassWithEnum::PrivEnum') 42" }
     }
 }
 


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