Skip to content

Commit 7b040d0

Browse files
authored
[lldb-dap] Don't fail when SBProcess::GetMemoryRegionInfo returns error. (#87649)
`SBProcess::GetMemoryRegionInfo` uses `qMemoryRegionInfo` packet to get memory region info, but this is not supported in gdb-server and causing downstream lldb test failures. This change ignores the the error from `SBProcess::GetMemoryRegionInfo` . Reported by @tedwoodward @jerinphilip.
1 parent d71771d commit 7b040d0

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

lldb/tools/lldb-dap/lldb-dap.cpp

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2774,32 +2774,28 @@ void request_dataBreakpointInfo(const llvm::json::Object &request) {
27742774
: "evaluation failed");
27752775
} else {
27762776
uint64_t load_addr = value.GetValueAsUnsigned();
2777-
addr = llvm::utohexstr(load_addr);
2778-
lldb::SBMemoryRegionInfo region;
2779-
lldb::SBError err =
2780-
g_dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
2781-
if (err.Success()) {
2782-
if (!(region.IsReadable() || region.IsWritable())) {
2783-
body.try_emplace("dataId", nullptr);
2784-
body.try_emplace("description",
2785-
"memory region for address " + addr +
2786-
" has no read or write permissions");
2787-
} else {
2788-
lldb::SBData data = value.GetPointeeData();
2789-
if (data.IsValid())
2790-
size = llvm::utostr(data.GetByteSize());
2791-
else {
2777+
lldb::SBData data = value.GetPointeeData();
2778+
if (data.IsValid()) {
2779+
size = llvm::utostr(data.GetByteSize());
2780+
addr = llvm::utohexstr(load_addr);
2781+
lldb::SBMemoryRegionInfo region;
2782+
lldb::SBError err =
2783+
g_dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
2784+
// Only lldb-server supports "qMemoryRegionInfo". So, don't fail this
2785+
// request if SBProcess::GetMemoryRegionInfo returns error.
2786+
if (err.Success()) {
2787+
if (!(region.IsReadable() || region.IsWritable())) {
27922788
body.try_emplace("dataId", nullptr);
27932789
body.try_emplace("description",
2794-
"unable to get byte size for expression: " +
2795-
name.str());
2790+
"memory region for address " + addr +
2791+
" has no read or write permissions");
27962792
}
27972793
}
27982794
} else {
27992795
body.try_emplace("dataId", nullptr);
28002796
body.try_emplace("description",
2801-
"unable to get memory region info for address " +
2802-
addr);
2797+
"unable to get byte size for expression: " +
2798+
name.str());
28032799
}
28042800
}
28052801
} else {

0 commit comments

Comments
 (0)