aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@vnet.linux.ibm.com>2014-12-16 16:06:42 +0100
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2014-12-16 16:06:42 +0100
commit25dda427ec9e074e0a258eb93c7cc811f0a85a9c (patch)
tree0617f7d4e2a0b71a35f685566710a61fed4309da
parent033539e2685156ad6ad60e5925bc61cef5ced483 (diff)
downloadbinutils-25dda427ec9e074e0a258eb93c7cc811f0a85a9c.zip
binutils-25dda427ec9e074e0a258eb93c7cc811f0a85a9c.tar.gz
binutils-25dda427ec9e074e0a258eb93c7cc811f0a85a9c.tar.bz2
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".
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/completion.exp9
-rw-r--r--gdb/user-regs.c4
4 files changed, 15 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2fadb8c..7c2e6f3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-16 Andreas Arnez <arnez@vnet.linux.ibm.com>
+
+ * user-regs.c (maintenance_print_user_registers): Swap "Nr" and
+ "Name" columns. Assure that the output is always indented.
+
2014-12-16 Joel Brobecker <brobecker@adacore.com>
* nat/linux-ptrace.h (PTRACE_O_EXITKILL): Define if not
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ece258f..4be1f71 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-16 Andreas Arnez <arnez@vnet.linux.ibm.com>
+
+ * gdb.base/completion.exp: Adjust to format changes of "maint
+ print user-registers".
+
2014-12-16 Catalin Udma <catalin.udma@freescale.com>
PR server/17457
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 */