aboutsummaryrefslogtreecommitdiff
path: root/gdb/target-dcache.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-11-20 19:34:21 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-12-13 12:36:16 +0000
commitee9812a00153ad788319dae1cde901cf216f9fba (patch)
treef70cd83590cd7d42a6e81d6f7958bce5b40a1d45 /gdb/target-dcache.c
parent50a5f1878e22b09ebea30ad60a2164b80af6efdb (diff)
downloadfsf-binutils-gdb-ee9812a00153ad788319dae1cde901cf216f9fba.zip
fsf-binutils-gdb-ee9812a00153ad788319dae1cde901cf216f9fba.tar.gz
fsf-binutils-gdb-ee9812a00153ad788319dae1cde901cf216f9fba.tar.bz2
gdb: new command 'maint flush dcache'
Add a new command to flush the dcache. gdb/ChangeLog: * NEWS: Mention new commands. * target-dcache.c: Add 'cli/cli-cmds.h' include. (maint_flush_dcache_command): New function. (_initialize_target_dcache): Create new 'maint flush dcache' command. gdb/doc/ChangeLog: * gdb.texinfo (Caching Target Data): Document 'maint flush dcache'. gdb/testsuite/ChangeLog: * gdb.base/dcache-flush.c: New file. * gdb.base/dcache-flush.exp: New file.
Diffstat (limited to 'gdb/target-dcache.c')
-rw-r--r--gdb/target-dcache.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/target-dcache.c b/gdb/target-dcache.c
index 0226d67..90b60f6 100644
--- a/gdb/target-dcache.c
+++ b/gdb/target-dcache.c
@@ -19,6 +19,7 @@
#include "target-dcache.h"
#include "gdbcmd.h"
#include "progspace.h"
+#include "cli/cli-cmds.h"
/* The target dcache is kept per-address-space. This key lets us
associate the cache with the address space. */
@@ -152,6 +153,16 @@ code_cache_enabled_p (void)
return code_cache_enabled;
}
+/* Implement the 'maint flush dcache' command. */
+
+static void
+maint_flush_dcache_command (const char *command, int from_tty)
+{
+ target_dcache_invalidate ();
+ if (from_tty)
+ printf_filtered (_("The dcache was flushed.\n"));
+}
+
void _initialize_target_dcache ();
void
_initialize_target_dcache ()
@@ -178,4 +189,12 @@ access is on."),
set_code_cache,
show_code_cache,
&setlist, &showlist);
+
+ add_cmd ("dcache", class_maintenance, maint_flush_dcache_command,
+ _("\
+Force gdb to flush its target memory data cache.\n\
+\n\
+The dcache caches all target memory accesses where possible, this\n\
+includes the stack-cache and the code-cache."),
+ &maintenanceflushlist);
}