From: "Andrew Burgess" <aburgess@broadcom.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [PATCH] Print <unavailable> for unavailable registers
Date: Tue, 06 Aug 2013 13:09:00 -0000 [thread overview]
Message-ID: <5200F594.3050402@broadcom.com> (raw)
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>".
Taking a look around we also had code in the sh64-tdep.c file that
printed "*value not available*", I've changed this to also print
"<unavailable>", however, (1) this is being printed for unavailable,
and optimized out registers, but it was kind-of broken in this regard
already, (2) I don't use this target so don't know if this is really
the best change, but it felt like it probably was, and (3) I've also
made the sh64 code return early after printing "<unavailable>", it
previously fell through and tried to print the value anyway, I'm
guessing this was a bug, but the code has been that way for a long
time now.... I'd be happy to drop the sh64 changes if that was
preferred.
OK to apply?
Thanks,
Andrew
gdb/ChangeLog
2013-08-06 Andrew Burgess <aburgess@broadcom.com>
* infcmd.c (default_print_one_register_info): use
val_print_unavailable for unavailable values.
* sh64-tdep.c (sh64_do_register): Use val_print_unavailable for
unreadable registers. Return early for unreadable registers.
gdb/testsuite/ChangeLog
2013-08-06 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 f6a5290..297dad0 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2030,7 +2030,8 @@ default_print_one_register_info (struct ui_file *file,
if (!value_entirely_available (val))
{
- fprintf_filtered (file, "*value not available*\n");
+ val_print_unavailable (file);
+ fprintf_filtered (file, "\n");
return;
}
else if (value_optimized_out (val))
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index b640b1d..37fb72f 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -2045,7 +2045,11 @@ sh64_do_register (struct gdbarch *gdbarch, struct ui_file *file,
/* Get the data in raw format. */
if (!deprecated_frame_register_read (frame, regnum, raw_buffer))
- fprintf_filtered (file, "*value not available*\n");
+ {
+ val_print_unavailable (file);
+ fprintf_filtered (file, "\n");
+ return;
+ }
get_formatted_print_options (&opts, 'x');
opts.deref_ref = 1;
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"
next reply other threads:[~2013-08-06 13:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-06 13:09 Andrew Burgess [this message]
2013-08-28 15:26 ` PING: " Andrew Burgess
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=5200F594.3050402@broadcom.com \
--to=aburgess@broadcom.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