[Lldb-commits] [lldb] ce0e0f0 - Reland "[lldb][minidump][test] Enable more minidump tests on AArch64 (#231467)" (#231474)

via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 13 05:47:16 PDT 2026


Author: David Spickett
Date: 2026-10-13T12:47:10Z
New Revision: ce0e0f047deca346096925a02eefe87e938ed586

URL: https://github.com/llvm/llvm-project/commit/ce0e0f047deca346096925a02eefe87e938ed586
DIFF: https://github.com/llvm/llvm-project/commit/ce0e0f047deca346096925a02eefe87e938ed586.diff

LOG: Reland "[lldb][minidump][test] Enable more minidump tests on AArch64 (#231467)" (#231474)

This reverts commit d9823582cb13b0dd493dd7162457683b24f54e5e.

Some tests were failing when on a Windows host because they tried to
delete the minidump file without deleting the target first. On Windows
you cannot unlink a file that something still has open, that something
being lldb here.

test_save_linux_mini_dump_thread_options cannot work remotely due to a
bug in the save routine. See
https://github.com/llvm/llvm-project/issues/231472.

Added: 
    

Modified: 
    lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
    lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump64b.py
    lldb/test/API/functionalities/process_save_core_minidump_size_of_image/TestMinidumpSizeOfImage.py
    lldb/test/API/tools/lldb-dap/save-core/TestDAP_save_core.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
index 49d262a73c1f4b..34de0f7ad1e384 100644
--- a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
+++ b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
@@ -68,19 +68,21 @@ def verify_core_file(
             self.assertIn(thread_id, stacks_to_registers_map)
             register_val_list = stacks_to_registers_map[thread_id]
             frame_register_list = frame.GetRegisters()
-            # explicitly verify we collected fs and gs base for x86_64
-            general_purpose_registers = frame_register_list.GetValueAtIndex(0)
-            explicit_registers = ["fs_base", "gs_base"]
-            for reg in explicit_registers:
-                register = general_purpose_registers.GetChildMemberWithName(reg)
-                self.assertTrue(register.IsValid())
-                self.assertEqual(
-                    register.GetValueAsUnsigned(),
-                    stacks_to_registers_map[thread_id]
-                    .GetValueAtIndex(0)
-                    .GetChildMemberWithName(reg)
-                    .GetValueAsUnsigned(),
-                )
+
+            if self.getArchitecture() == "x86_64":
+                # explicitly verify we collected fs and gs base for x86_64
+                general_purpose_registers = frame_register_list.GetValueAtIndex(0)
+                explicit_registers = ["fs_base", "gs_base"]
+                for reg in explicit_registers:
+                    register = general_purpose_registers.GetChildMemberWithName(reg)
+                    self.assertTrue(register.IsValid(), f"{reg} is not valid.")
+                    self.assertEqual(
+                        register.GetValueAsUnsigned(),
+                        stacks_to_registers_map[thread_id]
+                        .GetValueAtIndex(0)
+                        .GetChildMemberWithName(reg)
+                        .GetValueAsUnsigned(),
+                    )
 
             # The live process may have had register sets that are not saved to
             # the minidump. Even when a set is saved, it may not be complete.
@@ -91,7 +93,7 @@ def verify_core_file(
                 self.assertTrue(register_val_regset.IsValid())
                 for reg in frame_regset:
                     reg_name = reg.GetName()
-                    if reg_name == "sp":
+                    if self.getArchitecture() == "x86_64" and reg_name == "sp":
                         # No way to get "sp" because it always gets redirected to
                         # "rsp". https://github.com/llvm/llvm-project/issues/212778
                         continue
@@ -106,17 +108,33 @@ def verify_core_file(
 
                     self.assertEqual(reg.IsValid(), register_val_reg.IsValid())
 
-                    if reg_name in ["xmm13", "fctrl", "ftag", "mxcsr", "mxcsrmask"]:
+                    if self.getArchitecture() == "x86_64":
+                        known_mismatches = [
+                            "xmm13",
+                            "fctrl",
+                            "ftag",
+                            "mxcsr",
+                            "mxcsrmask",
+                        ]
+                    elif self.getArchitecture() == "aarch64":
+                        known_mismatches = [
+                            *[f"d{n}" for n in range(32)],
+                            *[f"s{n}" for n in range(32)],
+                        ]
+
+                    if reg_name in known_mismatches:
                         # These values are "valid", but 
diff erent from the live process.
                         continue
 
                     self.assertEqual(
-                        reg.GetValueAsUnsigned(), register_val_reg.GetValueAsUnsigned()
+                        reg.GetValueAsUnsigned(),
+                        register_val_reg.GetValueAsUnsigned(),
+                        f"Values for register {reg_name} did not match.",
                     )
 
         self.dbg.DeleteTarget(target)
 
-    @skipUnlessArch("x86_64")
+    @skipIf(archs=no_match(["x86_64", "aarch64"]))
     @skipUnlessPlatform(["linux"])
     def test_save_linux_mini_dump(self):
         """Test that we can save a Linux mini dump."""
@@ -261,8 +279,11 @@ def test_save_linux_mini_dump(self):
             if os.path.isfile(core_sb_full):
                 os.unlink(core_sb_full)
 
-    @skipUnlessArch("x86_64")
+    @skipIf(archs=no_match(["x86_64", "aarch64"]))
     @skipUnlessPlatform(["linux"])
+    # We try to read Linux /proc files from the host not the remote:
+    # https://github.com/llvm/llvm-project/issues/231472
+    @skipIfRemote
     def test_save_linux_mini_dump_thread_options(self):
         """Test that we can save a Linux mini dump
         with a subset of threads"""
@@ -270,6 +291,8 @@ def test_save_linux_mini_dump_thread_options(self):
         self.build()
         exe = self.getBuildArtifact("a.out")
         thread_subset_dmp = self.getBuildArtifact("core.thread.subset.dmp")
+        core_target = None
+        target = None
         try:
             target = self.dbg.CreateTarget(exe)
             process = target.LaunchSimple(
@@ -312,11 +335,14 @@ def test_save_linux_mini_dump_thread_options(self):
             )
 
         finally:
-            self.assertTrue(self.dbg.DeleteTarget(target))
+            if target:
+                self.assertTrue(self.dbg.DeleteTarget(target))
+            if core_target:
+                self.assertTrue(self.dbg.DeleteTarget(core_target))
             if os.path.isfile(thread_subset_dmp):
                 os.unlink(thread_subset_dmp)
 
-    @skipUnlessArch("x86_64")
+    @skipIf(archs=no_match(["x86_64", "aarch64"]))
     @skipUnlessPlatform(["linux"])
     def test_save_linux_mini_dump_default_options(self):
         """Test that we can save a Linux mini dump with default SBSaveCoreOptions"""
@@ -372,7 +398,7 @@ def test_save_linux_mini_dump_default_options(self):
             if os.path.isfile(default_value_file):
                 os.unlink(default_value_file)
 
-    @skipUnlessArch("x86_64")
+    @skipIf(archs=no_match(["x86_64", "aarch64"]))
     @skipUnlessPlatform(["linux"])
     def test_save_linux_minidump_one_region(self):
         """Test that we can save a Linux mini dump with one region in sbsavecore regions"""
@@ -430,7 +456,7 @@ def test_save_linux_minidump_one_region(self):
             if os.path.isfile(one_region_file):
                 os.unlink(one_region_file)
 
-    @skipUnlessArch("x86_64")
+    @skipIf(archs=no_match(["x86_64", "aarch64"]))
     @skipUnlessPlatform(["linux"])
     def test_save_minidump_custom_save_style(self):
         """Test that verifies a custom and unspecified save style fails for
@@ -463,8 +489,9 @@ def test_save_minidump_custom_save_style(self):
                 os.unlink(custom_file)
 
     def save_core_with_region(self, process, region_index):
+        custom_file = self.getBuildArtifact("core.custom.dmp")
+        core_target = None
         try:
-            custom_file = self.getBuildArtifact("core.custom.dmp")
             memory_region = lldb.SBMemoryRegionInfo()
             memory_list = process.GetMemoryRegions()
             memory_list.GetMemoryRegionAtIndex(0, memory_region)
@@ -494,10 +521,12 @@ def save_core_with_region(self, process, region_index):
                 )
                 range_set.add(mem_tuple)
         finally:
+            if core_target:
+                self.assertTrue(self.dbg.DeleteTarget(core_target))
             if os.path.isfile(custom_file):
                 os.unlink(custom_file)
 
-    @skipUnlessArch("x86_64")
+    @skipIf(archs=no_match(["x86_64", "aarch64"]))
     @skipUnlessPlatform(["linux"])
     def test_save_minidump_custom_save_style_duplicated_regions(self):
         """Test that verifies a custom and unspecified save style fails for
@@ -666,13 +695,15 @@ def test_minidump_saves_tls(self):
             if os.path.isfile(tls_file):
                 os.unlink(tls_file)
 
+    @skipIf(archs=no_match(["x86_64", "aarch64"]))
     @skipUnlessPlatform(["linux"])
-    @skipUnlessArch("x86_64")
     def test_invalid_custom_regions_not_included(self):
         options = lldb.SBSaveCoreOptions()
         self.build()
         exe = self.getBuildArtifact("a.out")
         output_file = self.getBuildArtifact("no_empty_regions.dmp")
+        target = None
+        core_target = None
         try:
             target = self.dbg.CreateTarget(exe)
             process = target.LaunchSimple(
@@ -702,5 +733,9 @@ def test_invalid_custom_regions_not_included(self):
             )
             self.assertNotIn(empty_region, core_process.GetMemoryRegions())
         finally:
+            if target:
+                self.assertTrue(self.dbg.DeleteTarget(target))
+            if core_target:
+                self.assertTrue(self.dbg.DeleteTarget(core_target))
             if os.path.isfile(output_file):
                 os.unlink(output_file)

diff  --git a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump64b.py b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump64b.py
index 22cc578d2d6ce4..b59fd0391cb05f 100644
--- a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump64b.py
+++ b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump64b.py
@@ -72,7 +72,7 @@ def verify_minidump(
             if core_target is not None:
                 self.assertTrue(self.dbg.DeleteTarget(core_target))
 
-    @skipUnlessArch("x86_64")
+    @skipIf(archs=no_match(["x86_64", "aarch64"]))
     @skipUnlessPlatform(["linux"])
     def test_minidump_save_style_full(self):
         """Test that a full minidump is the same byte for byte."""
@@ -87,7 +87,7 @@ def test_minidump_save_style_full(self):
             if os.path.isfile(minidump_path):
                 os.unlink(minidump_path)
 
-    @skipUnlessArch("x86_64")
+    @skipIf(archs=no_match(["x86_64", "aarch64"]))
     @skipUnlessPlatform(["linux"])
     def test_minidump_save_style_mixed_memory(self):
         """Test that a mixed memory minidump is the same byte for byte."""

diff  --git a/lldb/test/API/functionalities/process_save_core_minidump_size_of_image/TestMinidumpSizeOfImage.py b/lldb/test/API/functionalities/process_save_core_minidump_size_of_image/TestMinidumpSizeOfImage.py
index c029f4ad36aaf0..064e257d84492b 100644
--- a/lldb/test/API/functionalities/process_save_core_minidump_size_of_image/TestMinidumpSizeOfImage.py
+++ b/lldb/test/API/functionalities/process_save_core_minidump_size_of_image/TestMinidumpSizeOfImage.py
@@ -118,7 +118,7 @@ def get_expected_size(self, target, module):
 
         return total
 
-    @skipUnlessArch("x86_64")
+    @skipIf(archs=no_match(["x86_64", "aarch64"]))
     @skipUnlessPlatform(["linux"])
     def test_size_of_image_with_contiguous_segments(self):
         """Test SizeOfImage is correct for a module with contiguous segments."""

diff  --git a/lldb/test/API/tools/lldb-dap/save-core/TestDAP_save_core.py b/lldb/test/API/tools/lldb-dap/save-core/TestDAP_save_core.py
index 5bee8300a6ec8e..556b358b192fd8 100644
--- a/lldb/test/API/tools/lldb-dap/save-core/TestDAP_save_core.py
+++ b/lldb/test/API/tools/lldb-dap/save-core/TestDAP_save_core.py
@@ -13,7 +13,7 @@
 class TestDAP_save_core(DAPTestCaseBase):
     SHARED_BUILD_TESTCASE = False
 
-    @skipUnlessArch("x86_64")
+    @skipIf(archs=no_match(["x86_64", "aarch64"]))
     @requireLinux
     def test_save_and_reload_core(self):
         """Save minidump cores in every supported `--style` from a single


        


More information about the lldb-commits mailing list