[Lldb-commits] [lldb] [lldb] Handle an empty SBMemoryRegionInfo from scripted process (PR #115963)

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 14 22:16:54 PST 2024


================
@@ -6184,7 +6184,14 @@ Status Process::GetMemoryRegionInfo(lldb::addr_t load_addr,
                                     MemoryRegionInfo &range_info) {
   if (const lldb::ABISP &abi = GetABI())
     load_addr = abi->FixAnyAddress(load_addr);
-  return DoGetMemoryRegionInfo(load_addr, range_info);
+  Status error = DoGetMemoryRegionInfo(load_addr, range_info);
+  // Reject a region that does not contain the requested address.
+  if (error.Success() && (range_info.GetRange().GetRangeBase() < load_addr ||
+                          range_info.GetRange().GetRangeEnd() <= load_addr))
----------------
medismailben wrote:

I believe in `range_info.GetRange().GetRangeBase() < load_addr` the sign should be inverted.

You could use directly the `Range::{Contains, ContainsEndInclusive}` instead ?

```suggestion
  if (error.Success() && !range_info.GetRange().ContainsEndInclusive(load_addr))
```

https://github.com/llvm/llvm-project/pull/115963


More information about the lldb-commits mailing list