public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: [Ada] Make sure we pass the correct struct value to val_print & co.
Date: Mon, 24 Jan 2011 20:36:00 -0000	[thread overview]
Message-ID: <201101242020.37882.pedro@codesourcery.com> (raw)

Another patch touching Ada bits.

This makes sure that we pass in the the correct struct value to
val_print & co, because val_print functions need to consult
the value for meta-data about the value contents, such the
value_bits_valid calls, and with later changes, a function
that checks whether contents at a given offset are "available".

This fixes a few cases in the Ada val_print routines I had
caught by inspection.

No regressions on gdb.ada/, FWIW.  Okay to apply?

-- 
Pedro Alves

2011-01-24  Pedro Alves  <pedro@codesourcery.com>

	* ada-valprint.c (val_print_packed_array_elements): Pass the
	correct struct value to val_print.
	(ada_val_print_1): Ditto.

---
 gdb/ada-valprint.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Index: src/gdb/ada-valprint.c
===================================================================
--- src.orig/gdb/ada-valprint.c	2011-01-24 18:44:19.000000000 +0000
+++ src/gdb/ada-valprint.c	2011-01-24 20:13:07.677639998 +0000
@@ -211,7 +211,7 @@ val_print_packed_array_elements (struct
 	  opts.deref_ref = 0;
 	  val_print (elttype, value_contents_for_printing (v0),
 		     value_embedded_offset (v0), 0, stream,
-		     recurse + 1, val, &opts, current_language);
+		     recurse + 1, v0, &opts, current_language);
 	  annotate_elt_rep (i - i0);
 	  fprintf_filtered (stream, _(" <repeats %u times>"), i - i0);
 	  annotate_elt_rep_end ();
@@ -242,7 +242,7 @@ val_print_packed_array_elements (struct
 		}
 	      val_print (elttype, value_contents_for_printing (v0),
 			 value_embedded_offset (v0), 0, stream,
-			 recurse + 1, val, &opts, current_language);
+			 recurse + 1, v0, &opts, current_language);
 	      annotate_elt ();
 	    }
 	}
@@ -708,7 +708,7 @@ ada_val_print_1 (struct type *type, cons
 				value_contents_for_printing (val),
 				value_embedded_offset (val),
 				value_address (val), stream, recurse,
-				NULL, options);
+				val, options);
       value_free_to_mark (mark);
       return retn;
     }
@@ -770,7 +770,7 @@ ada_val_print_1 (struct type *type, cons
 	      return ada_val_print_1 (target_type,
 				      value_contents_for_printing (v),
 				      value_embedded_offset (v), 0,
- 				      stream, recurse + 1, NULL, options);
+ 				      stream, recurse + 1, v, options);
 	    }
 	  else
 	    return ada_val_print_1 (TYPE_TARGET_TYPE (type),
@@ -915,7 +915,7 @@ ada_val_print_1 (struct type *type, cons
                          value_contents_for_printing (deref_val),
                          value_embedded_offset (deref_val),
                          value_address (deref_val), stream, recurse + 1,
-			 original_value, options, current_language);
+			 deref_val, options, current_language);
             }
           else
             fputs_filtered ("(null)", stream);

             reply	other threads:[~2011-01-24 20:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 20:36 Pedro Alves [this message]
2011-01-24 21:28 ` Joel Brobecker
2011-01-24 21:41   ` Pedro Alves

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=201101242020.37882.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=brobecker@adacore.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).