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/testsuite] gdb.c++/classes.exp: add another ptype pattern


This patch adds a pattern to a ptype test in classes.exp.

Here is the story.  The class is:

  class ClassWithEnum {
  public:
    enum PrivEnum { red, green, blue, yellow = 42 };
    PrivEnum priv_enum;
    int x;
  };

The ptype output depends on the compiler version and the debugging
format.  Here are all ten of them:

  # gcc 2.95.3         -gdwarf-2
  # gcc 3.2.3          -gdwarf-2
  # gcc 3.3            -gdwarf-2
  # gcc gcc-3_3-branch -gdwarf-2

    ptype obj_with_enum
    type = class ClassWithEnum {
      public:
	PrivEnum priv_enum;
	int x;
    }
    (gdb) KFAIL: gdb.c++/classes.exp: ptype obj_with_enum (PRMS: gdb/57)

  # gdb HEAD -gdwarf-2

    ptype obj_with_enum
    No symbol "obj_with_enum" in current context.
    (gdb) FAIL: gdb.c++/classes.exp: ptype obj_with_enum

  # gcc 2.95.3 -gstabs+
  # gcc 3.2.3  -gstabs+

    ptype obj_with_enum
    type = class ClassWithEnum {
      public:
	PrivEnum priv_enum;
	int x;
    
	ClassWithEnum & operator=(ClassWithEnum const &);
	ClassWithEnum(ClassWithEnum const &);
	ClassWithEnum(void);
    }
    (gdb) KFAIL: gdb.c++/classes.exp: ptype obj_with_enum (PRMS: gdb/57)

  # gcc 3.3            -gstabs+
  # gcc gcc-3_3-branch -gstabs+
  # gcc HEAD           -gstabs+

    ptype obj_with_enum
    type = class ClassWithEnum {
      public:
	ClassWithEnum::PrivEnum priv_enum;
	int x;
    
	ClassWithEnum & operator=(ClassWithEnum const&);
	ClassWithEnum(ClassWithEnum const&);
	ClassWithEnum();
    }
    (gdb) FAIL: gdb.c++/classes.exp: ptype obj_with_enum

Grubbing through all these configurations fatigues the brain!

So ... the configurations with KFAIL are cool.  David C left a comment
in the test script indicating that naked 'PrivEnum' is a symptomm of a
gdb bug.

The configuration gcc HEAD -gdwarf-2 points to a real bug which needs
investigation.

My concern is gcc 3.3 -gstabs+.  gdb is printing the right output, but
there is no arm in the test case for it, so it FAILed.  This patch adds
an arm so that this output will now PASS.

Testing: tested on HEAD with all the compilers and debug formats shown,
native i686-pc-linux-gnu.

I will apply this tomorrow to HEAD if nobody has an objection, and
backport it to gdb_6_0-branch some time after that.

(This is item #2 on my three item list to fix all the places where
gcc 3.3 has regressions versus gcc 3.2.3).

Michael C

2003-07-02  Michael Chastain  <mec@shout.net>

	* gdb.c++/classes.exp (test_enums): Accept ptype output that
	shows compiler-generated functions.

Index: classes.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/classes.exp,v
retrieving revision 1.17
diff -u -r1.17 classes.exp
--- classes.exp	3 Mar 2003 18:48:31 -0000	1.17
+++ classes.exp	2 Jul 2003 15:20:43 -0000
@@ -659,7 +659,12 @@
     # ptype on the object
     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 |)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 |)ClassWithEnum::PrivEnum priv_enum;\r\n\[ \t\]*int x;\[\r\n\]+\[ \t\]*ClassWithEnum *& *operator *=\\(ClassWithEnum const *&\\);\r\n\[ \t\]*ClassWithEnum\\(ClassWithEnum const *&\\);\r\n\[ \t\]*ClassWithEnum\\( *\\);\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


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