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'.
This commit is contained in:
Pedro Alves 2011-04-20 17:54:08 +00:00
parent b78974c3b4
commit c21236dc75
6 changed files with 117 additions and 22 deletions

View file

@ -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);
}