Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Andrew Burgess" <aburgess@broadcom.com>
To: gdb-patches@sourceware.org
Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>
Subject: Re: PING: [PATCH] Print <unavailable> for unavailable registers
Date: Wed, 28 Aug 2013 15:26:00 -0000	[thread overview]
Message-ID: <521E1695.1040200@broadcom.com> (raw)
In-Reply-To: <5200F594.3050402@broadcom.com>

On 06/08/2013 2:09 PM, Andrew Burgess wrote:
> Following on from (but unrelated to) this mail:
>   http://sourceware.org/ml/gdb-patches/2013-08/msg00170.html
> 
> Printing "*value not available*" for unavailable values within
> "info registers" seems inconsistent to me, if we just print an
> unavailable register we'll get "<unavailable>".
> 
> The patch below makes "info registers" print "<unavailable>".

The original patch was supposed to be applied after [1],
however I never managed to get [1] accepted.  I've flipped
the ordering, so that this patch can be applied first, if
this gets merged I'll post a revised version of [1] later,
just for the record.

To my reading, Mark seems to imply in this mail:
  http://sourceware.org/ml/gdb-patches/2013-08/msg00322.html
that he does not disagree with displaying registers as
"<unavailable>", so I feel it's acceptable to push this
patch forward.

After this patch "info registers" will display unavailable
(for example, not collected by tracing) as <unavailable>,
while optimized out register values will still be displayed
using the old "*value not available*" string.

The previous version of this patch included some sh64 changes,
I've removed them from this patch to try and increase the chance
of acceptance.

[1] http://sourceware.org/ml/gdb-patches/2013-08/msg00170.html

OK?
Andrew


gdb/ChangeLog

2013-08-19  Andrew Burgess  <aburgess@broadcom.com>

	* infcmd.c (default_print_one_register_info): use
	val_print_unavailable for unavailable register values, continue as
	before for optimized out register values.
	(default_print_registers_info): Switch to using
	get_frame_register_value.

gdb/testsuite/ChangeLog

2013-08-19  Andrew Burgess  <aburgess@broadcom.com>

	* gdb.trace/unavailable.exp (gdb_unavailable_registers_test):
	Change expected pattern for unavailable registers to
	<unavailable>.

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 154cde2..83e0323 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2030,6 +2030,12 @@ default_print_one_register_info (struct ui_file *file,
 
   if (!value_entirely_available (val))
     {
+      val_print_unavailable (file);
+      fprintf_filtered (file, "\n");
+      return;
+    }
+  else if (value_optimized_out (val))
+    {
       fprintf_filtered (file, "*value not available*\n");
       return;
     }
@@ -2107,9 +2113,6 @@ default_print_registers_info (struct gdbarch *gdbarch,
 
   for (i = 0; i < numregs; i++)
     {
-      struct type *regtype;
-      struct value *val;
-
       /* Decide between printing all regs, non-float / vector regs, or
          specific reg.  */
       if (regnum == -1)
@@ -2137,16 +2140,9 @@ default_print_registers_info (struct gdbarch *gdbarch,
 	  || *(gdbarch_register_name (gdbarch, i)) == '\0')
 	continue;
 
-      regtype = register_type (gdbarch, i);
-      val = allocate_value (regtype);
-
-      /* Get the data in raw format.  */
-      if (! deprecated_frame_register_read (frame, i, value_contents_raw (val)))
-	mark_value_bytes_unavailable (val, 0, TYPE_LENGTH (value_type (val)));
-
       default_print_one_register_info (file,
 				       gdbarch_register_name (gdbarch, i),
-				       val);
+				       get_frame_register_value (frame, i));
     }
 }
 
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 8e2e105..ed14798 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -297,11 +297,11 @@ proc gdb_unavailable_registers_test { } {
 	test_register "\$pc"
 
 	gdb_test "info registers" \
-	    "\\*value not available\\*.*\\*value not available\\*" \
+	    "<unavailable>.*<unavailable>" \
 	    "info registers, multiple registers not available"
 
 	gdb_test "info registers \$$spreg" \
-	    "\\*value not available\\*" \
+	    "<unavailable>" \
 	    "info registers \$$spreg reports not available"
 
 	gdb_test "tfind none" "#0  end .*" "cease trace debugging"




  reply	other threads:[~2013-08-28 15:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 13:09 Andrew Burgess
2013-08-28 15:26 ` Andrew Burgess [this message]
2013-09-18 14:48 ` PING: " Andrew Burgess
2013-09-18 16:06   ` Pedro Alves
2013-10-16 14:26     ` Andrew Burgess
2013-10-24 19:44       ` Pedro Alves
2013-10-29 13:37         ` Andrew Burgess

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=521E1695.1040200@broadcom.com \
    --to=aburgess@broadcom.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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