* FYI: fix 'info reg' output
@ 2012-02-15 19:30 Tom Tromey
2012-07-19 9:22 ` Andreas Schwab
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2012-02-15 19:30 UTC (permalink / raw)
To: gdb-patches
I'm checking this in.
This fixes PR 12659. The bug is wrong output when multiple names are
given to "info register":
(gdb) info reg sp fp
sp fp: 0x7fffffffe4d0
fp: 0x7fffffffe4d0
Note the name of the first register.
The fix is just tweaking a printf a bit.
New test case included.
Built and regtested on x86-64 Fedora 16.
Tom
2012-02-15 Tom Tromey <tromey@redhat.com>
PR gdb/12659:
* infcmd.c (registers_info): Print just the current register's
name.
2012-02-15 Tom Tromey <tromey@redhat.com>
* gdb.base/pc-fp.exp: Add "info register" tests.
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index e9e3e32..7d929df 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2170,7 +2170,7 @@ registers_info (char *addr_exp, int fpregs)
struct value_print_options opts;
struct value *val = value_of_user_reg (regnum, frame);
- printf_filtered ("%s: ", start);
+ printf_filtered ("%.*s: ", (int) (end - start), start);
get_formatted_print_options (&opts, 'x');
val_print_scalar_formatted (check_typedef (value_type (val)),
value_contents_for_printing (val),
diff --git a/gdb/testsuite/gdb.base/pc-fp.exp b/gdb/testsuite/gdb.base/pc-fp.exp
index 9d74eef..f650000 100644
--- a/gdb/testsuite/gdb.base/pc-fp.exp
+++ b/gdb/testsuite/gdb.base/pc-fp.exp
@@ -60,11 +60,10 @@ set valueof_fp [get_hexadecimal_valueof "\$fp" "0"]
gdb_test "display/i \$pc" "1: x/i +\\\$pc( +|\r\n)=> ${valueof_pc}.*"
gdb_test "display/w \$fp" "2: x/xw +\\\$fp +${valueof_fp}.*"
-# FIXME: cagney/2002-09-04: Should also check that ``info registers
-# $pc'' et.al.'' come back with the same value as the above displays
-# and a print --- assuming that is that people agree to such behavour.
-# Need to re-write default_print_registers_info() for it to work (and
-# such a rewrite is on the reggroups branch).
+gdb_test "info register \$pc" "${valueof_pc}.*"
+gdb_test "info register \$fp" "${valueof_fp}.*"
-# gdb_test "info registers \$pc" "${valueof_pc}"
-# gdb_test "info registers \$fp" "${valueof_fp}"
+# Regression test for
+# http://sourceware.org/bugzilla/show_bug.cgi?id=12659
+gdb_test "info register pc fp" \
+ "pc: ${valueof_pc}\[\r\n\]+fp: ${valueof_fp}\[\r\n\]+"
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: FYI: fix 'info reg' output
2012-02-15 19:30 FYI: fix 'info reg' output Tom Tromey
@ 2012-07-19 9:22 ` Andreas Schwab
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2012-07-19 9:22 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
Tom Tromey <tromey@redhat.com> writes:
> +# Regression test for
> +# http://sourceware.org/bugzilla/show_bug.cgi?id=12659
> +gdb_test "info register pc fp" \
> + "pc: ${valueof_pc}\[\r\n\]+fp: ${valueof_fp}\[\r\n\]+"
>
info register pc fp
pc 0x100005d0 0x100005d0 <main+20>
fp: 0xfffffffd6e0
(gdb) FAIL: gdb.base/pc-fp.exp: info register pc fp
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-19 9:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-15 19:30 FYI: fix 'info reg' output Tom Tromey
2012-07-19 9:22 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox