Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: RFA: fix address in call to val_print
Date: Fri, 21 Nov 2008 16:22:00 -0000	[thread overview]
Message-ID: <m33ahmexvp.fsf@fleche.redhat.com> (raw)

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


             reply	other threads:[~2008-11-21  0:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-21 16:22 Tom Tromey [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m33ahmexvp.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox