This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: bokenness of nested pretty printers
- From: Tom Tromey <tromey at redhat dot com>
- To: ppluzhnikov at google dot com (Paul Pluzhnikov)
- Cc: archer at sourceware dot org
- Date: Thu, 16 Oct 2008 13:13:57 -0600
- Subject: Re: bokenness of nested pretty printers
- References: <20081016184635.E2BF03A6AF6@localhost>
- Reply-to: Tom Tromey <tromey at redhat dot com>
>>>>> "Paul" == Paul Pluzhnikov <ppluzhnikov@google.com> writes:
Paul> I think fixing this requires either that we pass down 'value' itself,
Paul> or at least 'value->offset'.
Thanks. Nice analysis.
Paul> Comments?
I notice c-valprint.c does:
return val_print (type, value_contents_all (val),
value_embedded_offset (val),
VALUE_ADDRESS (val) + value_offset (val),
That last line seems to indicate the answer.
Strangely, many calls to val_print do not do this.
I wonder why VALUE_ADDRESS does not do this addition itself.
The appended fixes this particular instance of the problem for me.
Of course, we'd have to audit all the calls to make sure the problem
is fully fixed.
What do you think of this approach?
Tom
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 3aa6d49..805f0e3 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -314,7 +314,8 @@ common_val_print (struct value *val, struct ui_file *stream, int format,
return 0;
return val_print (value_type (val), value_contents_all (val),
- value_embedded_offset (val), VALUE_ADDRESS (val),
+ value_embedded_offset (val),
+ VALUE_ADDRESS (val) + value_offset (val),
stream, format, deref_ref, recurse, pretty,
language);
}