]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR exp/1926
authorMaciej W. Rozycki <macro@linux-mips.org>
Thu, 25 Oct 2007 11:30:55 +0000 (11:30 +0000)
committerMaciej W. Rozycki <macro@linux-mips.org>
Thu, 25 Oct 2007 11:30:55 +0000 (11:30 +0000)
* infcmd.c (registers_info): Check for a user register before
calling target's gdbarch_print_registers_info().  If found to be
so, extract the implicit value of user register and call
print_scalar_formatted().
* Makefile.in: (infcmd.o): Add $(user_regs_h).

gdb/ChangeLog
gdb/Makefile.in
gdb/infcmd.c

index 1546a0450e15b69dfb167e7ae2b92c1312cc0277..82eaeb3d0700776463bdae2e98fd39b57ddb42cc 100644 (file)
@@ -1,3 +1,13 @@
+2007-10-25  David Ung  <davidu@mips.com>
+            Maciej W. Rozycki  <macro@mips.com>
+
+       PR exp/1926
+       * infcmd.c (registers_info): Check for a user register before
+       calling target's gdbarch_print_registers_info().  If found to be
+       so, extract the implicit value of user register and call
+       print_scalar_formatted().
+       * Makefile.in: (infcmd.o): Add $(user_regs_h).
+
 2007-10-25  Joel Brobecker  <brobecker@adacore.com>
 
        * NEWS: Document status of hppa64-hpux support.
index 8fc1d8afc4f1ee11326d5d43a0d2653300ad6c66..36ed94845c56389fe1ed3bd40ea0495f82dc72e7 100644 (file)
@@ -2208,7 +2208,8 @@ infcmd.o: infcmd.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(symfile_h) $(gdbcore_h) $(target_h) $(language_h) $(symfile_h) \
        $(objfiles_h) $(completer_h) $(ui_out_h) $(event_top_h) \
        $(parser_defs_h) $(regcache_h) $(reggroups_h) $(block_h) \
-       $(solib_h) $(gdb_assert_h) $(observer_h) $(target_descriptions_h)
+       $(solib_h) $(gdb_assert_h) $(observer_h) $(target_descriptions_h) \
+       $(user_regs_h)
 inf-loop.o: inf-loop.c $(defs_h) $(inferior_h) $(target_h) $(event_loop_h) \
        $(event_top_h) $(inf_loop_h) $(remote_h) $(exceptions_h)
 inflow.o: inflow.c $(defs_h) $(frame_h) $(inferior_h) $(command_h) \
index 7f45cc7f7d4f1d6337bab4e212e4685237012553..2fb0f23d75d9423e96eefbc5651319e5d77d1e67 100644 (file)
@@ -47,6 +47,7 @@
 #include "gdb_assert.h"
 #include "observer.h"
 #include "target-descriptions.h"
+#include "user-regs.h"
 
 /* Functions exported for general use, in inferior.h: */
 
@@ -1705,21 +1706,35 @@ registers_info (char *addr_exp, int fpregs)
       while ((*addr_exp) != '\0' && !isspace ((*addr_exp)))
        addr_exp++;
       end = addr_exp;
-      
+
       /* Figure out what we've found and display it.  */
 
       /* A register name?  */
       {
-       int regnum = frame_map_name_to_regnum (frame,
-                                              start, end - start);
+       int regnum = frame_map_name_to_regnum (frame, start, end - start);
        if (regnum >= 0)
          {
-           gdbarch_print_registers_info (gdbarch, gdb_stdout,
-                                         frame, regnum, fpregs);
+           /* User registers lie completely outside of the range of
+              normal registers.  Catch them early so that the target
+              never sees them.  */
+           if (regnum >= gdbarch_num_regs (gdbarch)
+                         + gdbarch_num_pseudo_regs (gdbarch))
+             {
+               struct value *val = value_of_user_reg (regnum, frame);
+
+               printf_filtered ("%s: ", start);
+               print_scalar_formatted (value_contents (val),
+                                       check_typedef (value_type (val)),
+                                       'x', 0, gdb_stdout);
+               printf_filtered ("\n");
+             }
+           else
+             gdbarch_print_registers_info (gdbarch, gdb_stdout,
+                                           frame, regnum, fpregs);
            continue;
          }
       }
-       
+
       /* A register number?  (how portable is this one?).  */
       {
        char *endptr;