diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2007-10-25 11:30:55 +0000 |
---|---|---|
committer | Maciej W. Rozycki <macro@linux-mips.org> | 2007-10-25 11:30:55 +0000 |
commit | ad842144541f614986b8ac5b4db4bfba733f0290 (patch) | |
tree | e4bc0d0b138350abbcb19baab026bb2f2b383a8d /gdb/infcmd.c | |
parent | 24a836bd61e90340f0fdd6e77c00b61eb2f579b1 (diff) | |
download | gdb-ad842144541f614986b8ac5b4db4bfba733f0290.zip gdb-ad842144541f614986b8ac5b4db4bfba733f0290.tar.gz gdb-ad842144541f614986b8ac5b4db4bfba733f0290.tar.bz2 |
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).
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r-- | gdb/infcmd.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 7f45cc7..2fb0f23 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -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; |