[Lldb-commits] [lldb] [llvm] [WIP][lldb-dap] Add support for data breakpoint. (PR #81541)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 12 13:54:42 PST 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 41ea02261224446dadb1b1561d70137699255518...2743af56220630f55a0c5bc0a7a13806c817aaad lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 2024-02-12 21:42:09.000000 +0000
+++ packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 2024-02-12 21:54:33.674990 +0000
@@ -503,17 +503,18 @@
def get_local_variable_child(self, name, child_name, frameIndex=0, threadId=None):
local = self.get_local_variable(name, frameIndex, threadId)
if local["variablesReference"] == 0:
return None
- children = self.request_variables(local["variablesReference"])[
- "body"]["variables"]
+ children = self.request_variables(local["variablesReference"])["body"][
+ "variables"
+ ]
for child in children:
if child["name"] == child_name:
return child
return None
-
+
def replay_packets(self, replay_file_path):
f = open(replay_file_path, "r")
mode = "invalid"
set_sequence = False
command_dict = None
--- test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py 2024-02-12 21:42:09.000000 +0000
+++ test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py 2024-02-12 21:54:33.758542 +0000
@@ -14,42 +14,33 @@
self.accessTypes = ["read", "write", "readWrite"]
@skipIfWindows
@skipIfRemote
def test_functionality(self):
- """Tests setting data breakpoints.
- """
+ """Tests setting data breakpoints."""
program = self.getBuildArtifact("a.out")
self.build_and_launch(program)
source = "main.cpp"
- first_loop_break_line = line_number(
- source, "// first loop breakpoint")
- breakpoint_ids = self.set_source_breakpoints(
- source, [first_loop_break_line])
+ first_loop_break_line = line_number(source, "// first loop breakpoint")
+ breakpoint_ids = self.set_source_breakpoints(source, [first_loop_break_line])
self.continue_to_breakpoints(breakpoint_ids)
self.dap_server.get_local_variables()
# Test write watchpoints on x, arr[2]
response_x = self.dap_server.request_dataBreakpointInfo(1, "x")
arr = self.dap_server.get_local_variable("arr")
response_arr_2 = self.dap_server.request_dataBreakpointInfo(
- arr["variablesReference"], "[2]")
+ arr["variablesReference"], "[2]"
+ )
# Test response from dataBreakpointInfo request.
self.assertEquals(response_x["body"]["dataId"].split("/")[1], "4")
self.assertEquals(response_x["body"]["accessTypes"], self.accessTypes)
self.assertEquals(response_arr_2["body"]["dataId"].split("/")[1], "1")
- self.assertEquals(response_arr_2["body"]
- ["accessTypes"], self.accessTypes)
+ self.assertEquals(response_arr_2["body"]["accessTypes"], self.accessTypes)
dataBreakpoints = [
- {
- "dataId": response_x["body"]["dataId"],
- "accessType": "write"
- },
- {
- "dataId": response_arr_2["body"]["dataId"],
- "accessType": "write"
- }
+ {"dataId": response_x["body"]["dataId"], "accessType": "write"},
+ {"dataId": response_arr_2["body"]["dataId"], "accessType": "write"},
]
self.dap_server.request_setDataBreakpoint(dataBreakpoints)
self.dap_server.request_continue()
self.dap_server.wait_for_stopped()
@@ -65,20 +56,18 @@
self.assertEquals(arr_2["value"], "'z'")
self.assertEquals(i_val, "2")
self.dap_server.request_setDataBreakpoint([])
# Test hit condition
- second_loop_break_line = line_number(
- source, "// second loop breakpoint")
- breakpoint_ids = self.set_source_breakpoints(
- source, [second_loop_break_line])
+ second_loop_break_line = line_number(source, "// second loop breakpoint")
+ breakpoint_ids = self.set_source_breakpoints(source, [second_loop_break_line])
self.continue_to_breakpoints(breakpoint_ids)
dataBreakpoints = [
{
"dataId": response_x["body"]["dataId"],
"accessType": "write",
- "hitCondition": "2"
+ "hitCondition": "2",
}
]
self.dap_server.request_setDataBreakpoint(dataBreakpoints)
self.dap_server.request_continue()
self.dap_server.wait_for_stopped()
@@ -88,11 +77,11 @@
# Test condition
dataBreakpoints = [
{
"dataId": response_x["body"]["dataId"],
"accessType": "write",
- "condition": "x==10"
+ "condition": "x==10",
}
]
self.dap_server.request_setDataBreakpoint(dataBreakpoints)
self.dap_server.request_continue()
self.dap_server.wait_for_stopped()
``````````
</details>
https://github.com/llvm/llvm-project/pull/81541
More information about the lldb-commits
mailing list