This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bokenness of nested pretty printers


>>>>> "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);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]