aboutsummaryrefslogtreecommitdiff
path: root/gdb/user-regs.c
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@linux.vnet.ibm.com>2014-12-12 17:11:22 +0100
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2014-12-12 17:11:22 +0100
commitf5b95c01fbe709f73ca3ba60136ff973dcb706a5 (patch)
treeb4aaae0ca99aab145b7245b0d0ca5946c2b805f6 /gdb/user-regs.c
parent3e29f34a4eef29f5b159749ccb1efb8867b2e651 (diff)
downloadgdb-f5b95c01fbe709f73ca3ba60136ff973dcb706a5.zip
gdb-f5b95c01fbe709f73ca3ba60136ff973dcb706a5.tar.gz
gdb-f5b95c01fbe709f73ca3ba60136ff973dcb706a5.tar.bz2
Add new GDB command "maint print user-registers"
This adds a command for listing the "user" registers. So far GDB offered no means of determining the set of user registers and omitted them from all other register listings. gdb/ChangeLog: * user-regs.c: Include "arch-utils.h", "command.h", and "cli/cli-cmds.h". (maintenance_print_user_registers): New. (_initialize_user_regs): Register new "maint print user-registers" subcommand. * NEWS: Mention new GDB command "maint print user-registers". gdb/doc/ChangeLog: * gdb.texinfo: Document "maint print user-registers".
Diffstat (limited to 'gdb/user-regs.c')
-rw-r--r--gdb/user-regs.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/user-regs.c b/gdb/user-regs.c
index 35d64ec..adaa959 100644
--- a/gdb/user-regs.c
+++ b/gdb/user-regs.c
@@ -23,6 +23,9 @@
#include "user-regs.h"
#include "gdbtypes.h"
#include "frame.h"
+#include "arch-utils.h"
+#include "command.h"
+#include "cli/cli-cmds.h"
/* A table of user registers.
@@ -215,10 +218,31 @@ value_of_user_reg (int regnum, struct frame_info *frame)
return reg->read (frame, reg->baton);
}
+static void
+maintenance_print_user_registers (char *args, int from_tty)
+{
+ struct gdbarch *gdbarch = get_current_arch ();
+ struct gdb_user_regs *regs;
+ struct user_reg *reg;
+ int regnum;
+
+ regs = gdbarch_data (gdbarch, user_regs_data);
+ regnum = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
+
+ fprintf_unfiltered (gdb_stdout, " Nr Name\n");
+ for (reg = regs->first; reg != NULL; reg = reg->next, ++regnum)
+ fprintf_unfiltered (gdb_stdout, "%3d %s\n", regnum, reg->name);
+}
+
extern initialize_file_ftype _initialize_user_regs; /* -Wmissing-prototypes */
void
_initialize_user_regs (void)
{
user_regs_data = gdbarch_data_register_post_init (user_regs_init);
+
+ add_cmd ("user-registers", class_maintenance,
+ maintenance_print_user_registers,
+ _("List the names of the current user registers.\n"),
+ &maintenanceprintlist);
}