[Lldb-commits] [lldb] [lldb-dap] assembly breakpoints (PR #139969)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Mon May 19 15:41:37 PDT 2025
================
@@ -948,13 +956,11 @@ def request_scopes(self, frameId):
command_dict = {"command": "scopes", "type": "request", "arguments": args_dict}
return self.send_recv(command_dict)
- def request_setBreakpoints(self, file_path, line_array, data=None):
+ def request_setBreakpoints(self, source_dict, line_array, data=None):
----------------
ashgti wrote:
What about:
```py
from typing import TypedDict, Optional
class Source(TypedDict, total=False): # At runtime, this is just a dict with well known keys
name: str
path: str
sourceReference: int
class SourceBreakpoint(TypedDict, total=False):
line: int
column: str
condition: str
hitCondition: str
logMessage: str
def request_setBreakpoints(
self,
# For backwards compatibility, leaving these as positional args
sourcePath: Optional[str] = None,
lines: Optional[list[int]] = None,
breakpoints: Optional[list[SourceBreakpoint]] = None,
*,
source: Optional[Source] = None,
sourceReference: Optional[int] = None,
):
source_dict = {}
if source is not None:
source_dict = source
elif sourcePath is not None:
source_dict["name"] = os.path.basename(sourcePath)
source_dict["pah"] = sourcePath
elif sourceReference is not None:
source_dict["sourceReference"] = sourceReference
else:
raise ValueError("'source', 'sourcePath' or 'sourceReference' must be set')
args_dict = {
"source": source_dict,
"sourceModified": False,
}
...
```
Then we wouldn't need the `get_source_for_path` and `get_source_for_source_reference` helpers, since those would be built based on the args of the request.
I could also look at adding this as a follow up to this.
https://github.com/llvm/llvm-project/pull/139969
More information about the lldb-commits
mailing list