forked from Imagelibrary/binutils-gdb
gdb: introduce new 'maint flush ' prefix command
We currently have two flushing commands 'flushregs' and 'maint flush-symbol-cache'. I'm planning to add at least one more so I thought it might be nice if we bundled these together into one place. And so I created the 'maint flush ' command prefix. Currently there are two commands: (gdb) maint flush symbol-cache (gdb) maint flush register-cache Unfortunately, even though both of the existing flush commands are maintenance commands, I don't know how keen we about deleting existing commands for fear of breaking things in the wild. So, both of the existing flush commands 'maint flush-symbol-cache' and 'flushregs' are still around as deprecated aliases to the new commands. I've updated the testsuite to use the new command syntax, and updated the documentation too. gdb/ChangeLog: * NEWS: Mention new commands, and that the old commands are now deprecated. * cli/cli-cmds.c (maintenanceflushlist): Define. * cli/cli-cmds.h (maintenanceflushlist): Declare. * maint.c (_initialize_maint_cmds): Initialise maintenanceflushlist. * regcache.c: Add 'cli/cli-cmds.h' include. (reg_flush_command): Add header comment. (_initialize_regcache): Create new 'maint flush register-cache' command, make 'flushregs' an alias. * symtab.c: Add 'cli/cli-cmds.h' include. (_initialize_symtab): Create new 'maint flush symbol-cache' command, make old command an alias. gdb/doc/ChangeLog: * gdb.texinfo (Symbols): Document 'maint flush symbol-cache'. (Maintenance Commands): Document 'maint flush register-cache'. gdb/testsuite/ChangeLog: * gdb.base/c-linkage-name.exp: Update to use new 'maint flush ...' commands. * gdb.base/killed-outside.exp: Likewise. * gdb.opt/inline-bt.exp: Likewise. * gdb.perf/gmonster-null-lookup.py: Likewise. * gdb.perf/gmonster-print-cerr.py: Likewise. * gdb.perf/gmonster-ptype-string.py: Likewise. * gdb.python/py-unwind.exp: Likewise.
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "observable.h"
|
||||
#include "regset.h"
|
||||
#include <unordered_map>
|
||||
#include "cli/cli-cmds.h"
|
||||
|
||||
/*
|
||||
* DATA STRUCTURE
|
||||
@@ -1382,6 +1383,8 @@ regcache::debug_print_register (const char *func, int regno)
|
||||
fprintf_unfiltered (gdb_stdlog, "\n");
|
||||
}
|
||||
|
||||
/* Implement 'maint flush register-cache' command. */
|
||||
|
||||
static void
|
||||
reg_flush_command (const char *command, int from_tty)
|
||||
{
|
||||
@@ -2076,14 +2079,20 @@ void _initialize_regcache ();
|
||||
void
|
||||
_initialize_regcache ()
|
||||
{
|
||||
struct cmd_list_element *c;
|
||||
|
||||
regcache_descr_handle
|
||||
= gdbarch_data_register_post_init (init_regcache_descr);
|
||||
|
||||
gdb::observers::target_changed.attach (regcache_observer_target_changed);
|
||||
gdb::observers::thread_ptid_changed.attach (regcache_thread_ptid_changed);
|
||||
|
||||
add_com ("flushregs", class_maintenance, reg_flush_command,
|
||||
_("Force gdb to flush its register cache (maintainer command)."));
|
||||
add_cmd ("register-cache", class_maintenance, reg_flush_command,
|
||||
_("Force gdb to flush its register and frame cache."),
|
||||
&maintenanceflushlist);
|
||||
c = add_com_alias ("flushregs", "maintenance flush register-cache",
|
||||
class_maintenance, 0);
|
||||
deprecate_cmd (c, "maintenance flush register-cache");
|
||||
|
||||
#if GDB_SELF_TEST
|
||||
selftests::register_test ("get_thread_arch_aspace_regcache",
|
||||
|
||||
Reference in New Issue
Block a user