summaryrefslogtreecommitdiff
path: root/gdb/c-valprint.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2011-02-02 17:41:52 +0000
committerPedro Alves <pedro@codesourcery.com>2011-02-02 17:41:52 +0000
commitabece3004d9eee7f8169c8754e1ff6572509780f (patch)
tree05c9b6c9870a8b16f35465b5f2f2a745672ca8ca /gdb/c-valprint.c
parentbe13bb8aedf78660eeeec80ffecc718295da05ee (diff)
downloadgdb-abece3004d9eee7f8169c8754e1ff6572509780f.tar.gz
gdb/
* c-valprint.c (c_value_print): When doing virtual base pointer adjustment, create a new value with adjusted contents rather than changing the contents of the value being printed (and getting it wrong). gdb/testsuite/ * gdb.cp/virtbase.cc (VirtualBase, VirtualMiddleA, VirtualMiddleB) (Virtual): New structs. (virtual_o, virtual_middle_b): New globals. * gdb.cp/virtbase.exp: New tests.
Diffstat (limited to 'gdb/c-valprint.c')
-rw-r--r--gdb/c-valprint.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 3bd4db25650..287dc0ba2a7 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -706,8 +706,7 @@ c_value_print (struct value *val, struct ui_file *stream,
type = lookup_reference_type (real_type);
}
/* JYG: Need to adjust pointer value. */
- /* NOTE: cagney/2005-01-02: THIS IS BOGUS. */
- value_contents_writeable (val)[0] -= top;
+ val = value_from_pointer (type, value_as_address (val) - top);
/* Note: When we look up RTTI entries, we don't get any
information on const or volatile attributes. */