[Lldb-commits] [lldb] Re-land [lldb-dap] Add support for data breakpoint. (PR #81909)
https://github.com/ZequanWu closed https://github.com/llvm/llvm-project/pull/81909 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Re-land [lldb-dap] Add support for data breakpoint. (PR #81909)
https://github.com/clayborg approved this pull request. https://github.com/llvm/llvm-project/pull/81909 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Re-land [lldb-dap] Add support for data breakpoint. (PR #81909)
ZequanWu wrote: Ping. https://github.com/llvm/llvm-project/pull/81909 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Re-land [lldb-dap] Add support for data breakpoint. (PR #81909)
https://github.com/ZequanWu updated https://github.com/llvm/llvm-project/pull/81909 >From d95a420ef100d0e73f8ff829926fc3f3d0708386 Mon Sep 17 00:00:00 2001 From: Zequan Wu Date: Thu, 15 Feb 2024 14:29:18 -0500 Subject: [PATCH 1/2] [lldb-dap] Add support for data breakpoint. This implements functionality to handle DataBreakpointInfo request and SetDataBreakpoints request. --- .../test/tools/lldb-dap/dap_server.py | 47 +++ .../tools/lldb-dap/databreakpoint/Makefile| 3 + .../TestDAP_setDataBreakpoints.py | 131 +++ .../tools/lldb-dap/databreakpoint/main.cpp| 17 + lldb/tools/lldb-dap/CMakeLists.txt| 1 + lldb/tools/lldb-dap/DAPForward.h | 2 + lldb/tools/lldb-dap/Watchpoint.cpp| 48 +++ lldb/tools/lldb-dap/Watchpoint.h | 34 ++ lldb/tools/lldb-dap/lldb-dap.cpp | 336 -- 9 files changed, 585 insertions(+), 34 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/databreakpoint/Makefile create mode 100644 lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py create mode 100644 lldb/test/API/tools/lldb-dap/databreakpoint/main.cpp create mode 100644 lldb/tools/lldb-dap/Watchpoint.cpp create mode 100644 lldb/tools/lldb-dap/Watchpoint.h diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index bb863bb8719176..27a76a652f4063 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -501,6 +501,18 @@ def get_local_variable_value(self, name, frameIndex=0, threadId=None): return variable["value"] return None +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" +] +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" @@ -895,6 +907,41 @@ def request_setFunctionBreakpoints(self, names, condition=None, hitCondition=Non } return self.send_recv(command_dict) +def request_dataBreakpointInfo( +self, variablesReference, name, frameIndex=0, threadId=None +): +stackFrame = self.get_stackFrame(frameIndex=frameIndex, threadId=threadId) +if stackFrame is None: +return [] +args_dict = { +"variablesReference": variablesReference, +"name": name, +"frameId": stackFrame["id"], +} +command_dict = { +"command": "dataBreakpointInfo", +"type": "request", +"arguments": args_dict, +} +return self.send_recv(command_dict) + +def request_setDataBreakpoint(self, dataBreakpoints): +"""dataBreakpoints is a list of dictionary with following fields: +{ +dataId: (address in hex)/(size in bytes) +accessType: read/write/readWrite +[condition]: string +[hitCondition]: string +} +""" +args_dict = {"breakpoints": dataBreakpoints} +command_dict = { +"command": "setDataBreakpoints", +"type": "request", +"arguments": args_dict, +} +return self.send_recv(command_dict) + def request_compileUnits(self, moduleId): args_dict = {"moduleId": moduleId} command_dict = { diff --git a/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile b/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile new file mode 100644 index 00..8b20bcb050 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py new file mode 100644 index 00..8b4f07a9054d74 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py @@ -0,0 +1,131 @@ +""" +Test lldb-dap dataBreakpointInfo and setDataBreakpoints requests +""" + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +import lldbdap_testcase + + +class TestDAP_setDataBreakpoints(lldbdap_testcase.DAPTestCaseBase): +def setUp(self): +lldbdap_testcase.DAPTestCaseBase.setUp(self) +self.accessTypes = ["read", "write", "readWrite"] + +@skipIfWindows +@skipIfRemote +def test_expression(self): +
[Lldb-commits] [lldb] Re-land [lldb-dap] Add support for data breakpoint. (PR #81909)
https://github.com/ZequanWu updated https://github.com/llvm/llvm-project/pull/81909 >From d95a420ef100d0e73f8ff829926fc3f3d0708386 Mon Sep 17 00:00:00 2001 From: Zequan Wu Date: Thu, 15 Feb 2024 14:29:18 -0500 Subject: [PATCH] [lldb-dap] Add support for data breakpoint. This implements functionality to handle DataBreakpointInfo request and SetDataBreakpoints request. --- .../test/tools/lldb-dap/dap_server.py | 47 +++ .../tools/lldb-dap/databreakpoint/Makefile| 3 + .../TestDAP_setDataBreakpoints.py | 131 +++ .../tools/lldb-dap/databreakpoint/main.cpp| 17 + lldb/tools/lldb-dap/CMakeLists.txt| 1 + lldb/tools/lldb-dap/DAPForward.h | 2 + lldb/tools/lldb-dap/Watchpoint.cpp| 48 +++ lldb/tools/lldb-dap/Watchpoint.h | 34 ++ lldb/tools/lldb-dap/lldb-dap.cpp | 336 -- 9 files changed, 585 insertions(+), 34 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/databreakpoint/Makefile create mode 100644 lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py create mode 100644 lldb/test/API/tools/lldb-dap/databreakpoint/main.cpp create mode 100644 lldb/tools/lldb-dap/Watchpoint.cpp create mode 100644 lldb/tools/lldb-dap/Watchpoint.h diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index bb863bb8719176..27a76a652f4063 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -501,6 +501,18 @@ def get_local_variable_value(self, name, frameIndex=0, threadId=None): return variable["value"] return None +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" +] +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" @@ -895,6 +907,41 @@ def request_setFunctionBreakpoints(self, names, condition=None, hitCondition=Non } return self.send_recv(command_dict) +def request_dataBreakpointInfo( +self, variablesReference, name, frameIndex=0, threadId=None +): +stackFrame = self.get_stackFrame(frameIndex=frameIndex, threadId=threadId) +if stackFrame is None: +return [] +args_dict = { +"variablesReference": variablesReference, +"name": name, +"frameId": stackFrame["id"], +} +command_dict = { +"command": "dataBreakpointInfo", +"type": "request", +"arguments": args_dict, +} +return self.send_recv(command_dict) + +def request_setDataBreakpoint(self, dataBreakpoints): +"""dataBreakpoints is a list of dictionary with following fields: +{ +dataId: (address in hex)/(size in bytes) +accessType: read/write/readWrite +[condition]: string +[hitCondition]: string +} +""" +args_dict = {"breakpoints": dataBreakpoints} +command_dict = { +"command": "setDataBreakpoints", +"type": "request", +"arguments": args_dict, +} +return self.send_recv(command_dict) + def request_compileUnits(self, moduleId): args_dict = {"moduleId": moduleId} command_dict = { diff --git a/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile b/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile new file mode 100644 index 00..8b20bcb050 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py new file mode 100644 index 00..8b4f07a9054d74 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py @@ -0,0 +1,131 @@ +""" +Test lldb-dap dataBreakpointInfo and setDataBreakpoints requests +""" + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +import lldbdap_testcase + + +class TestDAP_setDataBreakpoints(lldbdap_testcase.DAPTestCaseBase): +def setUp(self): +lldbdap_testcase.DAPTestCaseBase.setUp(self) +self.accessTypes = ["read", "write", "readWrite"] + +@skipIfWindows +@skipIfRemote +def test_expression(self): +
[Lldb-commits] [lldb] Re-land [lldb-dap] Add support for data breakpoint. (PR #81909)
ZequanWu wrote: DAP adds a new request `DataAddressBreakpointInfo` at https://github.com/microsoft/debug-adapter-protocol/pull/461 with the following format to allow setting watchpoints at given address and size: ``` interface DataAddressBreakpointInfoRequest extends Request { command: 'DataAddressBreakpointInfo'; arguments: DataAddressBreakpointInfoArguments; } interface DataAddressBreakpointInfoArguments { /** * The address of the data for which to obtain breakpoint information. * Treated as a hex value if prefixed with `0x`, or as a decimal value * otherwise. */ address?: string; /** * If passed, requests breakpoint information for an exclusive byte range * rather than a single address. The range extends the given number of `bytes` * from the start `address`. * Treated as a hex value if prefixed with `0x`, or as a decimal value * otherwise. */ bytes?: string; } ``` This is kind of overlap with the existing made-up `${number of bytes}@${expression}`. If we choose to use the made-up, the new request seems not necessary to add because expression could be an address as well. https://github.com/llvm/llvm-project/pull/81909 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Re-land [lldb-dap] Add support for data breakpoint. (PR #81909)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r e82659fff2f07b5ea1d94e0d8bcb9c540d6bede1...757013af5361f5bf0f486d7ac0ee2f6980248f15 lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py `` View the diff from darker here. ``diff --- test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py 2024-02-15 19:31:01.00 + +++ test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py 2024-02-15 19:39:15.384210 + @@ -33,14 +33,15 @@ 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"}, ] -set_response = self.dap_server.request_setDataBreakpoint( -dataBreakpoints) -self.assertEquals(set_response["body"]["breakpoints"], [ - {"verified": True}, {"verified": True}]) +set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints) +self.assertEquals( +set_response["body"]["breakpoints"], +[{"verified": True}, {"verified": True}], +) self.continue_to_next_stop() x_val = self.dap_server.get_local_variable_value("x") i_val = self.dap_server.get_local_variable_value("i") self.assertEquals(x_val, "2") @@ -77,14 +78,15 @@ 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"}, ] -set_response = self.dap_server.request_setDataBreakpoint( -dataBreakpoints) -self.assertEquals(set_response["body"]["breakpoints"], [ - {"verified": True}, {"verified": True}]) +set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints) +self.assertEquals( +set_response["body"]["breakpoints"], +[{"verified": True}, {"verified": True}], +) self.continue_to_next_stop() x_val = self.dap_server.get_local_variable_value("x") i_val = self.dap_server.get_local_variable_value("i") self.assertEquals(x_val, "2") @@ -106,14 +108,12 @@ "dataId": response_x["body"]["dataId"], "accessType": "write", "hitCondition": "2", } ] -set_response = self.dap_server.request_setDataBreakpoint( -dataBreakpoints) -self.assertEquals(set_response["body"]["breakpoints"], [ - {"verified": True}]) +set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints) +self.assertEquals(set_response["body"]["breakpoints"], [{"verified": True}]) self.continue_to_next_stop() x_val = self.dap_server.get_local_variable_value("x") self.assertEquals(x_val, "3") # Test condition @@ -122,12 +122,10 @@ "dataId": response_x["body"]["dataId"], "accessType": "write", "condition": "x==10", } ] -set_response = self.dap_server.request_setDataBreakpoint( -dataBreakpoints) -self.assertEquals(set_response["body"]["breakpoints"], [ - {"verified": True}]) +set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints) +self.assertEquals(set_response["body"]["breakpoints"], [{"verified": True}]) self.continue_to_next_stop() x_val = self.dap_server.get_local_variable_value("x") self.assertEquals(x_val, "10") `` https://github.com/llvm/llvm-project/pull/81909 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Re-land [lldb-dap] Add support for data breakpoint. (PR #81909)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Zequan Wu (ZequanWu) Changes This implements functionality to handle DataBreakpointInfo request and SetDataBreakpoints request. Previous commit https://github.com/llvm/llvm-project/commit/8c56e78ec531f0e2460213c20fff869b6b7add99 was reverted because setting 1 byte watchpoint failed in the new test on ARM64. So, I changed the test to setting 4 byte watchpoint instead, and hope this won't break it again. It also adds the fixes from https://github.com/llvm/llvm-project/pull/81680. --- Patch is 29.35 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/81909.diff 9 Files Affected: - (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py (+47) - (added) lldb/test/API/tools/lldb-dap/databreakpoint/Makefile (+3) - (added) lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py (+133) - (added) lldb/test/API/tools/lldb-dap/databreakpoint/main.cpp (+17) - (modified) lldb/tools/lldb-dap/CMakeLists.txt (+1) - (modified) lldb/tools/lldb-dap/DAPForward.h (+2) - (added) lldb/tools/lldb-dap/Watchpoint.cpp (+48) - (added) lldb/tools/lldb-dap/Watchpoint.h (+34) - (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+302-34) ``diff diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index bb863bb8719176..27a76a652f4063 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -501,6 +501,18 @@ def get_local_variable_value(self, name, frameIndex=0, threadId=None): return variable["value"] return None +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" +] +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" @@ -895,6 +907,41 @@ def request_setFunctionBreakpoints(self, names, condition=None, hitCondition=Non } return self.send_recv(command_dict) +def request_dataBreakpointInfo( +self, variablesReference, name, frameIndex=0, threadId=None +): +stackFrame = self.get_stackFrame(frameIndex=frameIndex, threadId=threadId) +if stackFrame is None: +return [] +args_dict = { +"variablesReference": variablesReference, +"name": name, +"frameId": stackFrame["id"], +} +command_dict = { +"command": "dataBreakpointInfo", +"type": "request", +"arguments": args_dict, +} +return self.send_recv(command_dict) + +def request_setDataBreakpoint(self, dataBreakpoints): +"""dataBreakpoints is a list of dictionary with following fields: +{ +dataId: (address in hex)/(size in bytes) +accessType: read/write/readWrite +[condition]: string +[hitCondition]: string +} +""" +args_dict = {"breakpoints": dataBreakpoints} +command_dict = { +"command": "setDataBreakpoints", +"type": "request", +"arguments": args_dict, +} +return self.send_recv(command_dict) + def request_compileUnits(self, moduleId): args_dict = {"moduleId": moduleId} command_dict = { diff --git a/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile b/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile new file mode 100644 index 00..8b20bcb050 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py new file mode 100644 index 00..02afbe4180378d --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py @@ -0,0 +1,133 @@ +""" +Test lldb-dap dataBreakpointInfo and setDataBreakpoints requests +""" + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +import lldbdap_testcase + + +class TestDAP_setDataBreakpoints(lldbdap_testcase.DAPTestCaseBase): +def setUp(self): +lldbdap_testcase.DAPTestCaseBase.setUp(self) +self.accessTypes = ["read", "write", "readWrite"] + +@skipIfWindows +@skipIfRemote +def test_expression(self): +"""Tests setting
[Lldb-commits] [lldb] Re-land [lldb-dap] Add support for data breakpoint. (PR #81909)
https://github.com/ZequanWu created https://github.com/llvm/llvm-project/pull/81909 This implements functionality to handle DataBreakpointInfo request and SetDataBreakpoints request. Previous commit https://github.com/llvm/llvm-project/commit/8c56e78ec531f0e2460213c20fff869b6b7add99 was reverted because setting 1 byte watchpoint failed in the new test on ARM64. So, I changed the test to setting 4 byte watchpoint instead, and hope this won't break it again. It also adds the fixes from https://github.com/llvm/llvm-project/pull/81680. >From 757013af5361f5bf0f486d7ac0ee2f6980248f15 Mon Sep 17 00:00:00 2001 From: Zequan Wu Date: Thu, 15 Feb 2024 14:29:18 -0500 Subject: [PATCH] [lldb-dap] Add support for data breakpoint. This implements functionality to handle DataBreakpointInfo request and SetDataBreakpoints request. --- .../test/tools/lldb-dap/dap_server.py | 47 +++ .../tools/lldb-dap/databreakpoint/Makefile| 3 + .../TestDAP_setDataBreakpoints.py | 133 +++ .../tools/lldb-dap/databreakpoint/main.cpp| 17 + lldb/tools/lldb-dap/CMakeLists.txt| 1 + lldb/tools/lldb-dap/DAPForward.h | 2 + lldb/tools/lldb-dap/Watchpoint.cpp| 48 +++ lldb/tools/lldb-dap/Watchpoint.h | 34 ++ lldb/tools/lldb-dap/lldb-dap.cpp | 336 -- 9 files changed, 587 insertions(+), 34 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/databreakpoint/Makefile create mode 100644 lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py create mode 100644 lldb/test/API/tools/lldb-dap/databreakpoint/main.cpp create mode 100644 lldb/tools/lldb-dap/Watchpoint.cpp create mode 100644 lldb/tools/lldb-dap/Watchpoint.h diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index bb863bb8719176..27a76a652f4063 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -501,6 +501,18 @@ def get_local_variable_value(self, name, frameIndex=0, threadId=None): return variable["value"] return None +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" +] +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" @@ -895,6 +907,41 @@ def request_setFunctionBreakpoints(self, names, condition=None, hitCondition=Non } return self.send_recv(command_dict) +def request_dataBreakpointInfo( +self, variablesReference, name, frameIndex=0, threadId=None +): +stackFrame = self.get_stackFrame(frameIndex=frameIndex, threadId=threadId) +if stackFrame is None: +return [] +args_dict = { +"variablesReference": variablesReference, +"name": name, +"frameId": stackFrame["id"], +} +command_dict = { +"command": "dataBreakpointInfo", +"type": "request", +"arguments": args_dict, +} +return self.send_recv(command_dict) + +def request_setDataBreakpoint(self, dataBreakpoints): +"""dataBreakpoints is a list of dictionary with following fields: +{ +dataId: (address in hex)/(size in bytes) +accessType: read/write/readWrite +[condition]: string +[hitCondition]: string +} +""" +args_dict = {"breakpoints": dataBreakpoints} +command_dict = { +"command": "setDataBreakpoints", +"type": "request", +"arguments": args_dict, +} +return self.send_recv(command_dict) + def request_compileUnits(self, moduleId): args_dict = {"moduleId": moduleId} command_dict = { diff --git a/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile b/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile new file mode 100644 index 00..8b20bcb050 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py new file mode 100644 index 00..02afbe4180378d --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py @@ -0,0 +1,133 @@ +""" +Test