aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/virtbase.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.cp/virtbase.exp')
-rw-r--r--gdb/testsuite/gdb.cp/virtbase.exp15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/virtbase.exp b/gdb/testsuite/gdb.cp/virtbase.exp
index 460c968..4bfec44 100644
--- a/gdb/testsuite/gdb.cp/virtbase.exp
+++ b/gdb/testsuite/gdb.cp/virtbase.exp
@@ -65,3 +65,18 @@ gdb_test "print/x b->mA" " = 0xaaaaaaaa"
# https://bugzilla.redhat.com/show_bug.cgi?id=606660
# `set print object on' is expected.
gdb_test "print rtti_data" " = .*, data = 1\}"
+
+# Printing a pointer into a virtual base of a larger object used to do
+# pointer adjusment directly into the value being printed, in-place
+# (and did it wrong, too). Print the pointer, and then access the
+# value history to check the pointer value is not changed. If it had
+# been changed, then we'd not be able to find the real type anymore.
+gdb_test "print virtual_middle_b" \
+ " = \\(Virtual \\*\\) $hex" \
+ "print pointer to virtual base at non-zero offset of larger object"
+gdb_test "print $" \
+ " = \\(Virtual \\*\\) $hex" \
+ "print same pointer from history value"
+gdb_test "print *$$" \
+ " = \\(Virtual\\) {<VirtualMiddleA> = {<VirtualBase> = {_vptr.VirtualBase = $hex, x = 0}, _vptr.VirtualMiddleA = $hex, y = \\{0 <repeats 300 times>\\}}, <VirtualMiddleB> = {_vptr.VirtualMiddleB = $hex, y = 0}, _vptr.Virtual = $hex, z = 0}" \
+ "print whole pointed-to object, starting from the virtual base pointer"