================
@@ -16,12 +15,61 @@
namespace lldb_dap {
+static llvm::Expected<protocol::DataBreakpointInfoResponseBody>
+HandleDataBreakpointBytes(DAP &dap,
+ const protocol::DataBreakpointInfoArguments &args) {
+ llvm::StringRef address = args.name;
+
+ unsigned long long load_addr = LLDB_INVALID_ADDRESS;
+ if (llvm::getAsUnsignedInteger(address, 0, load_addr)) {
+ return llvm::make_error<DAPError>(llvm::formatv("invalid address"),
+ llvm::inconvertibleErrorCode(), false);
+ }
+
+ lldb::SBAddress sb_addr(load_addr, dap.target);
+ if (!sb_addr.IsValid()) {
+ return llvm::make_error<DAPError>(
+ llvm::formatv("address {:x} does not exist in the debuggee",
load_addr),
+ llvm::inconvertibleErrorCode(), false);
+ }
+
+ const uint32_t byte_size =
+ args.bytes.value_or(dap.target.GetAddressByteSize());
+
+ protocol::DataBreakpointInfoResponseBody response;
+ response.dataId = llvm::formatv("{:x-}/{}", load_addr, byte_size);
+
+ lldb::SBMemoryRegionInfo region;
+ lldb::SBError err =
+ 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() && !(region.IsReadable() || region.IsWritable())) {
+ response.description = llvm::formatv(
+ "memory region for address {} has no read or write permissions",
+ load_addr);
+
+ } else {
+ response.description =
+ llvm::formatv("{} bytes at {:x}", byte_size, load_addr);
+ response.accessTypes = {protocol::eDataBreakpointAccessTypeRead,
----------------
ashgti wrote:
Shouldn't we check the regionInfo for setting these access types?
https://github.com/llvm/llvm-project/pull/141122
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits