aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2020-08-20 10:07:21 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2020-08-20 10:07:21 -0400
commit3ee93972f9dbbb77a7cd4f63c6c7bb66a8b12c71 (patch)
tree30889ffcdcd329127c834fe622e08200a9817955
parent01147b208215ae457e7ef2d5a105c9dac93d955a (diff)
downloadgdb-3ee93972f9dbbb77a7cd4f63c6c7bb66a8b12c71.zip
gdb-3ee93972f9dbbb77a7cd4f63c6c7bb66a8b12c71.tar.gz
gdb-3ee93972f9dbbb77a7cd4f63c6c7bb66a8b12c71.tar.bz2
gdb: clear regcaches at the start of regcaches selftest
It currently does not work to run the `regcaches` selftest while debugging something. This is because we expect that there exists no regcache at the start of the test. If we are debugging something, there might exist some regcaches. Fix it by making the test clear regcaches at the start. While at it, make the test clean up after it self and clear the regcaches at the end too. gdb/ChangeLog: * regcache.c (regcaches_test): Call registers_changed. Change-Id: I9d4f83ecb0ff9721a71e2c5cbd19e6e6d4e6c30c
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/regcache.c6
2 files changed, 9 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c568945..a6835f0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2020-08-20 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * regcache.c (regcaches_test): Call registers_changed.
+
2020-08-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* infrun.c (process_event_stop_test): Fix typo "breapoint".
diff --git a/gdb/regcache.c b/gdb/regcache.c
index cd54bc6..9f560ac 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1506,7 +1506,8 @@ test_get_thread_arch_aspace_regcache (process_stratum_target *target,
static void
regcaches_test ()
{
- /* It is empty at the start. */
+ /* Ensure the regcaches container is empty at the start. */
+ registers_changed ();
SELF_CHECK (regcaches_size () == 0);
ptid_t ptid1 (1), ptid2 (2), ptid3 (3);
@@ -1565,6 +1566,9 @@ regcaches_test ()
clears REGCACHES. */
registers_changed_ptid (nullptr, minus_one_ptid);
SELF_CHECK (regcaches_size () == 0);
+
+ /* Make sure to leave the global regcaches container empty. */
+ registers_changed ();
}
class target_ops_no_register : public test_target_ops