[Lldb-commits] [lldb] [lldb][AArch64][Linux] Add tests for SME only core files (PR #189985)

via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 1 08:53:07 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)

<details>
<summary>Changes</summary>

Part of #<!-- -->138717.

This did not require any changes to core file handling. Since a static snapshot of an SME only system looks pretty much the same as one from the same state on a system with SVE and SME.

For this reason, we're only testing 2 combinations. In total these include streaming and non-streaming, ZA on and off, and 2 different vector lengths. I think this is enough to prove that the existing code is working.

---
Full diff: https://github.com/llvm/llvm-project/pull/189985.diff


4 Files Affected:

- (modified) lldb/test/API/linux/aarch64/sme_only_registers/TestSMEOnlyRegisters.py (+25) 
- (added) lldb/test/API/linux/aarch64/sme_only_registers/core_simd_on_32 () 
- (added) lldb/test/API/linux/aarch64/sme_only_registers/core_streaming_off_64 () 
- (modified) lldb/test/API/linux/aarch64/sme_only_registers/main.c (+8-3) 


``````````diff
diff --git a/lldb/test/API/linux/aarch64/sme_only_registers/TestSMEOnlyRegisters.py b/lldb/test/API/linux/aarch64/sme_only_registers/TestSMEOnlyRegisters.py
index 9f2ca64267eb2..0cb4aa57c1922 100644
--- a/lldb/test/API/linux/aarch64/sme_only_registers/TestSMEOnlyRegisters.py
+++ b/lldb/test/API/linux/aarch64/sme_only_registers/TestSMEOnlyRegisters.py
@@ -552,3 +552,28 @@ def test_expr_restore(self):
             check_expected_regs()
 
             self.runCmd("process kill")
+
+    # Core files are produced by running the test program on an SME only system
+    # with the extra argument "crash". For example:
+    # $ ./test simd on 32 crash
+    #
+    # Each file is named after the arguments used to create it.
+    # /proc/self/coredump_filter was set to 0.
+    #
+    # We do not test all combinations of state because unlike a live process,
+    # we do not have to handle state transitions when debugging a core file.
+    # To get reasonable coverage I have chosen 2 configurations that include
+    # streaming and non-streaming mode, ZA on and off and 2 different vector
+    # lengths.
+
+    @skipIfLLVMTargetMissing("AArch64")
+    def test_sme_only_core_simd_za_on_vl_32(self):
+        self.runCmd("target create --core core_simd_on_32")
+        expected_registers = self.expected_registers(32, Mode.SIMD, ZA.ON)
+        self.check_expected_regs_fn(expected_registers)()
+
+    @skipIfLLVMTargetMissing("AArch64")
+    def test_sme_only_core_streaming_za_off_vl_64(self):
+        self.runCmd("target create --core core_streaming_off_64")
+        expected_registers = self.expected_registers(64, Mode.SSVE, ZA.OFF)
+        self.check_expected_regs_fn(expected_registers)()
diff --git a/lldb/test/API/linux/aarch64/sme_only_registers/core_simd_on_32 b/lldb/test/API/linux/aarch64/sme_only_registers/core_simd_on_32
new file mode 100644
index 0000000000000..51cc4070f1e9f
Binary files /dev/null and b/lldb/test/API/linux/aarch64/sme_only_registers/core_simd_on_32 differ
diff --git a/lldb/test/API/linux/aarch64/sme_only_registers/core_streaming_off_64 b/lldb/test/API/linux/aarch64/sme_only_registers/core_streaming_off_64
new file mode 100644
index 0000000000000..15a0e8c81a214
Binary files /dev/null and b/lldb/test/API/linux/aarch64/sme_only_registers/core_streaming_off_64 differ
diff --git a/lldb/test/API/linux/aarch64/sme_only_registers/main.c b/lldb/test/API/linux/aarch64/sme_only_registers/main.c
index e6df75a69dd20..f5e43a5a18208 100644
--- a/lldb/test/API/linux/aarch64/sme_only_registers/main.c
+++ b/lldb/test/API/linux/aarch64/sme_only_registers/main.c
@@ -435,9 +435,11 @@ ProcessState get_initial_state(const char *mode, const char *za,
 }
 
 int main(int argc, char *argv[]) {
-  if (argc != 4) {
-    printf("Expected 3 arguments, process mode, za on or off, streaming vector "
-           "length\n");
+  if (argc != 4 && argc != 5) {
+    printf(
+        "Expected at least 3 arguments, process mode, za on or off, streaming "
+        "vector "
+        "length. Optionally ending with \"crash\" to generate a core file.\n");
     exit(1);
   }
 
@@ -473,6 +475,9 @@ int main(int argc, char *argv[]) {
     write_sme_regs(svl_b);
   }
 
+  if ((argc == 5) && strcmp("crash", argv[4]) == 0)
+    __builtin_trap();
+
   // The number of these is greater than or equal to the number of "next"
   // each lldb test issues. The
   // idea is that lldb will write register values in, updated the expected

``````````

</details>


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


More information about the lldb-commits mailing list