================ @@ -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 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits