aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-04-20 17:54:08 +0000
committerPedro Alves <palves@redhat.com>2011-04-20 17:54:08 +0000
commitc21236dc7563a54e2de9a8edd11ec697cd112a66 (patch)
tree1a9d331b73167dd5ad7ab91fe5b9ab6293ba8351 /gdb/regcache.c
parentb78974c3b4cea6c98cb8dfd9c0bee59efd45d311 (diff)
downloadgdb-c21236dc7563a54e2de9a8edd11ec697cd112a66.zip
gdb-c21236dc7563a54e2de9a8edd11ec697cd112a66.tar.gz
gdb-c21236dc7563a54e2de9a8edd11ec697cd112a66.tar.bz2
2011-04-20 Pedro Alves <pedro@codesourcery.com>
gdb/ * regcache.c: Include remote.h. (enum regcache_dump_what) <regcache_dump_remote>: New enum value. (regcache_dump): Handle regcache_dump_remote. (maintenance_print_remote_registers): New function. (_initialize_regcache): Install "maint print remote-registers" command. * remote.c (map_regcache_remote_table): New function, factored out from ... (init_remote_state): ... here. (remote_register_number_and_offset): New. * remote.h (remote_register_number_and_offset): Declare. gdb/doc/ * gdb.texinfo (Maintenance Commands): Document `maint print remote-registers'.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 8b4d77c..f603c33 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -30,6 +30,7 @@
#include "gdbcmd.h" /* For maintenanceprintlist. */
#include "observer.h"
#include "exceptions.h"
+#include "remote.h"
/*
* DATA STRUCTURE
@@ -1053,7 +1054,8 @@ dump_endian_bytes (struct ui_file *file, enum bfd_endian endian,
enum regcache_dump_what
{
regcache_dump_none, regcache_dump_raw,
- regcache_dump_cooked, regcache_dump_groups
+ regcache_dump_cooked, regcache_dump_groups,
+ regcache_dump_remote
};
static void
@@ -1251,6 +1253,23 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
}
}
+ /* Remote packet configuration. */
+ if (what_to_dump == regcache_dump_remote)
+ {
+ if (regnum < 0)
+ {
+ fprintf_unfiltered (file, "Rmt Nr g/G Offset");
+ }
+ else if (regnum < regcache->descr->nr_raw_registers)
+ {
+ int pnum, poffset;
+
+ if (remote_register_number_and_offset (get_regcache_arch (regcache), regnum,
+ &pnum, &poffset))
+ fprintf_unfiltered (file, "%7d %11d", pnum, poffset);
+ }
+ }
+
fprintf_unfiltered (file, "\n");
}
@@ -1309,6 +1328,12 @@ maintenance_print_register_groups (char *args, int from_tty)
regcache_print (args, regcache_dump_groups);
}
+static void
+maintenance_print_remote_registers (char *args, int from_tty)
+{
+ regcache_print (args, regcache_dump_remote);
+}
+
extern initialize_file_ftype _initialize_regcache; /* -Wmissing-prototype */
void
@@ -1342,5 +1367,11 @@ _initialize_regcache (void)
"including each register's group.\n"
"Takes an optional file parameter."),
&maintenanceprintlist);
+ add_cmd ("remote-registers", class_maintenance,
+ maintenance_print_remote_registers, _("\
+Print the internal register configuration including each register's\n\
+remote register number and buffer offset in the g/G packets.\n\
+Takes an optional file parameter."),
+ &maintenanceprintlist);
}