[PATCH 4/4] gdb: change regcache list to be a map
Tom Tromey
tom@tromey.com
Wed Aug 12 15:17:17 GMT 2020
Tom> A simple fix would be to fall back to iterating over the map in the
Tom> is_pid case. I don't know whether this would reintroduce the
Tom> performance issue that prompted the patch, though.
FWIW this worked for my test case.
I also have some ravenscar-thread changes, though I'm not sure yet if
those are really needed.
Tom
diff --git a/gdb/regcache.c b/gdb/regcache.c
index cd54bc6b5f9..d409b8c2f25 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -486,7 +486,15 @@ registers_changed_ptid (process_stratum_target *target, ptid_t ptid)
if (ptid_regc_map_it != regcaches.end ())
{
auto &ptid_regc_map = ptid_regc_map_it->second;
- ptid_regc_map.erase (ptid);
+
+ auto last = ptid_regc_map.end ();
+ for (auto i = ptid_regc_map.begin (); i != last; )
+ {
+ if (i->first.matches (ptid))
+ i = ptid_regc_map.erase (i);
+ else
+ ++i;
+ }
}
}
else
More information about the Gdb-patches
mailing list