[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
via lldb-commits
lldb-commits at lists.llvm.org
Sat Oct 26 20:42:35 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r e146c1867e8decfd423034f63a3a863733e03f04...af45bc2e24623d7225d24a4680a28630d67d636e lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 2024-10-27 03:38:16.000000 +0000
+++ packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 2024-10-27 03:42:10.061762 +0000
@@ -610,24 +610,30 @@
if gdbRemoteHostname is not None:
args_dict["gdb-remote-hostname"] = gdbRemoteHostname
command_dict = {"command": "attach", "type": "request", "arguments": args_dict}
return self.send_recv(command_dict)
- def request_breakpointLocations(self, file_path, line, end_line=None, column=None, end_column=None):
+ def request_breakpointLocations(
+ self, file_path, line, end_line=None, column=None, end_column=None
+ ):
(dir, base) = os.path.split(file_path)
source_dict = {"name": base, "path": file_path}
args_dict = {}
args_dict["source"] = source_dict
if line is not None:
- args_dict["line"] = line
+ args_dict["line"] = line
if end_line is not None:
args_dict["endLine"] = end_line
if column is not None:
args_dict["column"] = column
if end_column is not None:
args_dict["endColumn"] = end_column
- command_dict = {"command": "breakpointLocations", "type": "request", "arguments": args_dict}
+ command_dict = {
+ "command": "breakpointLocations",
+ "type": "request",
+ "arguments": args_dict,
+ }
return self.send_recv(command_dict)
def request_configurationDone(self):
command_dict = {
"command": "configurationDone",
--- test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py 2024-10-27 03:38:16.000000 +0000
+++ test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py 2024-10-27 03:42:10.140032 +0000
@@ -26,49 +26,60 @@
self.build_and_launch(program, stopOnEntry=True)
loop_line = line_number(self.main_path, "// break loop")
self.dap_server.request_continue()
# Ask for the breakpoint locations based only on the line number
- response = self.dap_server.request_breakpointLocations(self.main_path, loop_line)
+ response = self.dap_server.request_breakpointLocations(
+ self.main_path, loop_line
+ )
self.assertTrue(response["success"])
- self.assertEqual(response["body"]["breakpoints"], [
- { "line": loop_line, "column": 9 },
- { "line": loop_line, "column": 13 },
- { "line": loop_line, "column": 20 },
- { "line": loop_line, "column": 23 },
- { "line": loop_line, "column": 25 },
- { "line": loop_line, "column": 34 },
- { "line": loop_line, "column": 37 },
- { "line": loop_line, "column": 39 },
- { "line": loop_line, "column": 51 }
- ])
+ self.assertEqual(
+ response["body"]["breakpoints"],
+ [
+ {"line": loop_line, "column": 9},
+ {"line": loop_line, "column": 13},
+ {"line": loop_line, "column": 20},
+ {"line": loop_line, "column": 23},
+ {"line": loop_line, "column": 25},
+ {"line": loop_line, "column": 34},
+ {"line": loop_line, "column": 37},
+ {"line": loop_line, "column": 39},
+ {"line": loop_line, "column": 51},
+ ],
+ )
# Ask for the breakpoint locations for a column range
response = self.dap_server.request_breakpointLocations(
self.main_path,
loop_line,
- column = 24,
- end_column = 46,
+ column=24,
+ end_column=46,
)
self.assertTrue(response["success"])
- self.assertEqual(response["body"]["breakpoints"], [
- { "line": loop_line, "column": 25 },
- { "line": loop_line, "column": 34 },
- { "line": loop_line, "column": 37 },
- { "line": loop_line, "column": 39 },
- ])
+ self.assertEqual(
+ response["body"]["breakpoints"],
+ [
+ {"line": loop_line, "column": 25},
+ {"line": loop_line, "column": 34},
+ {"line": loop_line, "column": 37},
+ {"line": loop_line, "column": 39},
+ ],
+ )
# Ask for the breakpoint locations for a range of line numbers
response = self.dap_server.request_breakpointLocations(
self.main_path,
- line = loop_line,
- end_line = loop_line + 2,
- column = 39,
+ line=loop_line,
+ end_line=loop_line + 2,
+ column=39,
)
- self.maxDiff=None
+ self.maxDiff = None
self.assertTrue(response["success"])
- self.assertEqual(response["body"]["breakpoints"], [
- {'column': 39, 'line': 40},
- {'column': 51, 'line': 40},
- {'column': 3, 'line': 42},
- {'column': 18, 'line': 42}
- ])
+ self.assertEqual(
+ response["body"]["breakpoints"],
+ [
+ {"column": 39, "line": 40},
+ {"column": 51, "line": 40},
+ {"column": 3, "line": 42},
+ {"column": 18, "line": 42},
+ ],
+ )
--- test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py 2024-10-27 03:38:16.000000 +0000
+++ test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py 2024-10-27 03:42:10.258616 +0000
@@ -163,13 +163,11 @@
self.assertEqual(
line_to_id[line],
breakpoint["id"],
"verify previous breakpoints stayed the same",
)
- self.assertTrue(
- breakpoint["verified"], "expect breakpoint still verified"
- )
+ self.assertTrue(breakpoint["verified"], "expect breakpoint still verified")
# Now get the full list of breakpoints set in the target and verify
# we have only 2 breakpoints set. The response above could have told
# us about 2 breakpoints, but we want to make sure we don't have the
# third one still set in the target
@@ -188,13 +186,11 @@
line_to_id[line],
breakpoint["id"],
"verify previous breakpoints stayed the same",
)
self.assertIn(line, lines, "line expected in lines array")
- self.assertTrue(
- breakpoint["verified"], "expect breakpoint still verified"
- )
+ self.assertTrue(breakpoint["verified"], "expect breakpoint still verified")
# Now clear all breakpoints for the source file by passing down an
# empty lines array
lines = []
response = self.dap_server.request_setBreakpoints(self.main_path, lines)
@@ -357,11 +353,13 @@
program = self.getBuildArtifact("a.out")
self.build_and_launch(program)
# Set two breakpoints on the loop line at different columns.
columns = [13, 39]
- response = self.dap_server.request_setBreakpoints(self.main_path, [loop_line, loop_line], list({"column": c} for c in columns))
+ response = self.dap_server.request_setBreakpoints(
+ self.main_path, [loop_line, loop_line], list({"column": c} for c in columns)
+ )
# Verify the breakpoints were set correctly
breakpoints = response["body"]["breakpoints"]
breakpoint_ids = []
self.assertEqual(
``````````
</details>
https://github.com/llvm/llvm-project/pull/113787
More information about the lldb-commits
mailing list