From 9e14d72114b8e40e25ac0f99fc9a5e490eba70a8 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Sat, 21 Jun 2003 23:27:53 +0000 Subject: [PATCH] * c-valprint.c (c_value_print): Add VALUE_OFFSET to the address argument of val_print. * cp-valprint.c (cp_print_value): Don't add the offset parameter to the address argument of baseclass_offset or target_read_memory. Do add it to the argument of cp_print_value_fields. --- gdb/ChangeLog | 8 ++++++++ gdb/c-valprint.c | 5 +++-- gdb/cp-valprint.c | 8 +++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6b1da4488c2..f24da7b26e0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2003-06-21 Daniel Jacobowitz + + * c-valprint.c (c_value_print): Add VALUE_OFFSET to the address + argument of val_print. + * cp-valprint.c (cp_print_value): Don't add the offset parameter + to the address argument of baseclass_offset or target_read_memory. + Do add it to the argument of cp_print_value_fields. + 2003-06-21 Andrew Cagney * mips-tdep.c: Include "reggroups.h" and "sim-regno.h". diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 419b24770b6..4ca48a65a62 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -592,7 +592,8 @@ c_value_print (struct value *val, struct ui_file *stream, int format, /* Otherwise, we end up at the return outside this "if" */ } - return val_print (type, VALUE_CONTENTS_ALL (val), VALUE_EMBEDDED_OFFSET (val), - VALUE_ADDRESS (val), + return val_print (type, VALUE_CONTENTS_ALL (val), + VALUE_EMBEDDED_OFFSET (val), + VALUE_ADDRESS (val) + VALUE_OFFSET (val), stream, format, 1, 0, pretty); } diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 60a20934312..a591d1859a5 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -554,7 +554,7 @@ cp_print_value (struct type *type, struct type *real_type, char *valaddr, { boffset = baseclass_offset (type, i, valaddr + offset, - address + offset); + address); skip = ((boffset == -1) || (boffset + offset) < 0) ? 1 : -1; if (BASETYPE_VIA_VIRTUAL (type, i)) @@ -569,9 +569,10 @@ cp_print_value (struct type *type, struct type *real_type, char *valaddr, { /* FIXME (alloca): unsafe if baseclass is really really large. */ base_valaddr = (char *) alloca (TYPE_LENGTH (baseclass)); - if (target_read_memory (address + offset + boffset, base_valaddr, + if (target_read_memory (address + boffset, base_valaddr, TYPE_LENGTH (baseclass)) != 0) skip = 1; + address = address + boffset; thisoffset = 0; boffset = 0; thistype = baseclass; @@ -600,7 +601,8 @@ cp_print_value (struct type *type, struct type *real_type, char *valaddr, fprintf_filtered (stream, ""); else cp_print_value_fields (baseclass, thistype, base_valaddr, - thisoffset + boffset, address, stream, format, + thisoffset + boffset, address + boffset, + stream, format, recurse, pretty, ((struct type **) obstack_base (&dont_print_vb_obstack)), -- 2.30.2