This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

RFA: fix address in call to val_print


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++;
 	}


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