aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.trace/unavailable.cc7
-rw-r--r--gdb/testsuite/gdb.trace/unavailable.exp12
3 files changed, 26 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a9a19c9..d2b877b 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,13 @@
2011-02-14 Pedro Alves <pedro@codesourcery.com>
+ * gdb.trace/unavailable.cc (struct Virtual): New.
+ (virtualp): New global pointer.
+ * gdb.trace/unavailable.exp (gdb_collect_globals_test): Test
+ printing a pointer to an object whose type has a vtable, with
+ print object on.
+
+2011-02-14 Pedro Alves <pedro@codesourcery.com>
+
* gdb.trace/unavailable.exp (gdb_collect_globals_test): Test that
value repeat handles unavailableness.
diff --git a/gdb/testsuite/gdb.trace/unavailable.cc b/gdb/testsuite/gdb.trace/unavailable.cc
index d25837d..718e0f7 100644
--- a/gdb/testsuite/gdb.trace/unavailable.cc
+++ b/gdb/testsuite/gdb.trace/unavailable.cc
@@ -114,6 +114,13 @@ struct StructA StructB::static_struct_a;
StructRef g_structref(0x12345678);
StructRef *g_structref_p = &g_structref;
+struct Virtual {
+ int z;
+
+ virtual ~Virtual() {}
+};
+
+Virtual *virtualp;
/* Test functions. */
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 18e1043..aa87cfb 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -103,7 +103,7 @@ proc gdb_collect_globals_test { } {
"collect g_string_partial\[1\]" "^$" \
"collect g_string_partial\[2\]" "^$" \
\
- "collect g_structref_p" "^$" \
+ "collect g_structref_p" "^$"
# Begin the test.
run_trace_experiment globals_test_func
@@ -242,6 +242,16 @@ proc gdb_collect_globals_test { } {
gdb_test "print g_smallstruct_b" " = \\{<small_struct> = \\{member = <unavailable>\\}, <No data fields>\\}"
gdb_test "print (small_struct) \$" " = \\{member = <unavailable>\\}"
+ gdb_test_no_output "set print object on"
+
+ # With print object on, printing a pointer may need to fetch the
+ # pointed-to object, to check its run-time type. Make sure that
+ # fails gracefully and transparently when the pointer itself is
+ # unavailable.
+ gdb_test "print virtualp" " = \\(Virtual \\*\\) <unavailable>"
+
+ gdb_test_no_output "set print object off"
+
gdb_test "tfind none" \
"#0 end .*" \
"cease trace debugging"