From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: Doug Evans <dje@google.com>
Cc: Pedro Alves <palves@redhat.com>,
gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH v4 2/2] Provide completer for "info registers"
Date: Fri, 12 Dec 2014 19:04:00 -0000 [thread overview]
Message-ID: <87388kn0zt.fsf@br87z6lw.de.ibm.com> (raw)
In-Reply-To: <CADPb22QgDz9hTOUciHR8kxTYhWtpVCrUr25RJuni2+cfnsYH8w@mail.gmail.com> (Doug Evans's message of "Fri, 12 Dec 2014 09:45:55 -0800")
On Fri, Dec 12 2014, Doug Evans wrote:
> I'm seeing the following new failure on amd64-linux:
>
> (gdb) complete info registers ^M
> info registers ah^M
> info registers al^M
> ...
> info registers ymm9^M
> info registers ymm9h^M
> (gdb) FAIL: gdb.base/completion.exp: complete 'info registers '
Oops. This is because the user registers have 3-digit numbers and thus
occupy the first column in the output of "maint print user-registers".
This doesn't match the latest version of the regexp in completion.exp.
In fact, this is a useful finding, because the output of "maint print
user-registers" should actually be indented.
Here's a suggested fix.
-- >8 --
Subject: [PATCH] Fix indentation of "maint print user-registers"
This fixes a failure of the test case "complete 'info registers '" in
completion.exp on architectures where the user registers have numbers
above 99. In that case the output of "maint print user-registers" was
no longer indented, and the regexp in the test case failed to add them
to the list of expected completion results. The fix also swaps the
columns "Name" and "Nr", such that the indentation is always the same,
and to be consistent with the output of "maint print registers".
gdb/ChangeLog:
* user-regs.c (maintenance_print_user_registers): Swap "Nr" and
"Name" columns. Assure that the output is always indented.
gdb/testsuite/ChangeLog:
* gdb.base/completion.exp: Adjust to format changes of "maint
print user-registers".
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index 08e1a52..9c79a29 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -145,17 +145,14 @@ set regs_output [capture_command_output "mt print registers" \
append regs_output "\n"
append regs_output [capture_command_output "mt print reggroups" \
".*Group.*Type\[^\n]*\n"]
+append regs_output "\n"
+append regs_output [capture_command_output "mt print user-registers" \
+ ".*Name.*Nr\[^\n]*\n"]
set all_regs {}
foreach {- reg} [regexp -all -inline -line {^\s+(\w+)} $regs_output] {
lappend all_regs $reg
}
-set regs_output [capture_command_output "mt print user-registers" \
- ".*Nr.*Name\[^\n]*\n"]
-foreach {- reg} [regexp -all -inline -line {^\s+\d+\s+(\w+)} $regs_output] {
- lappend all_regs $reg
-}
-
set all_regs [join [lsort -unique $all_regs]]
# ... and then compare them to the completion of "info registers".
diff --git a/gdb/user-regs.c b/gdb/user-regs.c
index adaa959..6cdea16 100644
--- a/gdb/user-regs.c
+++ b/gdb/user-regs.c
@@ -229,9 +229,9 @@ maintenance_print_user_registers (char *args, int from_tty)
regs = gdbarch_data (gdbarch, user_regs_data);
regnum = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
- fprintf_unfiltered (gdb_stdout, " Nr Name\n");
+ fprintf_unfiltered (gdb_stdout, " %-11s %3s\n", "Name", "Nr");
for (reg = regs->first; reg != NULL; reg = reg->next, ++regnum)
- fprintf_unfiltered (gdb_stdout, "%3d %s\n", regnum, reg->name);
+ fprintf_unfiltered (gdb_stdout, " %-11s %3d\n", reg->name, regnum);
}
extern initialize_file_ftype _initialize_user_regs; /* -Wmissing-prototypes */
next prev parent reply other threads:[~2014-12-12 19:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-11 11:49 [PATCH v4 0/2] Provide useful " Andreas Arnez
2014-12-11 11:49 ` [PATCH v4 1/2] Add new GDB command "maint print user-registers" Andreas Arnez
2014-12-12 13:19 ` Pedro Alves
2014-12-11 11:49 ` [PATCH v4 2/2] Provide completer for "info registers" Andreas Arnez
2014-12-12 13:20 ` Pedro Alves
2014-12-12 15:20 ` Andreas Arnez
2014-12-12 15:30 ` Pedro Alves
2014-12-12 17:45 ` Doug Evans
2014-12-12 19:04 ` Andreas Arnez [this message]
2014-12-15 12: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=87388kn0zt.fsf@br87z6lw.de.ibm.com \
--to=arnez@linux.vnet.ibm.com \
--cc=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/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