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

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 14 23:32:57 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))
----------------
jasonmolenda wrote:

Ah, you did catch a mistake there, thanks.  I was focusing on "lookup of 0, get back range start 0x0 size 0" and this check happens to work correctly for that, but this should be `(range_info.GetRange().GetRangeBase() < load_addr || range_info.GetRange().GetRangeEnd() >= load_addr)`.  `ContainsEndInclusive` isn't correct, but the `Contains` method is, good call.

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


More information about the lldb-commits mailing list