From: Tom Tromey Date: Fri, 19 Sep 2025 17:57:46 +0000 (-0600) Subject: Remove some helper functions from DAP breakpoint code X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6d3af8c9f6805e935677757d84dd6cfdb5cda261;p=thirdparty%2Fbinutils-gdb.git Remove some helper functions from DAP breakpoint code The DAP breakpoint code has some helper functions that don't really provide much value any more. This patch removes them. Approved-By: Andrew Burgess --- diff --git a/gdb/python/lib/gdb/dap/breakpoint.py b/gdb/python/lib/gdb/dap/breakpoint.py index 31629117071..3d1cfef4f5f 100644 --- a/gdb/python/lib/gdb/dap/breakpoint.py +++ b/gdb/python/lib/gdb/dap/breakpoint.py @@ -147,7 +147,7 @@ def _remove_entries(table, *names): # specifications and a callback function to do the work of creating # the breakpoint. @in_gdb_thread -def _set_breakpoints_callback(kind, specs, creator): +def _set_breakpoints(kind, specs, creator): # Try to reuse existing breakpoints if possible. if kind in breakpoint_map: saved_map = breakpoint_map[kind] @@ -254,13 +254,6 @@ def _set_one_breakpoint(*, logMessage=None, **args): return gdb.Breakpoint(**args) -# Helper function to set ordinary breakpoints according to a list of -# specifications. -@in_gdb_thread -def _set_breakpoints(kind, specs): - return _set_breakpoints_callback(kind, specs, _set_one_breakpoint) - - # A helper function that rewrites a SourceBreakpoint into the internal # form passed to the creator. This function also allows for # type-checking of each SourceBreakpoint. @@ -302,7 +295,7 @@ def set_breakpoint(*, source, breakpoints: Sequence = (), **args): # Be sure to include the path in the key, so that we only # clear out breakpoints coming from this same source. key = "source:" + source["path"] - result = _set_breakpoints(key, specs) + result = _set_breakpoints(key, specs, _set_one_breakpoint) return { "breakpoints": result, } @@ -331,7 +324,7 @@ def _rewrite_fn_breakpoint( def set_fn_breakpoint(*, breakpoints: Sequence, **args): specs = [_rewrite_fn_breakpoint(**bp) for bp in breakpoints] return { - "breakpoints": _set_breakpoints("function", specs), + "breakpoints": _set_breakpoints("function", specs, _set_one_breakpoint), } @@ -366,7 +359,7 @@ def set_insn_breakpoints( ): specs = [_rewrite_insn_breakpoint(**bp) for bp in breakpoints] return { - "breakpoints": _set_breakpoints("instruction", specs), + "breakpoints": _set_breakpoints("instruction", specs, _set_one_breakpoint), } @@ -390,11 +383,6 @@ def _catch_exception(filterId, **args): raise Exception("Could not find catchpoint after creating") -@in_gdb_thread -def _set_exception_catchpoints(filter_options): - return _set_breakpoints_callback("exception", filter_options, _catch_exception) - - # A helper function that rewrites an ExceptionFilterOptions into the # internal form passed to the creator. This function also allows for # type-checking of each ExceptionFilterOptions. @@ -458,6 +446,4 @@ def set_exception_breakpoints( options = [{"filterId": filter} for filter in filters] options.extend(filterOptions) options = [_rewrite_exception_breakpoint(**bp) for bp in options] - return { - "breakpoints": _set_exception_catchpoints(options), - } + return {"breakpoints": _set_breakpoints("exception", options, _catch_exception)}