Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/2] use get_frame_register_value instead of deprecated_frame_register_read
Date: Fri, 04 Nov 2016 17:15:00 -0000	[thread overview]
Message-ID: <1478279691-25682-2-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1478279691-25682-1-git-send-email-yao.qi@linaro.org>

This patch calls get_frame_register_value instead of
deprecated_frame_register_read, so that we can pass
value_contents_for_printing to val_print.  Both
get_frame_register_value and deprecated_frame_register_read call
frame_unwind_register_value indirectly, so no functionality is changed
by this patch.

gdb:

2016-11-04  Yao Qi  <yao.qi@linaro.org>

	* mt-tdep.c (mt_registers_info): Call
	get_frame_register_value instead of
	deprecated_frame_register_read.
	* sh64-tdep.c (sh64_do_register): Likewise.
---
 gdb/mt-tdep.c   | 10 +++++-----
 gdb/sh64-tdep.c | 15 +++++++++------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c
index 95dd681..c08e805 100644
--- a/gdb/mt-tdep.c
+++ b/gdb/mt-tdep.c
@@ -712,11 +712,10 @@ mt_registers_info (struct gdbarch *gdbarch,
                || regnum == MT_COPRO_PSEUDOREG_REGNUM)
 	{
 	  /* Special output handling for the 'coprocessor' register.  */
-	  gdb_byte *buf;
 	  struct value_print_options opts;
+	  struct value *val;
 
-	  buf = (gdb_byte *) alloca (register_size (gdbarch, MT_COPRO_REGNUM));
-	  deprecated_frame_register_read (frame, MT_COPRO_REGNUM, buf);
+	  val = get_frame_register_value (frame, MT_COPRO_REGNUM);
 	  /* And print.  */
 	  regnum = MT_COPRO_PSEUDOREG_REGNUM;
 	  fputs_filtered (gdbarch_register_name (gdbarch, regnum),
@@ -726,8 +725,9 @@ mt_registers_info (struct gdbarch *gdbarch,
 				 file);
 	  get_no_prettyformat_print_options (&opts);
 	  opts.deref_ref = 1;
-	  val_print (register_type (gdbarch, regnum), buf,
-		     0, 0, file, 0, NULL,
+	  val_print (register_type (gdbarch, regnum),
+		     value_contents_for_printing (val),
+		     0, 0, file, 0, val,
 		     &opts, current_language);
 	  fputs_filtered ("\n", file);
 	}
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index cbbefdd..9054e20 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -2030,15 +2030,16 @@ static void
 sh64_do_register (struct gdbarch *gdbarch, struct ui_file *file,
 		  struct frame_info *frame, int regnum)
 {
-  unsigned char raw_buffer[MAX_REGISTER_SIZE];
   struct value_print_options opts;
+  struct value *val;
 
   fputs_filtered (gdbarch_register_name (gdbarch, regnum), file);
   print_spaces_filtered (15 - strlen (gdbarch_register_name
 				      (gdbarch, regnum)), file);
 
   /* Get the data in raw format.  */
-  if (!deprecated_frame_register_read (frame, regnum, raw_buffer))
+  val = get_frame_register_value (frame, regnum);
+  if (value_optimized_out (val) || !value_entirely_available (val))
     {
       fprintf_filtered (file, "*value not available*\n");
       return;
@@ -2046,13 +2047,15 @@ sh64_do_register (struct gdbarch *gdbarch, struct ui_file *file,
 
   get_formatted_print_options (&opts, 'x');
   opts.deref_ref = 1;
-  val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
-	     file, 0, NULL, &opts, current_language);
+  val_print (register_type (gdbarch, regnum),
+	     value_contents_for_printing (val), 0, 0,
+	     file, 0, val, &opts, current_language);
   fprintf_filtered (file, "\t");
   get_formatted_print_options (&opts, 0);
   opts.deref_ref = 1;
-  val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
-	     file, 0, NULL, &opts, current_language);
+  val_print (register_type (gdbarch, regnum),
+	     value_contents_for_printing (val), 0, 0,
+	     file, 0, val, &opts, current_language);
   fprintf_filtered (file, "\n");
 }
 
-- 
1.9.1


      parent reply	other threads:[~2016-11-04 17:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-04 17:15 [PATCH 0/2] Remove parameter valaddr from la_val_print Yao Qi
2016-11-04 17:15 ` [PATCH 2/2] " Yao Qi
2016-11-07 13:19   ` Ulrich Weigand
2016-11-07 14:24     ` Yao Qi
2016-11-07 14:36       ` Ulrich Weigand
2016-11-04 17:15 ` Yao Qi [this message]

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=1478279691-25682-2-git-send-email-yao.qi@linaro.org \
    --to=qiyaoltc@gmail.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