Fix indentation of "maint print user-registers"
authorAndreas Arnez <arnez@vnet.linux.ibm.com>
Tue, 16 Dec 2014 15:06:42 +0000 (16:06 +0100)
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>
Tue, 16 Dec 2014 15:06:42 +0000 (16:06 +0100)
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".

gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/completion.exp
gdb/user-regs.c

index 2fadb8cf394ff960e75641673924a2b0e5797ff4..7c2e6f35d6f4210daa04dd54f6b8a98e04a381f4 100644 (file)
@@ -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
index ece258f4164bf475428fa016a6014b4d9fe43ae2..4be1f71e09928ca1ee08153feb675d530c437d32 100644 (file)
@@ -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
index 08e1a52d98d0a2da60fde82cd38cd78b45bb3471..9c79a29bf3ecde73f4cd46126217e28762329e80 100644 (file)
@@ -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".
index adaa959a41c4671cafcd75e550e754975911cac8..6cdea16d85396b395b14d6e629d482777807463e 100644 (file)
@@ -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 */
This page took 0.038899 seconds and 4 git commands to generate.