[Lldb-commits] [lldb] 7b040d0 - [lldb-dap] Don't fail when SBProcess::GetMemoryRegionInfo returns error. (#87649)
via lldb-commits
lldb-commits at lists.llvm.org
Mon May 6 06:55:27 PDT 2024
Author: Zequan Wu
Date: 2024-05-06T09:55:23-04:00
New Revision: 7b040d01c59505d62d4700c75b0438269a0f7bb4
URL: https://github.com/llvm/llvm-project/commit/7b040d01c59505d62d4700c75b0438269a0f7bb4
DIFF: https://github.com/llvm/llvm-project/commit/7b040d01c59505d62d4700c75b0438269a0f7bb4.diff
LOG: [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.
Added:
Modified:
lldb/tools/lldb-dap/lldb-dap.cpp
Removed:
################################################################################
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 8000d68dea7e36..cf52a22b18cc14 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -2774,32 +2774,28 @@ void request_dataBreakpointInfo(const llvm::json::Object &request) {
: "evaluation failed");
} else {
uint64_t load_addr = value.GetValueAsUnsigned();
- addr = llvm::utohexstr(load_addr);
- lldb::SBMemoryRegionInfo region;
- lldb::SBError err =
- g_dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
- if (err.Success()) {
- if (!(region.IsReadable() || region.IsWritable())) {
- body.try_emplace("dataId", nullptr);
- body.try_emplace("description",
- "memory region for address " + addr +
- " has no read or write permissions");
- } else {
- lldb::SBData data = value.GetPointeeData();
- if (data.IsValid())
- size = llvm::utostr(data.GetByteSize());
- else {
+ lldb::SBData data = value.GetPointeeData();
+ if (data.IsValid()) {
+ size = llvm::utostr(data.GetByteSize());
+ addr = llvm::utohexstr(load_addr);
+ lldb::SBMemoryRegionInfo region;
+ lldb::SBError err =
+ g_dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
+ // Only lldb-server supports "qMemoryRegionInfo". So, don't fail this
+ // request if SBProcess::GetMemoryRegionInfo returns error.
+ if (err.Success()) {
+ if (!(region.IsReadable() || region.IsWritable())) {
body.try_emplace("dataId", nullptr);
body.try_emplace("description",
- "unable to get byte size for expression: " +
- name.str());
+ "memory region for address " + addr +
+ " has no read or write permissions");
}
}
} else {
body.try_emplace("dataId", nullptr);
body.try_emplace("description",
- "unable to get memory region info for address " +
- addr);
+ "unable to get byte size for expression: " +
+ name.str());
}
}
} else {
More information about the lldb-commits
mailing list