forked from Imagelibrary/binutils-gdb
Avoid spurious breakpoint-setting failure in DAP
A user pointed out that if a DAP setBreakpoints request has a 'source' field in a SourceBreakpoint object, then the gdb DAP implementation will throw an exception. While SourceBreakpoint does not allow 'source' in the spec, it seems better to me to accept it. I don't think we should fully go down the "Postel's Law" path -- after all, we have the type-checker -- but at the same time, if we do send errors, they should be intentional and not artifacts of the implementation. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30820
This commit is contained in:
@@ -273,7 +273,13 @@ def set_breakpoint(*, source, breakpoints: Sequence = (), **args):
|
||||
if "path" not in source:
|
||||
result = []
|
||||
else:
|
||||
specs = [_rewrite_src_breakpoint(source=source, **bp) for bp in breakpoints]
|
||||
# Setting 'source' in BP avoids any Python error if BP already
|
||||
# has a 'source' parameter. Setting this isn't in the spec,
|
||||
# but it is better to be safe. See PR dap/30820.
|
||||
specs = []
|
||||
for bp in breakpoints:
|
||||
bp["source"] = source
|
||||
specs.append(_rewrite_src_breakpoint(**bp))
|
||||
# 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"]
|
||||
|
||||
Reference in New Issue
Block a user