[PATCH 2/7] Reuse breakpoints more frequently in DAP

Tom Tromey tromey@adacore.com
Mon Jun 12 19:36:29 GMT 2023


The DAP breakpoint code tries to reuse a breakpoint when possible.
Currently it uses the condition and the hit condition (aka ignore
count) when making this determination.  However, these attributes are
just going to be reset anyway, so this patch changes the code to
exclude these from the reuse decision.
---
 gdb/python/lib/gdb/dap/breakpoint.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/python/lib/gdb/dap/breakpoint.py b/gdb/python/lib/gdb/dap/breakpoint.py
index 2cb8db68907..f15f905c5f3 100644
--- a/gdb/python/lib/gdb/dap/breakpoint.py
+++ b/gdb/python/lib/gdb/dap/breakpoint.py
@@ -85,9 +85,11 @@ def _set_breakpoints_callback(kind, specs, creator):
     breakpoint_map[kind] = {}
     result = []
     for spec in specs:
-        keyspec = frozenset(spec.items())
-
+        # It makes sense to reuse a breakpoint even if the condition
+        # or ignore count differs, so remove these entries from the
+        # spec first.
         (condition, hit_condition) = _remove_entries(spec, "condition", "hitCondition")
+        keyspec = frozenset(spec.items())
 
         if keyspec in saved_map:
             bp = saved_map.pop(keyspec)

-- 
2.40.1



More information about the Gdb-patches mailing list