================
@@ -58,24 +76,26 @@ DataBreakpointInfoRequestHandler::Run(
       if (data.IsValid()) {
         size = llvm::utostr(data.GetByteSize());
         addr = llvm::utohexstr(load_addr);
-        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()) {
-          if (!(region.IsReadable() || region.IsWritable())) {
-            is_data_ok = false;
-            response.description = "memory region for address " + addr +
-                                   " has no read or write permissions";
-          }
+        if (!IsRW(dap, load_addr)) {
+          is_data_ok = false;
+          response.description = "memory region for address " + addr +
+                                 " has no read or write permissions";
         }
       } else {
         is_data_ok = false;
         response.description =
             "unable to get byte size for expression: " + args.name;
       }
     }
+  } else if (args.asAddress) {
+    size = llvm::utostr(args.bytes.value_or(dap.target.GetAddressByteSize()));
+    lldb::addr_t load_addr;
+    if (llvm::StringRef(args.name).getAsInteger<lldb::addr_t>(0, load_addr))
+      return llvm::make_error<DAPError>(args.name + " is not a valid address");
+    addr = llvm::utohexstr(load_addr);
+    if (!IsRW(dap, load_addr))
+      return llvm::make_error<DAPError>("memory region for address " + addr +
+                                        " has no read or write permissions");
----------------
da-viper wrote:

```suggestion
    size = llvm::utostr(args.bytes.value_or(dap.target.GetAddressByteSize()));
    lldb::addr_t load_addr = LLDB_INVALID_ADDRESS;
    if (llvm::StringRef(args.name).getAsInteger<lldb::addr_t>(0, load_addr))
      return llvm::make_error<DAPError>(args.name + " is not a valid address",
                                        llvm::inconvertibleErrorCode(), false);
    addr = llvm::utohexstr(load_addr);
    if (!IsRW(dap, load_addr))
      return llvm::make_error<DAPError>("memory region for address " +
                                            args.name +
                                            " has no read or write permissions",
                                        llvm::inconvertibleErrorCode(), false);
```
It is shown twice, mark `show_user` as false. 

<img width="481" height="123" alt="Image" 
src="https://github.com/user-attachments/assets/77fe032c-da24-4d5b-89de-e51757aab5b5";
 />

https://github.com/llvm/llvm-project/pull/167237
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to