aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2012-10-15 22:32:50 +0000
committerKeith Seitz <keiths@redhat.com>2012-10-15 22:32:50 +0000
commit345f514a9388b68188a5e3dcc28cbdb6e6a70b04 (patch)
treea6b72eaa7439a207c0554e4a44b6b4dc08a8816e /gdb/testsuite
parent07540c156d053380cda0aca5b137a7f5ef0e0e24 (diff)
downloadgdb-345f514a9388b68188a5e3dcc28cbdb6e6a70b04.zip
gdb-345f514a9388b68188a5e3dcc28cbdb6e6a70b04.tar.gz
gdb-345f514a9388b68188a5e3dcc28cbdb6e6a70b04.tar.bz2
* lib/cp-support.exp (cp_test_ptype_class): Add support
for class typedefs. * gdb.cp/derivation.exp: Add tests for g_instance.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.cp/derivation.exp16
-rw-r--r--gdb/testsuite/lib/cp-support.exp28
3 files changed, 51 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index db61c62..7203ad2 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2012-10-15 Keith Seitz <keiths@redhat.com>
+
+ * lib/cp-support.exp (cp_test_ptype_class): Add support
+ for class typedefs.
+
+ * gdb.cp/derivation.exp: Add tests for g_instance.
+
2012-10-15 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix entry values resolving in inlined frames.
diff --git a/gdb/testsuite/gdb.cp/derivation.exp b/gdb/testsuite/gdb.cp/derivation.exp
index a4210d9..f4b4888 100644
--- a/gdb/testsuite/gdb.cp/derivation.exp
+++ b/gdb/testsuite/gdb.cp/derivation.exp
@@ -134,6 +134,22 @@ cp_test_ptype_class \
{ method public "int foo();" }
}
+# class G
+cp_test_ptype_class \
+ "ptype g_instance" "" "class" "G" \
+ {
+ { base "private A" }
+ { base "public B" }
+ { base "protected C" }
+ { field public "int g;" }
+ { field public "int gg;" }
+ { field public "int a;" }
+ { field public "int b;" }
+ { field public "int c;" }
+ { method public "int gfoo();" }
+ { method public "int foo();" }
+ }
+
# Print individual fields.
gdb_test "print d_instance.a" "\\$\[0-9\]+ = 1" "print value of d_instance.a"
diff --git a/gdb/testsuite/lib/cp-support.exp b/gdb/testsuite/lib/cp-support.exp
index 8829f97..467a25e 100644
--- a/gdb/testsuite/lib/cp-support.exp
+++ b/gdb/testsuite/lib/cp-support.exp
@@ -81,6 +81,11 @@ 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 typedef with the given access type and the
+# given 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.
@@ -199,6 +204,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 +212,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; }
}
}
@@ -381,6 +388,22 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table {
}
}
+ # Typedef
+
+ if {[llength $list_typedefs] > 0} {
+ set typedef_access [lindex [lindex $list_typedefs 0] 0]
+ set typedef_decl [lindex [lindex $list_typedefs 0] 1]
+ if {[string equal $actual_line $typedef_decl]} {
+ if {![string equal $access $typedef_access]} {
+ 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
+ }
+ }
+
# Synthetic operators. These are optional and can be mixed in
# with the methods in any order, but duplicates are wrong.
#
@@ -452,6 +475,11 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table {
return
}
+ if {[llength $list_typedefs] > 0} {
+ fail "$in_testname // missing typedefs"
+ return
+ }
+
# Check the tail.
set actual_tail [string trim $actual_tail]