This is the mail archive of the gdb-patches@sourceware.org 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 1/9] test suite refactoring for coming ptype change


This patch prepares the test suite for the addition of formatting
flags to ptype, by changing cp_test_ptype_class to supply the "ptype"
command itself.

It also adds support for typedefs defined in a class to
cp_test_ptype_class.

Built and regtested on x86-64 F16.

	* gdb.cp/classes.exp (test_ptype_class_objects): Remove
	"ptype" from calls to cp_test_ptype_class.
	(test_enums): Likewise.
	* gdb.cp/derivation.exp: Remove "ptype" from calls to
	cp_test_ptype_class.
	* gdb.cp/inherit.exp (test_ptype_si): Remove "ptype" from
	calls to cp_test_ptype_class.
	(test_ptype_mi, test_ptype_vi, test_ptype_mvi): Likewise.
	* gdb.cp/virtfunc.exp (test_ptype_of_classes): Remove "ptype"
	from calls to cp_test_ptype_class.
	* lib/cp-support.exp (cp_test_ptype_class): Supply "ptype"
	command here.  Change "in_command" argument to "in_exp".
	Handle typedefs in classes.
---
 gdb/testsuite/gdb.cp/classes.exp    |   50 ++++++++++++++--------------
 gdb/testsuite/gdb.cp/derivation.exp |    8 ++--
 gdb/testsuite/gdb.cp/inherit.exp    |   60 +++++++++++++++++-----------------
 gdb/testsuite/gdb.cp/virtfunc.exp   |   62 +++++++++++++++++-----------------
 gdb/testsuite/lib/cp-support.exp    |   38 +++++++++++++++++++--
 5 files changed, 124 insertions(+), 94 deletions(-)

diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp
index 440677b..54f62c5 100644
--- a/gdb/testsuite/gdb.cp/classes.exp
+++ b/gdb/testsuite/gdb.cp/classes.exp
@@ -35,7 +35,7 @@ proc test_ptype_class_objects {} {
     # Simple type.
 
     cp_test_ptype_class \
-	"ptype struct default_public_struct" "" "struct" "default_public_struct" \
+	"struct default_public_struct" "" "struct" "default_public_struct" \
 	{
 	    { field public "int a;" }
 	    { field public "int b;" }
@@ -44,7 +44,7 @@ proc test_ptype_class_objects {} {
     # Another simple type.
 
     cp_test_ptype_class \
-	"ptype struct explicit_public_struct" "" "struct" "explicit_public_struct" \
+	"struct explicit_public_struct" "" "struct" "explicit_public_struct" \
 	{
 	    { field public "int a;" }
 	    { field public "int b;" }
@@ -53,7 +53,7 @@ proc test_ptype_class_objects {} {
     # Another simple type.
 
     cp_test_ptype_class \
-	"ptype struct protected_struct" "" "struct" "protected_struct" \
+	"struct protected_struct" "" "struct" "protected_struct" \
 	{
 	    { field protected "int a;" }
 	    { field protected "int b;" }
@@ -62,7 +62,7 @@ proc test_ptype_class_objects {} {
     # Another simple type.
 
     cp_test_ptype_class \
-	"ptype struct private_struct" "" "struct" "private_struct" \
+	"struct private_struct" "" "struct" "private_struct" \
 	{
 	    { field private "int a;" }
 	    { field private "int b;" }
@@ -71,7 +71,7 @@ proc test_ptype_class_objects {} {
     # A bigger type.
 
     cp_test_ptype_class \
-	"ptype struct mixed_protection_struct" "" "struct" "mixed_protection_struct" \
+	"struct mixed_protection_struct" "" "struct" "mixed_protection_struct" \
 	{
 	    { field public    "int a;" }
 	    { field public    "int b;" }
@@ -88,7 +88,7 @@ proc test_ptype_class_objects {} {
     # gdb does not care about the difference anyways.
 
     cp_test_ptype_class \
-	"ptype class public_class" "" "class" "public_class" \
+	"class public_class" "" "class" "public_class" \
 	{
 	    { field public "int a;" }
 	    { field public "int b;" }
@@ -97,7 +97,7 @@ proc test_ptype_class_objects {} {
     # Another simple type.
 
     cp_test_ptype_class \
-	"ptype class protected_class" "" "class" "protected_class" \
+	"class protected_class" "" "class" "protected_class" \
 	{
 	    { field protected "int a;" }
 	    { field protected "int b;" }
@@ -106,7 +106,7 @@ proc test_ptype_class_objects {} {
     # Another simple type.
 
     cp_test_ptype_class \
-	"ptype class default_private_class" "" "class" "default_private_class" \
+	"class default_private_class" "" "class" "default_private_class" \
 	{
 	    { field private "int a;" }
 	    { field private "int b;" }
@@ -115,7 +115,7 @@ proc test_ptype_class_objects {} {
     # Another simple type.
 
     cp_test_ptype_class \
-	"ptype class explicit_private_class" "" "class" "explicit_private_class" \
+	"class explicit_private_class" "" "class" "explicit_private_class" \
 	{
 	    { field private "int a;" }
 	    { field private "int b;" }
@@ -124,7 +124,7 @@ proc test_ptype_class_objects {} {
     # A bigger type.
 
     cp_test_ptype_class \
-	"ptype class mixed_protection_class" "" "class" "mixed_protection_class" \
+	"class mixed_protection_class" "" "class" "mixed_protection_class" \
 	{
 
 	    { field public    "int a;" }
@@ -143,7 +143,7 @@ proc test_ptype_class_objects {} {
     # Base class.
 
     cp_test_ptype_class \
-	"ptype class A" "" "class" "A" \
+	"class A" "" "class" "A" \
 	{
 	    { field public "int a;" }
 	    { field public "int x;" }
@@ -152,7 +152,7 @@ proc test_ptype_class_objects {} {
     # Derived class.
 
     cp_test_ptype_class \
-	"ptype class B" "" "class" "B" \
+	"class B" "" "class" "B" \
 	{
 	    { base         "public A" }
 	    { field public "int b;" }
@@ -162,7 +162,7 @@ proc test_ptype_class_objects {} {
     # Derived class.
 
     cp_test_ptype_class \
-	"ptype class C" "" "class" "C" \
+	"class C" "" "class" "C" \
 	{
 	    { base         "public A" }
 	    { field public "int c;" }
@@ -172,7 +172,7 @@ proc test_ptype_class_objects {} {
     # Derived class, multiple inheritance.
 
     cp_test_ptype_class \
-	"ptype class D" "" "class" "D" \
+	"class D" "" "class" "D" \
 	{
 	    { base         "public B" }
 	    { base         "public C" }
@@ -183,7 +183,7 @@ proc test_ptype_class_objects {} {
     # Derived class.
 
     cp_test_ptype_class \
-	"ptype class E" "" "class" "E" \
+	"class E" "" "class" "E" \
 	{
 	    { base         "public D" }
 	    { field public "int e;" }
@@ -196,7 +196,7 @@ proc test_ptype_class_objects {} {
     # static methods whose name is the same as their argument mangling.
  
     cp_test_ptype_class \
-	"ptype class Static" "" "class" "Static" \
+	"class Static" "" "class" "Static" \
 	{
 	    { method public "static void ii(int, int);" }
 	}
@@ -206,7 +206,7 @@ proc test_ptype_class_objects {} {
     # A virtual base class.
 
     cp_test_ptype_class \
-	"ptype class vA" "" "class" "vA" \
+	"class vA" "" "class" "vA" \
 	{
 	    { field public "int va;" }
 	    { field public "int vx;" }
@@ -215,7 +215,7 @@ proc test_ptype_class_objects {} {
     # A derived class with a virtual base.
 
     cp_test_ptype_class \
-	"ptype class vB" "" "class" "vB" \
+	"class vB" "" "class" "vB" \
 	{
 	    { base         "public virtual vA" }
 	    { vbase        "vA" }
@@ -226,7 +226,7 @@ proc test_ptype_class_objects {} {
     # Another derived class with a virtual base.
 
     cp_test_ptype_class \
-	"ptype class vC" "" "class" "vC" \
+	"class vC" "" "class" "vC" \
 	{
 	    { base         "public virtual vA" }
 	    { vbase        "vA" }
@@ -237,7 +237,7 @@ proc test_ptype_class_objects {} {
     # A classic diamond class.
 
     cp_test_ptype_class \
-	"ptype class vD" "" "class" "vD" \
+	"class vD" "" "class" "vD" \
 	{
 	    { base         "public virtual vB" }
 	    { base         "public virtual vC" }
@@ -250,7 +250,7 @@ proc test_ptype_class_objects {} {
     # A class derived from a diamond class.
 
     cp_test_ptype_class \
-	"ptype class vE" "" "class" "vE" \
+	"class vE" "" "class" "vE" \
 	{
 	    { base         "public virtual vD" }
 	    { vbase        "vD" }
@@ -263,7 +263,7 @@ proc test_ptype_class_objects {} {
     # A base class.
 
     cp_test_ptype_class \
-	"ptype class Base1" "" "class" "Base1" \
+	"class Base1" "" "class" "Base1" \
 	{
 	    { field  public "int x;" }
 	    { method public "Base1(int);" }
@@ -272,7 +272,7 @@ proc test_ptype_class_objects {} {
     # Another base class.
 
     cp_test_ptype_class \
-	"ptype class Foo" "" "class" "Foo" \
+	"class Foo" "" "class" "Foo" \
 	{
 	    { field public "int x;" }
 	    { field public "int y;" }
@@ -299,7 +299,7 @@ proc test_ptype_class_objects {} {
     # A multiple inheritance derived class.
 
     cp_test_ptype_class \
-	"ptype class Bar" "" "class" "Bar" \
+	"class Bar" "" "class" "Bar" \
 	{
 	    { base          "public Base1" }
 	    { base          "public Foo" }
@@ -445,7 +445,7 @@ proc test_enums {} {
     # stabs, we probably can't get this right; under DWARF-2, we can.
 
     cp_test_ptype_class \
-	"ptype obj_with_enum" "" "class" "ClassWithEnum" \
+	"obj_with_enum" "" "class" "ClassWithEnum" \
 	{
 	    { field public "ClassWithEnum::PrivEnum priv_enum;" }
 	    { field public "int x;" }
diff --git a/gdb/testsuite/gdb.cp/derivation.exp b/gdb/testsuite/gdb.cp/derivation.exp
index b752b52..5012a7a 100644
--- a/gdb/testsuite/gdb.cp/derivation.exp
+++ b/gdb/testsuite/gdb.cp/derivation.exp
@@ -54,7 +54,7 @@ gdb_test "up" ".*main.*" "up from marker1"
 gdb_test "print a_instance" "\\$\[0-9\]+ = \{a = 1, aa = 2\}" "print value of a_instance"
 
 cp_test_ptype_class \
-    "ptype a_instance" "" "class" "A" \
+    "a_instance" "" "class" "A" \
     {
 	{ field  public "int a;" }
 	{ field  public "int aa;" }
@@ -72,7 +72,7 @@ gdb_test_multiple "print d_instance" "print value of d_instance" {
 }
 
 cp_test_ptype_class \
-    "ptype d_instance" "" "class" "D" \
+    "d_instance" "" "class" "D" \
     {
 	{ base          "private A" }
 	{ base          "public B" }
@@ -97,7 +97,7 @@ gdb_test_multiple "print e_instance" "print value of e_instance" {
 }
 
 cp_test_ptype_class \
-    "ptype e_instance" "" "class" "E" \
+    "e_instance" "" "class" "E" \
     {
 	{ base          "public A" }
 	{ base          "private B" }
@@ -122,7 +122,7 @@ gdb_test_multiple "print f_instance" "print value of f_instance" {
 }
 
 cp_test_ptype_class \
-    "ptype f_instance" "" "class" "F" \
+    "f_instance" "" "class" "F" \
     {
 	{ base          "private A" }
 	{ base          "public B" }
diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp
index fc5f2e2..938a2aa 100644
--- a/gdb/testsuite/gdb.cp/inherit.exp
+++ b/gdb/testsuite/gdb.cp/inherit.exp
@@ -41,37 +41,37 @@ proc test_ptype_si { } {
     # A simple class.
 
     cp_test_ptype_class \
-	"ptype A" "ptype A (FIXME)" "class" "A" \
+	"A" "ptype A (FIXME)" "class" "A" \
 	{
 	    { field public "int a;" }
 	    { field public "int x;" }
 	}
-    cp_test_ptype_class "ptype class A" "ptype class A (FIXME)" "class" "A" ibid
-    cp_test_ptype_class "ptype g_A" "ptype g_A (FIXME)" "class" "A" ibid
+    cp_test_ptype_class "class A" "ptype class A (FIXME)" "class" "A" ibid
+    cp_test_ptype_class "g_A" "ptype g_A (FIXME)" "class" "A" ibid
 
     # A derived class.
 
     cp_test_ptype_class \
-	"ptype B" "" "class" "B" \
+	"B" "" "class" "B" \
 	{
 	    { base         "public A" }
 	    { field public "int b;" }
 	    { field public "int x;" }
 	}
-    cp_test_ptype_class "ptype class B" "" "class" "B" ibid
-    cp_test_ptype_class "ptype g_B" "" "class" "B" ibid
+    cp_test_ptype_class "class B" "" "class" "B" ibid
+    cp_test_ptype_class "g_B" "" "class" "B" ibid
 
     # Another derived class.
 
     cp_test_ptype_class \
-	"ptype C" "" "class" "C" \
+	"C" "" "class" "C" \
 	{
 	    { base         "public A" }
 	    { field public "int c;" }
 	    { field public "int x;" }
 	}
-    cp_test_ptype_class "ptype class C" "" "class" "C" ibid
-    cp_test_ptype_class "ptype g_C" "" "class" "C" ibid
+    cp_test_ptype_class "class C" "" "class" "C" ibid
+    cp_test_ptype_class "g_C" "" "class" "C" ibid
 
     # A structure with no tag.
     # TODO: move this mess into a separate file, and re-specify
@@ -146,27 +146,27 @@ proc test_ptype_mi { } {
     # A class with two bases.
 
     cp_test_ptype_class \
-	"ptype D" "" "class" "D" \
+	"D" "" "class" "D" \
 	{
 	    { base         "public B" }
 	    { base         "public C" }
 	    { field public "int d;" }
 	    { field public "int x;" }
 	}
-    cp_test_ptype_class "ptype class D" "" "class" "D" ibid
-    cp_test_ptype_class "ptype g_D" "" "class" "D" ibid
+    cp_test_ptype_class "class D" "" "class" "D" ibid
+    cp_test_ptype_class "g_D" "" "class" "D" ibid
 
     # A class derived from the previous class.
 
     cp_test_ptype_class \
-	"ptype E" "" "class" "E" \
+	"E" "" "class" "E" \
 	{
 	    { base         "public D" }
 	    { field public "int e;" }
 	    { field public "int x;" }
 	}
-    cp_test_ptype_class "ptype class E" "" "class" "E" ibid
-    cp_test_ptype_class "ptype g_E" "" "class" "E" ibid
+    cp_test_ptype_class "class E" "" "class" "E" ibid
+    cp_test_ptype_class "g_E" "" "class" "E" ibid
 }
 
 # Single virtual inheritance, print type definitions.
@@ -176,39 +176,39 @@ proc test_ptype_vi { } {
     # class vA
 
     cp_test_ptype_class \
-	"ptype vA" "" "class" "vA" \
+	"vA" "" "class" "vA" \
 	{
 	    { field public "int va;" }
 	    { field public "int vx;" }
 	}
-    cp_test_ptype_class "ptype class vA" "" "class" "vA" ibid
-    cp_test_ptype_class "ptype g_vA" "" "class" "vA" ibid
+    cp_test_ptype_class "class vA" "" "class" "vA" ibid
+    cp_test_ptype_class "g_vA" "" "class" "vA" ibid
 
     # class vB
 
     cp_test_ptype_class \
-	"ptype vB" "" "class" "vB" \
+	"vB" "" "class" "vB" \
 	{
 	    { base         "public virtual vA" }
 	    { vbase        "vA" }
 	    { field public "int vb;" }
 	    { field public "int vx;" }
 	}
-    cp_test_ptype_class "ptype class vB" "" "class" "vB" ibid
-    cp_test_ptype_class "ptype g_vB" "" "class" "vB" ibid
+    cp_test_ptype_class "class vB" "" "class" "vB" ibid
+    cp_test_ptype_class "g_vB" "" "class" "vB" ibid
 
     # class vC
 
     cp_test_ptype_class \
-	"ptype vC" "" "class" "vC" \
+	"vC" "" "class" "vC" \
 	{
 	    { base         "public virtual vA" }
 	    { vbase        "vA" }
 	    { field public "int vc;" }
 	    { field public "int vx;" }
 	}
-    cp_test_ptype_class "ptype class vC" "" "class" "vC" ibid
-    cp_test_ptype_class "ptype g_vC" "" "class" "vC" ibid
+    cp_test_ptype_class "class vC" "" "class" "vC" ibid
+    cp_test_ptype_class "g_vC" "" "class" "vC" ibid
 
 }
 
@@ -219,7 +219,7 @@ proc test_ptype_mvi { } {
     # class vD
 
     cp_test_ptype_class \
-	"ptype vD" "" "class" "vD" \
+	"vD" "" "class" "vD" \
 	{
 	    { base         "public virtual vB" }
 	    { base         "public virtual vC" }
@@ -228,21 +228,21 @@ proc test_ptype_mvi { } {
 	    { field public "int vd;" }
 	    { field public "int vx;" }
 	}
-    cp_test_ptype_class "ptype class vD" "" "class" "vD" ibid
-    cp_test_ptype_class "ptype g_vD" "" "class" "vD" ibid
+    cp_test_ptype_class "class vD" "" "class" "vD" ibid
+    cp_test_ptype_class "g_vD" "" "class" "vD" ibid
 
     # class vE
 
     cp_test_ptype_class \
-	"ptype vE" "" "class" "vE" \
+	"vE" "" "class" "vE" \
 	{
 	    { base         "public virtual vD" }
 	    { vbase        "vD" }
 	    { field public "int ve;" }
 	    { field public "int vx;" }
 	}
-    cp_test_ptype_class "ptype class vE" "" "class" "vE" ibid
-    cp_test_ptype_class "ptype g_vE" "" "class" "vE" ibid
+    cp_test_ptype_class "class vE" "" "class" "vE" ibid
+    cp_test_ptype_class "g_vE" "" "class" "vE" ibid
 
 }
 
diff --git a/gdb/testsuite/gdb.cp/virtfunc.exp b/gdb/testsuite/gdb.cp/virtfunc.exp
index 4621a74..efc46b5 100644
--- a/gdb/testsuite/gdb.cp/virtfunc.exp
+++ b/gdb/testsuite/gdb.cp/virtfunc.exp
@@ -34,7 +34,7 @@ proc test_ptype_of_classes {} {
     # class VA
 
     cp_test_ptype_class \
-	"ptype VA" "" "class" "VA" \
+	"VA" "" "class" "VA" \
 	{
 	    { field public "int va;" }
 	}
@@ -42,7 +42,7 @@ proc test_ptype_of_classes {} {
     # class VB
 
     cp_test_ptype_class \
-	"ptype VB" "" "class" "VB" \
+	"VB" "" "class" "VB" \
 	{
 	    { field  public "int vb;" }
 	    { method public "int fvb();" }
@@ -52,7 +52,7 @@ proc test_ptype_of_classes {} {
     # class V
 
     cp_test_ptype_class \
-	"ptype V" "" "class" "V" \
+	"V" "" "class" "V" \
 	{
 	    { base          "public VA" }
 	    { base          "public VB" }
@@ -64,7 +64,7 @@ proc test_ptype_of_classes {} {
     # class A
 
     cp_test_ptype_class \
-	"ptype A" "" "class" "A" \
+	"A" "" "class" "A" \
 	{
 	    { base           "public virtual V" }
 	    { vbase          "V" }
@@ -75,7 +75,7 @@ proc test_ptype_of_classes {} {
     # class B
 
     cp_test_ptype_class \
-	"ptype B" "" "class" "B" \
+	"B" "" "class" "B" \
 	{
 	    { base           "public A" }
 	    { field  private "int b;" }
@@ -85,7 +85,7 @@ proc test_ptype_of_classes {} {
     # class C
 
     cp_test_ptype_class \
-	"ptype C" "" "class" "C" \
+	"C" "" "class" "C" \
 	{
 	    { base         "public virtual V" }
 	    { vbase        "V" }
@@ -95,7 +95,7 @@ proc test_ptype_of_classes {} {
     # class AD
 
     cp_test_ptype_class \
-	"ptype AD" "" "class" "AD" \
+	"AD" "" "class" "AD" \
 	{
 	    { method public "virtual int vg();" }
 	}
@@ -103,7 +103,7 @@ proc test_ptype_of_classes {} {
     # class D
 
     cp_test_ptype_class \
-	"ptype D" "" "class" "D" \
+	"D" "" "class" "D" \
 	{
 	    { base          "public AD" }
 	    { base          "public virtual V" }
@@ -118,7 +118,7 @@ proc test_ptype_of_classes {} {
     # class E
 
     cp_test_ptype_class \
-	"ptype E" "" "class" "E" \
+	"E" "" "class" "E" \
 	{
 	    { base          "public B" }
 	    { base          "public virtual V" }
@@ -133,41 +133,41 @@ proc test_ptype_of_classes {} {
 
     # An instance of D
 
-    cp_test_ptype_class "ptype dd" "" "class" "D" ibid
+    cp_test_ptype_class "dd" "" "class" "D" ibid
 
     # An instance of D *
 
-    cp_test_ptype_class "ptype ppd" "" "class" "D" ibid "*"
+    cp_test_ptype_class "ppd" "" "class" "D" ibid "*"
 
     # An instance of AD *
     # TODO: this should be named pADd, not pAd.
 
-    cp_test_ptype_class "ptype pAd" "" "class" "AD" ibid "*"
+    cp_test_ptype_class "pAd" "" "class" "AD" ibid "*"
 
     # Instances of these classes.
 
-    cp_test_ptype_class "ptype a" "" "class" "A" ibid
-    cp_test_ptype_class "ptype b" "" "class" "B" ibid
-    cp_test_ptype_class "ptype c" "" "class" "C" ibid
-    cp_test_ptype_class "ptype d" "" "class" "D" ibid
-    cp_test_ptype_class "ptype e" "" "class" "E" ibid
-    cp_test_ptype_class "ptype v" "" "class" "V" ibid
-    cp_test_ptype_class "ptype vb" "" "class" "VB" ibid
+    cp_test_ptype_class "a" "" "class" "A" ibid
+    cp_test_ptype_class "b" "" "class" "B" ibid
+    cp_test_ptype_class "c" "" "class" "C" ibid
+    cp_test_ptype_class "d" "" "class" "D" ibid
+    cp_test_ptype_class "e" "" "class" "E" ibid
+    cp_test_ptype_class "v" "" "class" "V" ibid
+    cp_test_ptype_class "vb" "" "class" "VB" ibid
 
     # Instances of pointers to these classes.
 
-    cp_test_ptype_class "ptype pAa" "" "class" "A" ibid "*"
-    cp_test_ptype_class "ptype pAe" "" "class" "A" ibid "*"
-    cp_test_ptype_class "ptype pBe" "" "class" "B" ibid "*"
-    cp_test_ptype_class "ptype pDd" "" "class" "D" ibid "*"
-    cp_test_ptype_class "ptype pDe" "" "class" "D" ibid "*"
-    cp_test_ptype_class "ptype pVa" "" "class" "V" ibid "*"
-    cp_test_ptype_class "ptype pVv" "" "class" "V" ibid "*"
-    cp_test_ptype_class "ptype pVe" "" "class" "V" ibid "*"
-    cp_test_ptype_class "ptype pVd" "" "class" "V" ibid "*"
-    cp_test_ptype_class "ptype pADe" "" "class" "AD" ibid "*"
-    cp_test_ptype_class "ptype pEe" "" "class" "E" ibid "*"
-    cp_test_ptype_class "ptype pVB" "" "class" "VB" ibid "*"
+    cp_test_ptype_class "pAa" "" "class" "A" ibid "*"
+    cp_test_ptype_class "pAe" "" "class" "A" ibid "*"
+    cp_test_ptype_class "pBe" "" "class" "B" ibid "*"
+    cp_test_ptype_class "pDd" "" "class" "D" ibid "*"
+    cp_test_ptype_class "pDe" "" "class" "D" ibid "*"
+    cp_test_ptype_class "pVa" "" "class" "V" ibid "*"
+    cp_test_ptype_class "pVv" "" "class" "V" ibid "*"
+    cp_test_ptype_class "pVe" "" "class" "V" ibid "*"
+    cp_test_ptype_class "pVd" "" "class" "V" ibid "*"
+    cp_test_ptype_class "pADe" "" "class" "AD" ibid "*"
+    cp_test_ptype_class "pEe" "" "class" "E" ibid "*"
+    cp_test_ptype_class "pVB" "" "class" "VB" ibid "*"
 
 }
 
diff --git a/gdb/testsuite/lib/cp-support.exp b/gdb/testsuite/lib/cp-support.exp
index 8829f97..b984f4d 100644
--- a/gdb/testsuite/lib/cp-support.exp
+++ b/gdb/testsuite/lib/cp-support.exp
@@ -45,9 +45,10 @@ proc cp_check_errata { expected_string actual_string errata_table } {
 # each line, matching it to the class description given in the
 # parameters.
 #
-# IN_COMMAND and IN_TESTNAME are the command and testname for
+# IN_EXP is the expression to use; the appropriate "ptype" invocation
+# is prepended to it.  IN_TESTNAME is the testname for
 # gdb_test_multiple.  If IN_TESTNAME is the empty string, then it
-# defaults to IN_COMMAND.
+# defaults to "ptype IN_EXP".
 #
 # IN_KEY is "class" or "struct".  For now, I ignore it, and allow either
 # "class" or "struct" in the output, as long as the access specifiers all
@@ -81,6 +82,12 @@ proc cp_check_errata { expected_string actual_string errata_table } {
 #      the class has a member function with the given access type
 #      and the given declaration.
 #
+#   { typedef "access" "declaration" }
+#
+#      the class has a member typedef with the given access type
+#      and the given declaration.  The leading "typedef" is supplied
+#      by this proc and should not be in DECLARATION.
+#
 # If you test the same class declaration more than once, you can specify
 # IN_CLASS_TABLE as "ibid".  "ibid" means: look for a previous class
 # table that had the same IN_KEY and IN_TAG, and re-use that table.
@@ -172,13 +179,15 @@ proc cp_check_errata { expected_string actual_string errata_table } {
 #
 # -- chastain 2004-08-07
 
-proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table { in_tail "" } { in_errata_table { } } } {
+proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table { in_tail "" } { in_errata_table { } } } {
     global gdb_prompt
     set wsopt "\[\r\n\t \]*"
 
     # The test name defaults to the command.
 
-    if { "$in_testname" == "" } then { set in_testname "$in_command" }
+    if { "$in_testname" == "" } then { set in_testname "ptype $in_exp" }
+
+    set in_command "ptype $in_exp"
 
     # Save class tables in a history array for reuse.
 
@@ -199,6 +208,7 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table {
     set list_vbases  { }
     set list_fields  { }
     set list_methods { }
+    set list_typedefs { }
 
     foreach class_line $in_class_table {
 	switch [lindex $class_line 0] {
@@ -206,6 +216,7 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table {
 	    "vbase"  { lappend list_vbases  [lindex $class_line 1] }
 	    "field"  { lappend list_fields  [lrange $class_line 1 2] }
 	    "method" { lappend list_methods [lrange $class_line 1 2] }
+	    "typedef" { lappend list_typedefs [lrange $class_line 1 2] }
 	    default  { fail "$in_testname // bad line in class table: $class_line"; return; }
 	}
     }
@@ -422,6 +433,25 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table {
 	}
 	if { $synth_match } then { continue }
 
+	# Typedefs.
+
+	if { [llength $list_typedefs] > 0 } then {
+	    set typedef_access [lindex [lindex $list_typedefs 0] 0]
+	    set typedef_decl [lindex [lindex $list_typedefs 0] 1]
+	    if { "$actual_line" == "typedef $typedef_decl" } then {
+		if { "$access" != "$typedef_access" } then {
+		    cp_check_errata "$typedef_access" "$access" $in_errata_table
+		    fail "$in_testname // wrong access specifier for typedef: $access"
+		    return
+		}
+		set list_typedefs [lreplace $list_typedefs 0 0]
+		continue
+	    }
+
+	    fail "$in_testname // unrecognized line type 3: $actual_line"
+	    return
+	}
+
 	# Unrecognized line.
 
 	if { [llength $list_methods] > 0 } then {
-- 
1.7.7.6


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