diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py @@ -167,10 +167,10 @@ pass @abc.abstractmethod - def delete_breakpoint(self, id): - """Delete a breakpoint by id. + def delete_breakpoints(self, ids): + """Delete a set of breakpoints by ids. - Raises a KeyError if no breakpoint with this id exists. + Raises a KeyError if, for any id, no breakpoint with that id exists. """ pass diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py @@ -175,8 +175,7 @@ self.debugger.add_breakpoint(bpr.path, line) # Remove any trailing or expired leading breakpoints we just hit. - for bp_id in bp_to_delete: - self.debugger.delete_breakpoint(bp_id) + self.debugger.delete_breakpoints(bp_to_delete) if exit_desired: break diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/dbgeng/dbgeng.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/dbgeng/dbgeng.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/dbgeng/dbgeng.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/dbgeng/dbgeng.py @@ -90,7 +90,7 @@ def get_triggered_breakpoint_ids(self): raise NotImplementedError('get_triggered_breakpoint_ids is not yet implemented by dbgeng') - def delete_breakpoint(self, id): + def delete_breakpoints(self, ids): # breakpoint setting/deleting is not supported by dbgeng at this moment # but is something that should be considered in the future. raise NotImplementedError('delete_conditional_breakpoint is not yet implemented by dbgeng') diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py @@ -157,17 +157,18 @@ breakpoint_ids.add(id) return breakpoint_ids - def delete_breakpoint(self, id): - bp = self._target.FindBreakpointByID(id) - if not bp: - # The ID is not valid. - raise KeyError - try: - del self._breakpoint_conditions[id] - except KeyError: - # This must be an unconditional breakpoint. - pass - self._target.BreakpointDelete(id) + def delete_breakpoints(self, ids): + for id in ids: + bp = self._target.FindBreakpointByID(id) + if not bp: + # The ID is not valid. + raise KeyError + try: + del self._breakpoint_conditions[id] + except KeyError: + # This must be an unconditional breakpoint. + pass + self._target.BreakpointDelete(id) def launch(self, cmdline): self._process = self._target.LaunchSimple(cmdline, None, os.getcwd()) diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py @@ -204,30 +204,40 @@ bp_id_list += ids return set(bp_id_list) - def delete_breakpoint(self, id): - """Delete a breakpoint by id. + def delete_breakpoints(self, ids): + """Delete breakpoints by their ids. Raises a KeyError if no breakpoint with this id exists. """ - vsbp = self._dex_id_to_vs[id] + vsbp_set = set() + for id in ids: + vsbp = self._dex_id_to_vs[id] - # Remove our id from the associated list of dex ids. - self._vs_to_dex_ids[vsbp].remove(id) - del self._dex_id_to_vs[id] + # Remove our id from the associated list of dex ids. + self._vs_to_dex_ids[vsbp].remove(id) + del self._dex_id_to_vs[id] + + # Bail if there are other uses of this vsbp. + if len(self._vs_to_dex_ids[vsbp]) > 0: + continue + # Otherwise find and delete it. + vsbp_set.add(vsbp) + + vsbp_to_del_count = len(vsbp_set) - # Bail if there are other uses of this vsbp. - if len(self._vs_to_dex_ids[vsbp]) > 0: - return - # Otherwise find and delete it. for bp in self._debugger.Breakpoints: - # We're looking at the user-set breakpoints so there shouild be no + # We're looking at the user-set breakpoints so there should be no # Parent. assert bp.Parent == None this_vsbp = VSBreakpoint(PurePath(bp.File), bp.FileLine, bp.FileColumn, bp.Condition) - if vsbp == this_vsbp: + if this_vsbp in vsbp_set: bp.Delete() - break + vsbp_to_del_count -= 1 + if vsbp_to_del_count == 0: + break + if vsbp_to_del_count: + raise KeyError('did not find breakpoint to be deleted') def _fetch_property(self, props, name): num_props = props.Count