* 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".
This commit is contained in:
Tom Tromey 2012-11-12 17:08:09 +00:00
parent 8f5846c8af
commit b3720c3afd
6 changed files with 113 additions and 95 deletions

View File

@ -1,3 +1,18 @@
2012-11-12 Tom Tromey <tromey@redhat.com>
* 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".
2012-11-10 Keith Seitz <keiths@redhat.com>
PR gdb/14288

View File

@ -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;" }

View File

@ -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" }
@ -136,7 +136,7 @@ cp_test_ptype_class \
# class G
cp_test_ptype_class \
"ptype g_instance" "" "class" "G" \
"g_instance" "" "class" "G" \
{
{ base "private A" }
{ base "public B" }

View File

@ -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
}

View File

@ -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 "*"
}

View File

@ -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
@ -177,13 +178,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.