summaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2011-04-20 17:54:05 +0000
committerPedro Alves <pedro@codesourcery.com>2011-04-20 17:54:05 +0000
commit85e7535da46e06cf5152916dceeaa39fbd72fa91 (patch)
treecab1b56a8e41affaccc1d11b8336301ee8c7252f /gdb/regcache.c
parent021de2843295029d33f883427adb73a7f6697ae0 (diff)
downloadgdb-85e7535da46e06cf5152916dceeaa39fbd72fa91.tar.gz
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 8b4d77ccc0c..f603c331d1c 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);
}