Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: fix address in call to val_print
@ 2008-11-21 16:22 Tom Tromey
  2008-11-22 18:16 ` Joel Brobecker
  0 siblings, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2008-11-21 16:22 UTC (permalink / raw)
  To: gdb-patches

This has been on the Python branch for a while.  Paul wrote it, but
since I ran into it today while doing a merge, I decided to submit it.

val_print_array_elements passes 0 as the address to val_print.
However, this is not correct, and will cause problems if val_print
ever uses this value.

I don't have a test case for this against the trunk.  I would still
like to check it in, as I think it is fairly obviously correct.

Built and regtested on x86-64 (compile farm).
Ok?

Tom

2008-11-20  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* valprint.c (val_print_array_elements): Pass correct
	element address to val_print.

diff --git a/gdb/valprint.c b/gdb/valprint.c
index 5086a70..6bcb2f8 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1112,8 +1112,8 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr,
 
       if (reps > options->repeat_count_threshold)
 	{
-	  val_print (elttype, valaddr + i * eltlen, 0, 0, stream,
-		     recurse + 1, options, current_language);
+	  val_print (elttype, valaddr + i * eltlen, 0, address + i * eltlen,
+		     stream, recurse + 1, options, current_language);
 	  annotate_elt_rep (reps);
 	  fprintf_filtered (stream, " <repeats %u times>", reps);
 	  annotate_elt_rep_end ();
@@ -1123,8 +1123,8 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr,
 	}
       else
 	{
-	  val_print (elttype, valaddr + i * eltlen, 0, 0, stream,
-		     recurse + 1, options, current_language);
+	  val_print (elttype, valaddr + i * eltlen, 0, address + i * eltlen,
+		     stream, recurse + 1, options, current_language);
 	  annotate_elt ();
 	  things_printed++;
 	}


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-11-22 18:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-21 16:22 RFA: fix address in call to val_print Tom Tromey
2008-11-22 18:16 ` Joel Brobecker
2008-11-23 21:15   ` Tom Tromey
2008-11-23 23:06     ` Joel Brobecker
2008-11-24  1:41       ` Tom Tromey
2008-11-24  2:30         ` Joel Brobecker
2008-11-24  3:09           ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox