Skip to content

Commit 36466ae

Browse files
committed
Fix review comments
1 parent 482c89d commit 36466ae

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,19 +1239,13 @@ def request_dataBreakpointInfo(
12391239
stackFrame = self.get_stackFrame(frameIndex=frameIndex, threadId=threadId)
12401240
if stackFrame is None:
12411241
return []
1242-
args_dict = (
1243-
{
1244-
"variablesReference": variablesReference,
1245-
"name": name,
1246-
"frameId": stackFrame["id"],
1247-
}
1248-
if size is None
1249-
else {
1250-
"bytes": size,
1251-
"name": name,
1252-
"asAddress": True,
1253-
}
1254-
)
1242+
args_dict = {"name": name}
1243+
if size is None:
1244+
args_dict["variablesReference"] = variablesReference
1245+
args_dict["frameId"] = stackFrame["id"]
1246+
else:
1247+
args_dict["asAddress"] = True
1248+
args_dict["bytes"] = size
12551249
command_dict = {
12561250
"command": "dataBreakpointInfo",
12571251
"type": "request",

lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
namespace lldb_dap {
1818

19-
static bool CheckAddress(DAP &dap, lldb::addr_t load_addr) {
19+
static bool IsRW(DAP &dap, lldb::addr_t load_addr) {
2020
lldb::SBMemoryRegionInfo region;
2121
lldb::SBError err =
2222
dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
@@ -72,7 +72,7 @@ DataBreakpointInfoRequestHandler::Run(
7272
if (data.IsValid()) {
7373
size = llvm::utostr(data.GetByteSize());
7474
addr = llvm::utohexstr(load_addr);
75-
if (!CheckAddress(dap, load_addr)) {
75+
if (!IsRW(dap, load_addr)) {
7676
is_data_ok = false;
7777
response.description = "memory region for address " + addr +
7878
" has no read or write permissions";
@@ -89,7 +89,7 @@ DataBreakpointInfoRequestHandler::Run(
8989
addr = args.name.substr(2);
9090
else
9191
addr = llvm::utohexstr(std::stoull(args.name));
92-
if (!CheckAddress(dap, std::stoull(addr, 0, 16))) {
92+
if (!IsRW(dap, std::stoull(addr, 0, 16))) {
9393
is_data_ok = false;
9494
response.description = "memory region for address " + addr +
9595
" has no read or write permissions";

0 commit comments

Comments
 (0)