[Lldb-commits] [lldb] [LLDB] Fix Memory64 BaseRVA, move all non-stack memory to Mem64. (PR #146777)
Jacob Lalonde via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 16 12:56:12 PDT 2025
================
@@ -0,0 +1,130 @@
+"""
+Test that saved memory regions is byte-wise 1:1 with the live process. Specifically
+that the memory regions that will be populated in the Memory64List are the same byte for byte.
+"""
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class ProcessSaveCoreMinidump64bTestCase(TestBase):
+ def verify_minidump(
+ self,
+ core_proc,
+ live_proc,
+ options,
+ ):
+ """Verify that the minidump is the same byte for byte as the live process."""
+ # Get the memory regions we saved off in this core, we can't compare to the core
+ # because we pull from /proc/pid/maps, so even ranges that don't get mapped in will show up
+ # as ranges in the minidump.
+ #
+ # Instead, we have an API that returns to us the number of regions we planned to save from the live process
+ # and we compare those
+ memory_regions_to_compare = options.GetMemoryRegionsToSave()
+
+ for region in memory_regions_to_compare:
+ start_addr = region.GetRegionBase()
+ end_addr = region.GetRegionEnd()
+ actual_process_read_error = lldb.SBError()
+ actual = live_proc.ReadMemory(
+ start_addr, end_addr - start_addr, actual_process_read_error
+ )
+ expected_process_read_error = lldb.SBError()
+ expected = core_proc.ReadMemory(
+ start_addr, end_addr - start_addr, expected_process_read_error
+ )
+
+ # Both processes could fail to read a given memory region, so if they both pass
+ # compare, then we'll fail them if the core differs from the live process.
+ if (
+ actual_process_read_error.Success()
+ and expected_process_read_error.Success()
+ ):
+ self.assertEqual(
+ actual, expected, "Bytes differ between live process and core"
+ )
+
+ # Now we check if the error is the same, error isn't abnormal but they should fail for the same reason
+ self.assertTrue(
----------------
Jlalond wrote:
I don't think so, because we can fail to read a region in both the live process and the expected, and we shouldn't fail the test in that case.
https://github.com/llvm/llvm-project/pull/146777
More information about the lldb-commits
mailing list