public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Organise maintenance commands that flush caches
@ 2020-11-23 10:39 Andrew Burgess
  2020-11-23 10:39 ` [PATCH 1/2] gdb: introduce new 'maint flush ' prefix command Andrew Burgess
  2020-11-23 10:39 ` [PATCH 2/2] gdb: new command 'maint flush dcache' Andrew Burgess
  0 siblings, 2 replies; 9+ messages in thread
From: Andrew Burgess @ 2020-11-23 10:39 UTC (permalink / raw)
  To: gdb-patches

Adds a new maintenance command 'maint flush ', the existing cache
flushing commands are moved under here (with alias added for backward
compatibility), and a new flush command for the dcache is added.

Thanks,
Andrew

--

Andrew Burgess (2):
  gdb: introduce new 'maint flush ' prefix command
  gdb: new command 'maint flush dcache'

 gdb/ChangeLog                                 | 23 +++++++
 gdb/NEWS                                      |  8 +++
 gdb/cli/cli-cmds.c                            |  4 ++
 gdb/cli/cli-cmds.h                            |  4 ++
 gdb/doc/ChangeLog                             | 10 +++
 gdb/doc/gdb.texinfo                           | 26 ++++++--
 gdb/maint.c                                   |  5 ++
 gdb/regcache.c                                | 11 +++-
 gdb/symtab.c                                  |  8 ++-
 gdb/target-dcache.c                           | 19 ++++++
 gdb/testsuite/ChangeLog                       | 16 +++++
 gdb/testsuite/gdb.base/c-linkage-name.exp     |  2 +-
 gdb/testsuite/gdb.base/dcache-flush.c         | 33 ++++++++++
 gdb/testsuite/gdb.base/dcache-flush.exp       | 64 +++++++++++++++++++
 gdb/testsuite/gdb.base/killed-outside.exp     |  2 +-
 gdb/testsuite/gdb.opt/inline-bt.exp           |  2 +-
 .../gdb.perf/gmonster-null-lookup.py          |  2 +-
 gdb/testsuite/gdb.perf/gmonster-print-cerr.py |  2 +-
 .../gdb.perf/gmonster-ptype-string.py         |  2 +-
 gdb/testsuite/gdb.python/py-unwind.exp        |  2 +-
 20 files changed, 230 insertions(+), 15 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/dcache-flush.c
 create mode 100644 gdb/testsuite/gdb.base/dcache-flush.exp

-- 
2.25.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] gdb: introduce new 'maint flush ' prefix command
  2020-11-23 10:39 [PATCH 0/2] Organise maintenance commands that flush caches Andrew Burgess
@ 2020-11-23 10:39 ` Andrew Burgess
  2020-11-23 15:28   ` Eli Zaretskii
  2020-11-23 16:24   ` Luis Machado
  2020-11-23 10:39 ` [PATCH 2/2] gdb: new command 'maint flush dcache' Andrew Burgess
  1 sibling, 2 replies; 9+ messages in thread
From: Andrew Burgess @ 2020-11-23 10:39 UTC (permalink / raw)
  To: gdb-patches

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 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.
	* 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.
---
 gdb/ChangeLog                                 | 15 ++++++++++++++
 gdb/NEWS                                      |  5 +++++
 gdb/cli/cli-cmds.c                            |  4 ++++
 gdb/cli/cli-cmds.h                            |  4 ++++
 gdb/doc/ChangeLog                             |  5 +++++
 gdb/doc/gdb.texinfo                           | 20 +++++++++++++++----
 gdb/maint.c                                   |  5 +++++
 gdb/regcache.c                                | 11 ++++++++--
 gdb/symtab.c                                  |  8 ++++++--
 gdb/testsuite/ChangeLog                       | 11 ++++++++++
 gdb/testsuite/gdb.base/c-linkage-name.exp     |  2 +-
 gdb/testsuite/gdb.base/killed-outside.exp     |  2 +-
 gdb/testsuite/gdb.opt/inline-bt.exp           |  2 +-
 .../gdb.perf/gmonster-null-lookup.py          |  2 +-
 gdb/testsuite/gdb.perf/gmonster-print-cerr.py |  2 +-
 .../gdb.perf/gmonster-ptype-string.py         |  2 +-
 gdb/testsuite/gdb.python/py-unwind.exp        |  2 +-
 17 files changed, 87 insertions(+), 15 deletions(-)

diff --git a/gdb/NEWS b/gdb/NEWS
index d1f721c3953..b07b054223f 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -27,6 +27,11 @@ set debug event-loop
 show debug event-loop
   Control the display of debug output about GDB's event loop.
 
+maintenance flush symbol-cache
+maintenance flush register-cache
+  These new commands are equivalent to the already existing commands
+  'maintenance flush-symbol-cache' and 'flushregs' respectively.
+
 * Changed commands
 
 break [PROBE_MODIFIER] [LOCATION] [thread THREADNUM]
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 54822fad481..88c83cd6319 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -151,6 +151,10 @@ struct cmd_list_element *maintenanceprintlist;
 
 struct cmd_list_element *maintenancechecklist;
 
+/* Chain containing all defined "maintenance flush" subcommands.  */
+
+struct cmd_list_element *maintenanceflushlist;
+
 struct cmd_list_element *setprintlist;
 
 struct cmd_list_element *showprintlist;
diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
index 1d641520bf5..976cea07806 100644
--- a/gdb/cli/cli-cmds.h
+++ b/gdb/cli/cli-cmds.h
@@ -89,6 +89,10 @@ extern struct cmd_list_element *maintenanceinfolist;
 
 extern struct cmd_list_element *maintenanceprintlist;
 
+/* Chain containing all defined "maintenance flush" subcommands.  */
+
+extern struct cmd_list_element *maintenanceflushlist;
+
 extern struct cmd_list_element *setprintlist;
 
 extern struct cmd_list_element *showprintlist;
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 01dcac941c2..3745aa52973 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -19503,12 +19503,17 @@
 Print symbol cache usage statistics.
 This helps determine how well the cache is being utilized.
 
+@kindex maint flush symbol-cache
 @kindex maint flush-symbol-cache
 @cindex symbol cache, flushing
+@item maint flush symbol-cache
 @item maint flush-symbol-cache
-Flush the contents of the symbol cache, all entries are removed.
-This command is useful when debugging the symbol cache.
-It is also useful when collecting performance data.
+Flush the contents of the symbol cache, all entries are removed.  This
+command is useful when debugging the symbol cache.  It is also useful
+when collecting performance data.  The command @code{maint
+flush-symbol-cache} is an alias for @code{maint flush symbol-cache}
+that exists for backward compatibility with older versions of
+@value{GDBN}.
 
 @end table
 
@@ -38859,9 +38864,16 @@
  restore    internal
 @end smallexample
 
+@kindex maint flush register-cache
 @kindex flushregs
+@cindex register cache, flushing
+@item maint flush register-cache
 @item flushregs
-This command forces @value{GDBN} to flush its internal register cache.
+Flush the contents of the register cache and as a consequence the
+frame cache.  This command is useful when debugging issues related to
+register fetching, or frame unwinding.  The command @code{flushregs}
+is an alias for @code{maint flush register-cache} that exists for
+backward compatibility with older versions of @value{GDBN}.
 
 @kindex maint print objfiles
 @cindex info for known object files
diff --git a/gdb/maint.c b/gdb/maint.c
index e8cdda3da0e..5b83cf2ae72 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -1083,6 +1083,11 @@ lists all sections from all object files, including shared libraries."),
 			&maintenanceprintlist, "maintenance print ", 0,
 			&maintenancelist);
 
+  add_basic_prefix_cmd ("flush", class_maintenance,
+			_("Maintenance command for flushing GDB internal caches."),
+			&maintenanceflushlist, "maintenance flush ", 0,
+			&maintenancelist);
+
   add_basic_prefix_cmd ("set", class_maintenance, _("\
 Set GDB internal variables used by the GDB maintainer.\n\
 Configure variables internal to GDB that aid in GDB's maintenance"),
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 91d3202b94b..7985df0a776 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -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)
 {
@@ -2082,8 +2085,12 @@ _initialize_regcache ()
   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);
+  /* This alias exists for backwards compatibility.  */
+  add_com_alias ("flushregs", "maintenance flush register-cache",
+		 class_maintenance, 0);
 
 #if GDB_SELF_TEST
   selftests::register_test ("get_thread_arch_aspace_regcache",
diff --git a/gdb/symtab.c b/gdb/symtab.c
index dccc3d1e237..b7d0e70f4a7 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -42,6 +42,7 @@
 #include "addrmap.h"
 #include "cli/cli-utils.h"
 #include "cli/cli-style.h"
+#include "cli/cli-cmds.h"
 #include "fnmatch.h"
 #include "hashtab.h"
 #include "typeprint.h"
@@ -6929,10 +6930,13 @@ If zero then the symbol cache is disabled."),
 	   _("Print symbol cache statistics for each program space."),
 	   &maintenanceprintlist);
 
-  add_cmd ("flush-symbol-cache", class_maintenance,
+  add_cmd ("symbol-cache", class_maintenance,
 	   maintenance_flush_symbol_cache,
 	   _("Flush the symbol cache for each program space."),
-	   &maintenancelist);
+	   &maintenanceflushlist);
+  /* This alias exists for backwards compatibility.  */
+  add_alias_cmd ("flush-symbol-cache", "flush symbol-cache", class_maintenance, 0,
+		 &maintenancelist);
 
   gdb::observers::executable_changed.attach (symtab_observer_executable_changed);
   gdb::observers::new_objfile.attach (symtab_new_objfile_observer);
diff --git a/gdb/testsuite/gdb.base/c-linkage-name.exp b/gdb/testsuite/gdb.base/c-linkage-name.exp
index 6b0a014949e..c6b3b509df6 100644
--- a/gdb/testsuite/gdb.base/c-linkage-name.exp
+++ b/gdb/testsuite/gdb.base/c-linkage-name.exp
@@ -64,7 +64,7 @@ gdb_test "maint info symtabs" "\{ symtab \[^\r\n\]*c-linkage-name-2.c.*"
 
 # Flush the symbol cache to prevent the lookup to return the same as before.
 
-gdb_test "maint flush-symbol-cache"
+gdb_test "maint flush symbol-cache"
 
 # Try to print MUNDANE using its linkage name again, after partial
 # symtab expansion.
diff --git a/gdb/testsuite/gdb.base/killed-outside.exp b/gdb/testsuite/gdb.base/killed-outside.exp
index 3e20ad67cee..645b41f4867 100644
--- a/gdb/testsuite/gdb.base/killed-outside.exp
+++ b/gdb/testsuite/gdb.base/killed-outside.exp
@@ -115,7 +115,7 @@ with_test_prefix "stepi" {
 # other commands would trigger.
 with_test_prefix "registers" {
     test {
-	gdb_test "flushregs" ".*"
+	gdb_test "maint flush register-cache" ".*"
 	gdb_test "info threads" ".*"
     }
 }
diff --git a/gdb/testsuite/gdb.opt/inline-bt.exp b/gdb/testsuite/gdb.opt/inline-bt.exp
index d428c396359..109627c2306 100644
--- a/gdb/testsuite/gdb.opt/inline-bt.exp
+++ b/gdb/testsuite/gdb.opt/inline-bt.exp
@@ -61,7 +61,7 @@ gdb_test "info frame" ".*inlined into frame.*" "func2 inlined (3)"
 # function.
 gdb_test_no_output "set backtrace limit 2"
 # Force flushing the frame cache.
-gdb_test "flushregs" "Register cache flushed."
+gdb_test "maint flush register-cache" "Register cache flushed."
 gdb_test "up" "#1  .*func1.*" "up from bar (4)"
 gdb_test "info frame" ".*in func1.*" "info frame still works"
 # Verify the user visible limit works as expected.
diff --git a/gdb/testsuite/gdb.perf/gmonster-null-lookup.py b/gdb/testsuite/gdb.perf/gmonster-null-lookup.py
index eaf4b11c9f8..f4ce1ea55e9 100644
--- a/gdb/testsuite/gdb.perf/gmonster-null-lookup.py
+++ b/gdb/testsuite/gdb.perf/gmonster-null-lookup.py
@@ -40,7 +40,7 @@ class NullLookup(perftest.TestCaseWithBasicMeasurements):
             utils.safe_execute("mt expand-symtabs")
             iteration = 5
             while iteration > 0:
-                utils.safe_execute("mt flush-symbol-cache")
+                utils.safe_execute("mt flush symbol-cache")
                 func = lambda: utils.safe_execute("p symbol_not_found")
                 self.measure.measure(func, run)
                 iteration -= 1
diff --git a/gdb/testsuite/gdb.perf/gmonster-print-cerr.py b/gdb/testsuite/gdb.perf/gmonster-print-cerr.py
index 796380dcacd..adee2e601aa 100644
--- a/gdb/testsuite/gdb.perf/gmonster-print-cerr.py
+++ b/gdb/testsuite/gdb.perf/gmonster-print-cerr.py
@@ -46,7 +46,7 @@ class PrintCerr(perftest.TestCaseWithBasicMeasurements):
             utils.runto_main()
             iteration = 5
             while iteration > 0:
-                utils.safe_execute("mt flush-symbol-cache")
+                utils.safe_execute("mt flush symbol-cache")
                 func = lambda: utils.safe_execute("print gm_std::cerr")
                 self.measure.measure(func, run)
                 iteration -= 1
diff --git a/gdb/testsuite/gdb.perf/gmonster-ptype-string.py b/gdb/testsuite/gdb.perf/gmonster-ptype-string.py
index 78fa3dfd432..aa5513547e5 100644
--- a/gdb/testsuite/gdb.perf/gmonster-ptype-string.py
+++ b/gdb/testsuite/gdb.perf/gmonster-ptype-string.py
@@ -41,7 +41,7 @@ class GmonsterPtypeString(perftest.TestCaseWithBasicMeasurements):
             utils.safe_execute("mt expand-symtabs")
             iteration = 5
             while iteration > 0:
-                utils.safe_execute("mt flush-symbol-cache")
+                utils.safe_execute("mt flush symbol-cache")
                 func1 = lambda: utils.safe_execute("ptype hello")
                 func = lambda: utils.run_n_times(2, func1)
                 self.measure.measure(func, run)
diff --git a/gdb/testsuite/gdb.python/py-unwind.exp b/gdb/testsuite/gdb.python/py-unwind.exp
index 4ef63bf965c..e8ae8632a8e 100644
--- a/gdb/testsuite/gdb.python/py-unwind.exp
+++ b/gdb/testsuite/gdb.python/py-unwind.exp
@@ -57,4 +57,4 @@ gdb_test_sequence "where"  "Backtrace restored by unwinder" {
 }
 
 # Check that the Python unwinder frames can be flushed / released.
-gdb_test "flushregs" "Register cache flushed\\." "flush frames"
+gdb_test "maint flush register-cache" "Register cache flushed\\." "flush frames"
-- 
2.25.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/2] gdb: new command 'maint flush dcache'
  2020-11-23 10:39 [PATCH 0/2] Organise maintenance commands that flush caches Andrew Burgess
  2020-11-23 10:39 ` [PATCH 1/2] gdb: introduce new 'maint flush ' prefix command Andrew Burgess
@ 2020-11-23 10:39 ` Andrew Burgess
  2020-11-23 15:28   ` Eli Zaretskii
  2020-11-23 16:28   ` Luis Machado
  1 sibling, 2 replies; 9+ messages in thread
From: Andrew Burgess @ 2020-11-23 10:39 UTC (permalink / raw)
  To: gdb-patches

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.
---
 gdb/ChangeLog                           |  8 ++++
 gdb/NEWS                                |  3 ++
 gdb/doc/ChangeLog                       |  5 ++
 gdb/doc/gdb.texinfo                     |  6 +++
 gdb/target-dcache.c                     | 19 ++++++++
 gdb/testsuite/ChangeLog                 |  5 ++
 gdb/testsuite/gdb.base/dcache-flush.c   | 33 +++++++++++++
 gdb/testsuite/gdb.base/dcache-flush.exp | 64 +++++++++++++++++++++++++
 8 files changed, 143 insertions(+)
 create mode 100644 gdb/testsuite/gdb.base/dcache-flush.c
 create mode 100644 gdb/testsuite/gdb.base/dcache-flush.exp

diff --git a/gdb/NEWS b/gdb/NEWS
index b07b054223f..ef59c7c1e69 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -32,6 +32,9 @@ maintenance flush register-cache
   These new commands are equivalent to the already existing commands
   'maintenance flush-symbol-cache' and 'flushregs' respectively.
 
+maintenance flush dcache
+  A new command to flush the dcache.
+
 * Changed commands
 
 break [PROBE_MODIFIER] [LOCATION] [thread THREADNUM]
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 3745aa52973..7017823ef75 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -13494,6 +13494,12 @@
 @kindex show dcache line-size
 Show default size of dcache lines.
 
+@item maint flush dcache
+@cindex dcache, flushing
+@kindex maint flush dcache
+Flush the contents (if any) of the dcache.  This maintainer command is
+useful when debugging the dcache implementation.
+
 @end table
 
 @node Searching Memory
diff --git a/gdb/target-dcache.c b/gdb/target-dcache.c
index 0226d672780..90b60f62f2e 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);
 }
diff --git a/gdb/testsuite/gdb.base/dcache-flush.c b/gdb/testsuite/gdb.base/dcache-flush.c
new file mode 100644
index 00000000000..b512ea31760
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dcache-flush.c
@@ -0,0 +1,33 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2020 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+int __attribute__((noinline))
+func (int *v1, int *v2)
+{
+  return *v1 - *v2 - 1;
+}
+
+int
+main ()
+{
+  int var1 = 4;
+  int var2 = 3;
+  int res;
+
+  res = func (&var1, &var2);
+  return res;
+}
diff --git a/gdb/testsuite/gdb.base/dcache-flush.exp b/gdb/testsuite/gdb.base/dcache-flush.exp
new file mode 100644
index 00000000000..6c7d2f4bef8
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dcache-flush.exp
@@ -0,0 +1,64 @@
+# Copyright 2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test that the dcache can be flushed.
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" ${testfile}] } {
+    return -1
+}
+
+if ![runto func] {
+    return -1
+}
+
+gdb_test "up" ".* main .*"
+gdb_test "p var1" " = 4"
+gdb_test "p var2" " = 3"
+
+# By reading var1 and var2 we should have at least one line in the
+# dcache.
+gdb_test "info dcache" \
+    [multi_line \
+	 "Dcache $decimal lines of $decimal bytes each." \
+	 "Contains data for process $decimal" \
+	 "Line 0: address $hex \[$decimal hits\].*" \
+	 "Cache state: $decimal active lines, $decimal hits" ] \
+    "check dcache before flushing"
+
+# Flush the dcache.
+gdb_test "maint flush dcache" "The dcache was flushed\."
+
+# Check the dcache is now empty.
+gdb_test "info dcache" \
+    [multi_line  "Dcache $decimal lines of $decimal bytes each." \
+	 "No data cache available." ] \
+    "check dcache after flushing"
+
+# Read the stack variables again, refilling the dcache.
+with_test_prefix "refilling" {
+    gdb_test "p var1" " = 4"
+    gdb_test "p var2" " = 3"
+}
+
+# And check we have some content back in the dcache.
+gdb_test "info dcache" \
+    [multi_line \
+	 "Dcache $decimal lines of $decimal bytes each." \
+	 "Contains data for process $decimal" \
+	 "Line 0: address $hex \[$decimal hits\].*" \
+	 "Cache state: $decimal active lines, $decimal hits" ] \
+    "check dcache before refilling"
-- 
2.25.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] gdb: introduce new 'maint flush ' prefix command
  2020-11-23 10:39 ` [PATCH 1/2] gdb: introduce new 'maint flush ' prefix command Andrew Burgess
@ 2020-11-23 15:28   ` Eli Zaretskii
  2020-11-23 16:24   ` Luis Machado
  1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2020-11-23 15:28 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Date: Mon, 23 Nov 2020 10:39:36 +0000
> 
> diff --git a/gdb/NEWS b/gdb/NEWS
> index d1f721c3953..b07b054223f 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -27,6 +27,11 @@ set debug event-loop
>  show debug event-loop
>    Control the display of debug output about GDB's event loop.
>  
> +maintenance flush symbol-cache
> +maintenance flush register-cache
> +  These new commands are equivalent to the already existing commands
> +  'maintenance flush-symbol-cache' and 'flushregs' respectively.
> +
>  * Changed commands

This part is OK.

> +@kindex maint flush symbol-cache
>  @kindex maint flush-symbol-cache
>  @cindex symbol cache, flushing
> +@item maint flush symbol-cache
>  @item maint flush-symbol-cache

You cannot have more than 1 @item in a row.  All but the first one
have to be @itemx instead.

> +@kindex maint flush register-cache
>  @kindex flushregs
> +@cindex register cache, flushing
> +@item maint flush register-cache
>  @item flushregs

Same here.

The documentation parts are okay with this nit fixed.  Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] gdb: new command 'maint flush dcache'
  2020-11-23 10:39 ` [PATCH 2/2] gdb: new command 'maint flush dcache' Andrew Burgess
@ 2020-11-23 15:28   ` Eli Zaretskii
  2020-11-23 16:28   ` Luis Machado
  1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2020-11-23 15:28 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Date: Mon, 23 Nov 2020 10:39:37 +0000
> 
> 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.

Thanks, the documentation parts are OK.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] gdb: introduce new 'maint flush ' prefix command
  2020-11-23 10:39 ` [PATCH 1/2] gdb: introduce new 'maint flush ' prefix command Andrew Burgess
  2020-11-23 15:28   ` Eli Zaretskii
@ 2020-11-23 16:24   ` Luis Machado
  2020-12-03 17:23     ` Tom Tromey
  1 sibling, 1 reply; 9+ messages in thread
From: Luis Machado @ 2020-11-23 16:24 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches

On 11/23/20 7:39 AM, Andrew Burgess wrote:
> 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 aliases to the new commands.
> 
> I've updated the testsuite to use the new command syntax, and updated
> the documentation too.

Should we keep testing the alias in some way though? I see the testcases 
have been updated to only use the new command. We should certify that 
the old ones still exist and work?

If we plan to drop the old commands at some point (I think it makes 
sense), we should probably mark them as deprecated with a set removal date.

> 
> gdb/ChangeLog:
> 
> 	* NEWS: Mention new commands.
> 	* 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.
> ---
>   gdb/ChangeLog                                 | 15 ++++++++++++++
>   gdb/NEWS                                      |  5 +++++
>   gdb/cli/cli-cmds.c                            |  4 ++++
>   gdb/cli/cli-cmds.h                            |  4 ++++
>   gdb/doc/ChangeLog                             |  5 +++++
>   gdb/doc/gdb.texinfo                           | 20 +++++++++++++++----
>   gdb/maint.c                                   |  5 +++++
>   gdb/regcache.c                                | 11 ++++++++--
>   gdb/symtab.c                                  |  8 ++++++--
>   gdb/testsuite/ChangeLog                       | 11 ++++++++++
>   gdb/testsuite/gdb.base/c-linkage-name.exp     |  2 +-
>   gdb/testsuite/gdb.base/killed-outside.exp     |  2 +-
>   gdb/testsuite/gdb.opt/inline-bt.exp           |  2 +-
>   .../gdb.perf/gmonster-null-lookup.py          |  2 +-
>   gdb/testsuite/gdb.perf/gmonster-print-cerr.py |  2 +-
>   .../gdb.perf/gmonster-ptype-string.py         |  2 +-
>   gdb/testsuite/gdb.python/py-unwind.exp        |  2 +-
>   17 files changed, 87 insertions(+), 15 deletions(-)
> 
> diff --git a/gdb/NEWS b/gdb/NEWS
> index d1f721c3953..b07b054223f 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -27,6 +27,11 @@ set debug event-loop
>   show debug event-loop
>     Control the display of debug output about GDB's event loop.
>   
> +maintenance flush symbol-cache
> +maintenance flush register-cache
> +  These new commands are equivalent to the already existing command > +  'maintenance flush-symbol-cache' and 'flushregs' respectively.
> +

Not a native speaker, but "already existing" sounds a bit verbose. Would 
existing suffice? Also, probably "existing commands" rather than 
"existing command"?

>   * Changed commands
>   
>   break [PROBE_MODIFIER] [LOCATION] [thread THREADNUM]
> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
> index 54822fad481..88c83cd6319 100644
> --- a/gdb/cli/cli-cmds.c
> +++ b/gdb/cli/cli-cmds.c
> @@ -151,6 +151,10 @@ struct cmd_list_element *maintenanceprintlist;
>   
>   struct cmd_list_element *maintenancechecklist;
>   
> +/* Chain containing all defined "maintenance flush" subcommands.  */
> +
> +struct cmd_list_element *maintenanceflushlist;
> +
>   struct cmd_list_element *setprintlist;
>   
>   struct cmd_list_element *showprintlist;
> diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
> index 1d641520bf5..976cea07806 100644
> --- a/gdb/cli/cli-cmds.h
> +++ b/gdb/cli/cli-cmds.h
> @@ -89,6 +89,10 @@ extern struct cmd_list_element *maintenanceinfolist;
>   
>   extern struct cmd_list_element *maintenanceprintlist;
>   
> +/* Chain containing all defined "maintenance flush" subcommands.  */
> +
> +extern struct cmd_list_element *maintenanceflushlist;
> +
>   extern struct cmd_list_element *setprintlist;
>   
>   extern struct cmd_list_element *showprintlist;
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 01dcac941c2..3745aa52973 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -19503,12 +19503,17 @@
>   Print symbol cache usage statistics.
>   This helps determine how well the cache is being utilized.
>   
> +@kindex maint flush symbol-cache
>   @kindex maint flush-symbol-cache
>   @cindex symbol cache, flushing
> +@item maint flush symbol-cache
>   @item maint flush-symbol-cache
> -Flush the contents of the symbol cache, all entries are removed.
> -This command is useful when debugging the symbol cache.
> -It is also useful when collecting performance data.
> +Flush the contents of the symbol cache, all entries are removed.  This
> +command is useful when debugging the symbol cache.  It is also useful
> +when collecting performance data.  The command @code{maint
> +flush-symbol-cache} is an alias for @code{maint flush symbol-cache}
> +that exists for backward compatibility with older versions of
> +@value{GDBN}.
>   
>   @end table
>   
> @@ -38859,9 +38864,16 @@
>    restore    internal
>   @end smallexample
>   
> +@kindex maint flush register-cache
>   @kindex flushregs
> +@cindex register cache, flushing
> +@item maint flush register-cache
>   @item flushregs
> -This command forces @value{GDBN} to flush its internal register cache.
> +Flush the contents of the register cache and as a consequence the
> +frame cache.  This command is useful when debugging issues related to
> +register fetching, or frame unwinding.  The command @code{flushregs}
> +is an alias for @code{maint flush register-cache} that exists for
> +backward compatibility with older versions of @value{GDBN}.
>   
>   @kindex maint print objfiles
>   @cindex info for known object files
> diff --git a/gdb/maint.c b/gdb/maint.c
> index e8cdda3da0e..5b83cf2ae72 100644
> --- a/gdb/maint.c
> +++ b/gdb/maint.c
> @@ -1083,6 +1083,11 @@ lists all sections from all object files, including shared libraries."),
>   			&maintenanceprintlist, "maintenance print ", 0,
>   			&maintenancelist);
>   
> +  add_basic_prefix_cmd ("flush", class_maintenance,
> +			_("Maintenance command for flushing GDB internal caches."),
> +			&maintenanceflushlist, "maintenance flush ", 0,
> +			&maintenancelist);
> +
>     add_basic_prefix_cmd ("set", class_maintenance, _("\
>   Set GDB internal variables used by the GDB maintainer.\n\
>   Configure variables internal to GDB that aid in GDB's maintenance"),
> diff --git a/gdb/regcache.c b/gdb/regcache.c
> index 91d3202b94b..7985df0a776 100644
> --- a/gdb/regcache.c
> +++ b/gdb/regcache.c
> @@ -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.  */
> +

Implement "the ... command"?

>   static void
>   reg_flush_command (const char *command, int from_tty)
>   {
> @@ -2082,8 +2085,12 @@ _initialize_regcache ()
>     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);
> +  /* This alias exists for backwards compatibility.  */
> +  add_com_alias ("flushregs", "maintenance flush register-cache",
> +		 class_maintenance, 0);
>   
>   #if GDB_SELF_TEST
>     selftests::register_test ("get_thread_arch_aspace_regcache",
> diff --git a/gdb/symtab.c b/gdb/symtab.c
> index dccc3d1e237..b7d0e70f4a7 100644
> --- a/gdb/symtab.c
> +++ b/gdb/symtab.c
> @@ -42,6 +42,7 @@
>   #include "addrmap.h"
>   #include "cli/cli-utils.h"
>   #include "cli/cli-style.h"
> +#include "cli/cli-cmds.h"
>   #include "fnmatch.h"
>   #include "hashtab.h"
>   #include "typeprint.h"
> @@ -6929,10 +6930,13 @@ If zero then the symbol cache is disabled."),
>   	   _("Print symbol cache statistics for each program space."),
>   	   &maintenanceprintlist);
>   
> -  add_cmd ("flush-symbol-cache", class_maintenance,
> +  add_cmd ("symbol-cache", class_maintenance,
>   	   maintenance_flush_symbol_cache,
>   	   _("Flush the symbol cache for each program space."),
> -	   &maintenancelist);
> +	   &maintenanceflushlist);
> +  /* This alias exists for backwards compatibility.  */
> +  add_alias_cmd ("flush-symbol-cache", "flush symbol-cache", class_maintenance, 0,
> +		 &maintenancelist);
>   
>     gdb::observers::executable_changed.attach (symtab_observer_executable_changed);
>     gdb::observers::new_objfile.attach (symtab_new_objfile_observer);
> diff --git a/gdb/testsuite/gdb.base/c-linkage-name.exp b/gdb/testsuite/gdb.base/c-linkage-name.exp
> index 6b0a014949e..c6b3b509df6 100644
> --- a/gdb/testsuite/gdb.base/c-linkage-name.exp
> +++ b/gdb/testsuite/gdb.base/c-linkage-name.exp
> @@ -64,7 +64,7 @@ gdb_test "maint info symtabs" "\{ symtab \[^\r\n\]*c-linkage-name-2.c.*"
>   
>   # Flush the symbol cache to prevent the lookup to return the same as before.
>   
> -gdb_test "maint flush-symbol-cache"
> +gdb_test "maint flush symbol-cache"
>   
>   # Try to print MUNDANE using its linkage name again, after partial
>   # symtab expansion.
> diff --git a/gdb/testsuite/gdb.base/killed-outside.exp b/gdb/testsuite/gdb.base/killed-outside.exp
> index 3e20ad67cee..645b41f4867 100644
> --- a/gdb/testsuite/gdb.base/killed-outside.exp
> +++ b/gdb/testsuite/gdb.base/killed-outside.exp
> @@ -115,7 +115,7 @@ with_test_prefix "stepi" {
>   # other commands would trigger.
>   with_test_prefix "registers" {
>       test {
> -	gdb_test "flushregs" ".*"
> +	gdb_test "maint flush register-cache" ".*"
>   	gdb_test "info threads" ".*"
>       }
>   }
> diff --git a/gdb/testsuite/gdb.opt/inline-bt.exp b/gdb/testsuite/gdb.opt/inline-bt.exp
> index d428c396359..109627c2306 100644
> --- a/gdb/testsuite/gdb.opt/inline-bt.exp
> +++ b/gdb/testsuite/gdb.opt/inline-bt.exp
> @@ -61,7 +61,7 @@ gdb_test "info frame" ".*inlined into frame.*" "func2 inlined (3)"
>   # function.
>   gdb_test_no_output "set backtrace limit 2"
>   # Force flushing the frame cache.
> -gdb_test "flushregs" "Register cache flushed."
> +gdb_test "maint flush register-cache" "Register cache flushed."
>   gdb_test "up" "#1  .*func1.*" "up from bar (4)"
>   gdb_test "info frame" ".*in func1.*" "info frame still works"
>   # Verify the user visible limit works as expected.
> diff --git a/gdb/testsuite/gdb.perf/gmonster-null-lookup.py b/gdb/testsuite/gdb.perf/gmonster-null-lookup.py
> index eaf4b11c9f8..f4ce1ea55e9 100644
> --- a/gdb/testsuite/gdb.perf/gmonster-null-lookup.py
> +++ b/gdb/testsuite/gdb.perf/gmonster-null-lookup.py
> @@ -40,7 +40,7 @@ class NullLookup(perftest.TestCaseWithBasicMeasurements):
>               utils.safe_execute("mt expand-symtabs")
>               iteration = 5
>               while iteration > 0:
> -                utils.safe_execute("mt flush-symbol-cache")
> +                utils.safe_execute("mt flush symbol-cache")
>                   func = lambda: utils.safe_execute("p symbol_not_found")
>                   self.measure.measure(func, run)
>                   iteration -= 1
> diff --git a/gdb/testsuite/gdb.perf/gmonster-print-cerr.py b/gdb/testsuite/gdb.perf/gmonster-print-cerr.py
> index 796380dcacd..adee2e601aa 100644
> --- a/gdb/testsuite/gdb.perf/gmonster-print-cerr.py
> +++ b/gdb/testsuite/gdb.perf/gmonster-print-cerr.py
> @@ -46,7 +46,7 @@ class PrintCerr(perftest.TestCaseWithBasicMeasurements):
>               utils.runto_main()
>               iteration = 5
>               while iteration > 0:
> -                utils.safe_execute("mt flush-symbol-cache")
> +                utils.safe_execute("mt flush symbol-cache")
>                   func = lambda: utils.safe_execute("print gm_std::cerr")
>                   self.measure.measure(func, run)
>                   iteration -= 1
> diff --git a/gdb/testsuite/gdb.perf/gmonster-ptype-string.py b/gdb/testsuite/gdb.perf/gmonster-ptype-string.py
> index 78fa3dfd432..aa5513547e5 100644
> --- a/gdb/testsuite/gdb.perf/gmonster-ptype-string.py
> +++ b/gdb/testsuite/gdb.perf/gmonster-ptype-string.py
> @@ -41,7 +41,7 @@ class GmonsterPtypeString(perftest.TestCaseWithBasicMeasurements):
>               utils.safe_execute("mt expand-symtabs")
>               iteration = 5
>               while iteration > 0:
> -                utils.safe_execute("mt flush-symbol-cache")
> +                utils.safe_execute("mt flush symbol-cache")
>                   func1 = lambda: utils.safe_execute("ptype hello")
>                   func = lambda: utils.run_n_times(2, func1)
>                   self.measure.measure(func, run)
> diff --git a/gdb/testsuite/gdb.python/py-unwind.exp b/gdb/testsuite/gdb.python/py-unwind.exp
> index 4ef63bf965c..e8ae8632a8e 100644
> --- a/gdb/testsuite/gdb.python/py-unwind.exp
> +++ b/gdb/testsuite/gdb.python/py-unwind.exp
> @@ -57,4 +57,4 @@ gdb_test_sequence "where"  "Backtrace restored by unwinder" {
>   }
>   
>   # Check that the Python unwinder frames can be flushed / released.
> -gdb_test "flushregs" "Register cache flushed\\." "flush frames"
> +gdb_test "maint flush register-cache" "Register cache flushed\\." "flush frames"
> 

Otherwise LGTM.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] gdb: new command 'maint flush dcache'
  2020-11-23 10:39 ` [PATCH 2/2] gdb: new command 'maint flush dcache' Andrew Burgess
  2020-11-23 15:28   ` Eli Zaretskii
@ 2020-11-23 16:28   ` Luis Machado
  1 sibling, 0 replies; 9+ messages in thread
From: Luis Machado @ 2020-11-23 16:28 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches

On 11/23/20 7:39 AM, Andrew Burgess wrote:
> 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.
> ---
>   gdb/ChangeLog                           |  8 ++++
>   gdb/NEWS                                |  3 ++
>   gdb/doc/ChangeLog                       |  5 ++
>   gdb/doc/gdb.texinfo                     |  6 +++
>   gdb/target-dcache.c                     | 19 ++++++++
>   gdb/testsuite/ChangeLog                 |  5 ++
>   gdb/testsuite/gdb.base/dcache-flush.c   | 33 +++++++++++++
>   gdb/testsuite/gdb.base/dcache-flush.exp | 64 +++++++++++++++++++++++++
>   8 files changed, 143 insertions(+)
>   create mode 100644 gdb/testsuite/gdb.base/dcache-flush.c
>   create mode 100644 gdb/testsuite/gdb.base/dcache-flush.exp
> 
> diff --git a/gdb/NEWS b/gdb/NEWS
> index b07b054223f..ef59c7c1e69 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -32,6 +32,9 @@ maintenance flush register-cache
>     These new commands are equivalent to the already existing commands
>     'maintenance flush-symbol-cache' and 'flushregs' respectively.
>   
> +maintenance flush dcache
> +  A new command to flush the dcache.
> +
>   * Changed commands
>   
>   break [PROBE_MODIFIER] [LOCATION] [thread THREADNUM]
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 3745aa52973..7017823ef75 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -13494,6 +13494,12 @@
>   @kindex show dcache line-size
>   Show default size of dcache lines.
>   
> +@item maint flush dcache
> +@cindex dcache, flushing
> +@kindex maint flush dcache
> +Flush the contents (if any) of the dcache.  This maintainer command is
> +useful when debugging the dcache implementation.
> +
>   @end table
>   
>   @node Searching Memory
> diff --git a/gdb/target-dcache.c b/gdb/target-dcache.c
> index 0226d672780..90b60f62f2e 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);
>   }
> diff --git a/gdb/testsuite/gdb.base/dcache-flush.c b/gdb/testsuite/gdb.base/dcache-flush.c
> new file mode 100644
> index 00000000000..b512ea31760
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/dcache-flush.c
> @@ -0,0 +1,33 @@
> +/* This testcase is part of GDB, the GNU debugger.
> +
> +   Copyright 2020 Free Software Foundation, Inc.
> +
> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 3 of the License, or
> +   (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
> +
> +int __attribute__((noinline))
> +func (int *v1, int *v2)
> +{
> +  return *v1 - *v2 - 1;
> +}
> +
> +int
> +main ()
> +{
> +  int var1 = 4;
> +  int var2 = 3;
> +  int res;
> +
> +  res = func (&var1, &var2);
> +  return res;
> +}
> diff --git a/gdb/testsuite/gdb.base/dcache-flush.exp b/gdb/testsuite/gdb.base/dcache-flush.exp
> new file mode 100644
> index 00000000000..6c7d2f4bef8
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/dcache-flush.exp
> @@ -0,0 +1,64 @@
> +# Copyright 2020 Free Software Foundation, Inc.
> +
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +# Test that the dcache can be flushed.
> +
> +standard_testfile
> +
> +if { [prepare_for_testing "failed to prepare" ${testfile}] } {
> +    return -1
> +}
> +
> +if ![runto func] {
> +    return -1
> +}
> +
> +gdb_test "up" ".* main .*"
> +gdb_test "p var1" " = 4"
> +gdb_test "p var2" " = 3"
> +
> +# By reading var1 and var2 we should have at least one line in the
> +# dcache.
> +gdb_test "info dcache" \
> +    [multi_line \
> +	 "Dcache $decimal lines of $decimal bytes each." \
> +	 "Contains data for process $decimal" \
> +	 "Line 0: address $hex \[$decimal hits\].*" \
> +	 "Cache state: $decimal active lines, $decimal hits" ] \
> +    "check dcache before flushing"
> +
> +# Flush the dcache.
> +gdb_test "maint flush dcache" "The dcache was flushed\."
> +
> +# Check the dcache is now empty.
> +gdb_test "info dcache" \
> +    [multi_line  "Dcache $decimal lines of $decimal bytes each." \
> +	 "No data cache available." ] \
> +    "check dcache after flushing"
> +
> +# Read the stack variables again, refilling the dcache.
> +with_test_prefix "refilling" {
> +    gdb_test "p var1" " = 4"
> +    gdb_test "p var2" " = 3"
> +}
> +
> +# And check we have some content back in the dcache.
> +gdb_test "info dcache" \
> +    [multi_line \
> +	 "Dcache $decimal lines of $decimal bytes each." \
> +	 "Contains data for process $decimal" \
> +	 "Line 0: address $hex \[$decimal hits\].*" \
> +	 "Cache state: $decimal active lines, $decimal hits" ] \
> +    "check dcache before refilling"
> 

LGTM

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] gdb: introduce new 'maint flush ' prefix command
  2020-11-23 16:24   ` Luis Machado
@ 2020-12-03 17:23     ` Tom Tromey
  2020-12-13 12:43       ` Andrew Burgess
  0 siblings, 1 reply; 9+ messages in thread
From: Tom Tromey @ 2020-12-03 17:23 UTC (permalink / raw)
  To: Luis Machado via Gdb-patches

Luis> Should we keep testing the alias in some way though? I see the
Luis> testcases have been updated to only use the new command. We should
Luis> certify that the old ones still exist and work?

I'm ok with not adding a test in this case, since it's a deprecated
alias of a maintenance command.

Luis> If we plan to drop the old commands at some point (I think it makes
Luis> sense), we should probably mark them as deprecated with a set removal
Luis> date.

Definitely agreed about deprecation.

We haven't normally set dates before, but it seems like a good idea.
Normally deprecated things just stick around more or less forever.

Tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] gdb: introduce new 'maint flush ' prefix command
  2020-12-03 17:23     ` Tom Tromey
@ 2020-12-13 12:43       ` Andrew Burgess
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Burgess @ 2020-12-13 12:43 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey, Luis Machado

* Tom Tromey <tom@tromey.com> [2020-12-03 10:23:52 -0700]:

> Luis> Should we keep testing the alias in some way though? I see the
> Luis> testcases have been updated to only use the new command. We should
> Luis> certify that the old ones still exist and work?
> 
> I'm ok with not adding a test in this case, since it's a deprecated
> alias of a maintenance command.
> 
> Luis> If we plan to drop the old commands at some point (I think it makes
> Luis> sense), we should probably mark them as deprecated with a set removal
> Luis> date.
> 
> Definitely agreed about deprecation.
> 
> We haven't normally set dates before, but it seems like a good idea.
> Normally deprecated things just stick around more or less forever.

Luis/Tom,

Thanks for the feedback.  I marked the aliases (that replaced the old
commands) as deprecated, and updated the NEWS file to mention this.

As Tom points out we've never really set dates for removing things
(though I do think doing so would be a good thing), and we have a
non-zero set of existing aliases and commands that are marked as
deprecated.

Maybe we should have a discussion about if/when these things should be
removed, but I don't want to tie making that policy in with this
patch.

Below is what I eventually pushed.

Thanks,
Andrew

---

commit 50a5f1878e22b09ebea30ad60a2164b80af6efdb
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Fri Nov 20 19:08:06 2020 +0000

    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.

diff --git a/gdb/NEWS b/gdb/NEWS
index d75992e78ef..4d963880cb3 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -39,6 +39,11 @@ set debug event-loop
 show debug event-loop
   Control the display of debug output about GDB's event loop.
 
+maintenance flush symbol-cache
+maintenance flush register-cache
+  These new commands are equivalent to the already existing commands
+  'maintenance flush-symbol-cache' and 'flushregs' respectively.
+
 * Changed commands
 
 break [PROBE_MODIFIER] [LOCATION] [thread THREADNUM]
@@ -61,6 +66,12 @@ condition [-force] N COND
   GDB into defining the condition even when COND is invalid for all the
   current locations of breakpoint N.
 
+flushregs
+maintenance flush-symbol-cache
+  These commands are deprecated in favor of the new commands
+  'maintenance flush register-cache' and 'maintenance flush
+  symbol-cache' respectively.
+
 *** Changes in GDB 10
 
 * There are new feature names for ARC targets: "org.gnu.gdb.arc.core"
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 54822fad481..88c83cd6319 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -151,6 +151,10 @@ struct cmd_list_element *maintenanceprintlist;
 
 struct cmd_list_element *maintenancechecklist;
 
+/* Chain containing all defined "maintenance flush" subcommands.  */
+
+struct cmd_list_element *maintenanceflushlist;
+
 struct cmd_list_element *setprintlist;
 
 struct cmd_list_element *showprintlist;
diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
index 1d641520bf5..976cea07806 100644
--- a/gdb/cli/cli-cmds.h
+++ b/gdb/cli/cli-cmds.h
@@ -89,6 +89,10 @@ extern struct cmd_list_element *maintenanceinfolist;
 
 extern struct cmd_list_element *maintenanceprintlist;
 
+/* Chain containing all defined "maintenance flush" subcommands.  */
+
+extern struct cmd_list_element *maintenanceflushlist;
+
 extern struct cmd_list_element *setprintlist;
 
 extern struct cmd_list_element *showprintlist;
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 01dcac941c2..5bafb9d11cd 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -19503,12 +19503,16 @@
 Print symbol cache usage statistics.
 This helps determine how well the cache is being utilized.
 
+@kindex maint flush symbol-cache
 @kindex maint flush-symbol-cache
 @cindex symbol cache, flushing
-@item maint flush-symbol-cache
-Flush the contents of the symbol cache, all entries are removed.
-This command is useful when debugging the symbol cache.
-It is also useful when collecting performance data.
+@item maint flush symbol-cache
+@itemx maint flush-symbol-cache
+Flush the contents of the symbol cache, all entries are removed.  This
+command is useful when debugging the symbol cache.  It is also useful
+when collecting performance data.  The command @code{maint
+flush-symbol-cache} is deprecated in favor of @code{maint flush
+symbol-cache}..
 
 @end table
 
@@ -38859,9 +38863,15 @@
  restore    internal
 @end smallexample
 
+@kindex maint flush register-cache
 @kindex flushregs
-@item flushregs
-This command forces @value{GDBN} to flush its internal register cache.
+@cindex register cache, flushing
+@item maint flush register-cache
+@itemx flushregs
+Flush the contents of the register cache and as a consequence the
+frame cache.  This command is useful when debugging issues related to
+register fetching, or frame unwinding.  The command @code{flushregs}
+is deprecated in favor of @code{maint flush register-cache}.
 
 @kindex maint print objfiles
 @cindex info for known object files
diff --git a/gdb/maint.c b/gdb/maint.c
index 56319600ed8..ac2431562d3 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -1083,6 +1083,11 @@ lists all sections from all object files, including shared libraries."),
 			&maintenanceprintlist, "maintenance print ", 0,
 			&maintenancelist);
 
+  add_basic_prefix_cmd ("flush", class_maintenance,
+			_("Maintenance command for flushing GDB internal caches."),
+			&maintenanceflushlist, "maintenance flush ", 0,
+			&maintenancelist);
+
   add_basic_prefix_cmd ("set", class_maintenance, _("\
 Set GDB internal variables used by the GDB maintainer.\n\
 Configure variables internal to GDB that aid in GDB's maintenance"),
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 91d3202b94b..a0dff93a53a 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -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",
diff --git a/gdb/symtab.c b/gdb/symtab.c
index dccc3d1e237..3339bf7b88a 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -42,6 +42,7 @@
 #include "addrmap.h"
 #include "cli/cli-utils.h"
 #include "cli/cli-style.h"
+#include "cli/cli-cmds.h"
 #include "fnmatch.h"
 #include "hashtab.h"
 #include "typeprint.h"
@@ -6929,10 +6930,13 @@ If zero then the symbol cache is disabled."),
 	   _("Print symbol cache statistics for each program space."),
 	   &maintenanceprintlist);
 
-  add_cmd ("flush-symbol-cache", class_maintenance,
+  add_cmd ("symbol-cache", class_maintenance,
 	   maintenance_flush_symbol_cache,
 	   _("Flush the symbol cache for each program space."),
-	   &maintenancelist);
+	   &maintenanceflushlist);
+  c = add_alias_cmd ("flush-symbol-cache", "flush symbol-cache",
+		     class_maintenance, 0, &maintenancelist);
+  deprecate_cmd (c, "maintenancelist flush symbol-cache");
 
   gdb::observers::executable_changed.attach (symtab_observer_executable_changed);
   gdb::observers::new_objfile.attach (symtab_new_objfile_observer);
diff --git a/gdb/testsuite/gdb.base/c-linkage-name.exp b/gdb/testsuite/gdb.base/c-linkage-name.exp
index 6b0a014949e..c6b3b509df6 100644
--- a/gdb/testsuite/gdb.base/c-linkage-name.exp
+++ b/gdb/testsuite/gdb.base/c-linkage-name.exp
@@ -64,7 +64,7 @@ gdb_test "maint info symtabs" "\{ symtab \[^\r\n\]*c-linkage-name-2.c.*"
 
 # Flush the symbol cache to prevent the lookup to return the same as before.
 
-gdb_test "maint flush-symbol-cache"
+gdb_test "maint flush symbol-cache"
 
 # Try to print MUNDANE using its linkage name again, after partial
 # symtab expansion.
diff --git a/gdb/testsuite/gdb.base/killed-outside.exp b/gdb/testsuite/gdb.base/killed-outside.exp
index 3e20ad67cee..645b41f4867 100644
--- a/gdb/testsuite/gdb.base/killed-outside.exp
+++ b/gdb/testsuite/gdb.base/killed-outside.exp
@@ -115,7 +115,7 @@ with_test_prefix "stepi" {
 # other commands would trigger.
 with_test_prefix "registers" {
     test {
-	gdb_test "flushregs" ".*"
+	gdb_test "maint flush register-cache" ".*"
 	gdb_test "info threads" ".*"
     }
 }
diff --git a/gdb/testsuite/gdb.opt/inline-bt.exp b/gdb/testsuite/gdb.opt/inline-bt.exp
index d428c396359..109627c2306 100644
--- a/gdb/testsuite/gdb.opt/inline-bt.exp
+++ b/gdb/testsuite/gdb.opt/inline-bt.exp
@@ -61,7 +61,7 @@ gdb_test "info frame" ".*inlined into frame.*" "func2 inlined (3)"
 # function.
 gdb_test_no_output "set backtrace limit 2"
 # Force flushing the frame cache.
-gdb_test "flushregs" "Register cache flushed."
+gdb_test "maint flush register-cache" "Register cache flushed."
 gdb_test "up" "#1  .*func1.*" "up from bar (4)"
 gdb_test "info frame" ".*in func1.*" "info frame still works"
 # Verify the user visible limit works as expected.
diff --git a/gdb/testsuite/gdb.perf/gmonster-null-lookup.py b/gdb/testsuite/gdb.perf/gmonster-null-lookup.py
index eaf4b11c9f8..f4ce1ea55e9 100644
--- a/gdb/testsuite/gdb.perf/gmonster-null-lookup.py
+++ b/gdb/testsuite/gdb.perf/gmonster-null-lookup.py
@@ -40,7 +40,7 @@ class NullLookup(perftest.TestCaseWithBasicMeasurements):
             utils.safe_execute("mt expand-symtabs")
             iteration = 5
             while iteration > 0:
-                utils.safe_execute("mt flush-symbol-cache")
+                utils.safe_execute("mt flush symbol-cache")
                 func = lambda: utils.safe_execute("p symbol_not_found")
                 self.measure.measure(func, run)
                 iteration -= 1
diff --git a/gdb/testsuite/gdb.perf/gmonster-print-cerr.py b/gdb/testsuite/gdb.perf/gmonster-print-cerr.py
index 796380dcacd..adee2e601aa 100644
--- a/gdb/testsuite/gdb.perf/gmonster-print-cerr.py
+++ b/gdb/testsuite/gdb.perf/gmonster-print-cerr.py
@@ -46,7 +46,7 @@ class PrintCerr(perftest.TestCaseWithBasicMeasurements):
             utils.runto_main()
             iteration = 5
             while iteration > 0:
-                utils.safe_execute("mt flush-symbol-cache")
+                utils.safe_execute("mt flush symbol-cache")
                 func = lambda: utils.safe_execute("print gm_std::cerr")
                 self.measure.measure(func, run)
                 iteration -= 1
diff --git a/gdb/testsuite/gdb.perf/gmonster-ptype-string.py b/gdb/testsuite/gdb.perf/gmonster-ptype-string.py
index 78fa3dfd432..aa5513547e5 100644
--- a/gdb/testsuite/gdb.perf/gmonster-ptype-string.py
+++ b/gdb/testsuite/gdb.perf/gmonster-ptype-string.py
@@ -41,7 +41,7 @@ class GmonsterPtypeString(perftest.TestCaseWithBasicMeasurements):
             utils.safe_execute("mt expand-symtabs")
             iteration = 5
             while iteration > 0:
-                utils.safe_execute("mt flush-symbol-cache")
+                utils.safe_execute("mt flush symbol-cache")
                 func1 = lambda: utils.safe_execute("ptype hello")
                 func = lambda: utils.run_n_times(2, func1)
                 self.measure.measure(func, run)
diff --git a/gdb/testsuite/gdb.python/py-unwind.exp b/gdb/testsuite/gdb.python/py-unwind.exp
index 4ef63bf965c..e8ae8632a8e 100644
--- a/gdb/testsuite/gdb.python/py-unwind.exp
+++ b/gdb/testsuite/gdb.python/py-unwind.exp
@@ -57,4 +57,4 @@ gdb_test_sequence "where"  "Backtrace restored by unwinder" {
 }
 
 # Check that the Python unwinder frames can be flushed / released.
-gdb_test "flushregs" "Register cache flushed\\." "flush frames"
+gdb_test "maint flush register-cache" "Register cache flushed\\." "flush frames"

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-12-13 12:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23 10:39 [PATCH 0/2] Organise maintenance commands that flush caches Andrew Burgess
2020-11-23 10:39 ` [PATCH 1/2] gdb: introduce new 'maint flush ' prefix command Andrew Burgess
2020-11-23 15:28   ` Eli Zaretskii
2020-11-23 16:24   ` Luis Machado
2020-12-03 17:23     ` Tom Tromey
2020-12-13 12:43       ` Andrew Burgess
2020-11-23 10:39 ` [PATCH 2/2] gdb: new command 'maint flush dcache' Andrew Burgess
2020-11-23 15:28   ` Eli Zaretskii
2020-11-23 16:28   ` Luis Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).