[Lldb-commits] [lldb] [lldb-dap] Followup fixs for data breakpoints (PR #81680)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 13 17:01:51 PST 2024
================
@@ -2757,13 +2769,18 @@ void request_dataBreakpointInfo(const llvm::json::Object &request) {
body.try_emplace("description", error_cstr && error_cstr[0]
? std::string(error_cstr)
: "evaluation failed");
- } else
- addr = llvm::utohexstr(value.GetValueAsUnsigned());
+ } else {
+ uint64_t value_as_unsigned = value.GetValueAsUnsigned();
+ if (value_as_unsigned == 0) {
+ body.try_emplace("dataId", nullptr);
+ body.try_emplace("description",
+ "unable to evaluate expression to an address.");
+ }
+ addr = llvm::utohexstr(value_as_unsigned);
+ }
----------------
clayborg wrote:
For any address we come up with, it is probably a good idea to find the memory region that contains it and verify we have at least some permissions. You can take any uint64_t address and find the region by doing:
```
uint64_t 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("description", "memory region for address <addr> has no read or write permissions");
}
} else {
body.try_emplace("description", "unable to get memory region info for address <addr>");
}
```
https://github.com/llvm/llvm-project/pull/81680
More information about the lldb-commits
mailing list