[Lldb-commits] [lldb] Centralize the code that figures out which memory ranges to save into core files (PR #71772)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 9 11:22:31 PST 2023
================
@@ -6252,3 +6243,188 @@ Status Process::WriteMemoryTags(lldb::addr_t addr, size_t len,
return DoWriteMemoryTags(addr, len, tag_manager->GetAllocationTagType(),
*packed_tags);
}
+
+// Create a CoreFileMemoryRange from a MemoryRegionInfo
+static Process::CoreFileMemoryRange
+CreateCoreFileMemoryRange(const MemoryRegionInfo ®ion) {
+ const addr_t addr = region.GetRange().GetRangeBase();
+ llvm::AddressRange range(addr, addr + region.GetRange().GetByteSize());
+ return {range, region.GetLLDBPermissions()};
+}
+
+// Add dirty pages to the core file ranges and return true if dirty pages
+// were added. Return false if the dirty page information is not valid or in
+// the region.
+static bool AddDirtyPages(const MemoryRegionInfo ®ion,
----------------
clayborg wrote:
We aren't going to propagate the error, we just need to know if it succeeded or not, so I didn't have it return an error. Otherwise every single range from a linux lldb-server will return an error "dirty pages not supported". For Darwin we added special extra features to track dirty pages, but no one else has these. Again, I can add an error here, but I will just end up consuming the error because lack of dirty page information isn't going to stop a core file from being created. Also many regions on mac will not have any dirty pages if they don't have write permissions, so most regions would end up returning an error, which again, we won't do anything with, we will just ignore.
https://github.com/llvm/llvm-project/pull/71772
More information about the lldb-commits
mailing list