[Lldb-commits] [lldb] [LLDB][SBSaveCore] Sbsavecore subregions bug (PR #138206)

David Peixotto via lldb-commits lldb-commits at lists.llvm.org
Thu May 1 15:35:33 PDT 2025


================
@@ -6689,6 +6689,25 @@ static void GetCoreFileSaveRangesStackOnly(Process &process,
   }
 }
 
+// TODO: We should refactor CoreFileMemoryRanges to use the lldb range type, and
+// then add an intersect method on it, or MemoryRegionInfo.
+static MemoryRegionInfo
+Intersect(const MemoryRegionInfo &lhs,
+          const Range<lldb::addr_t, lldb::addr_t> &rhs) {
+  const lldb::addr_t lhs_base = lhs.GetRange().GetRangeBase();
+  const lldb::addr_t rhs_base = rhs.GetRangeBase();
+  const lldb::addr_t lhs_end = lhs.GetRange().GetRangeEnd();
+  const lldb::addr_t rhs_end = rhs.GetRangeEnd();
+
+  MemoryRegionInfo region_info;
+  region_info.SetLLDBPermissions(lhs.GetLLDBPermissions());
----------------
dmpots wrote:

Could we write this as

```
MemoryRegionInfo region_info = lhs;
region_info.GetRange() = lhs.GetRange().Intersect(rhs);
```

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


More information about the lldb-commits mailing list