[Lldb-commits] [lldb] [lldb][test] Recognize a Wasm trap as a crash (PR #213551)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Sun Aug 2 09:24:47 PDT 2026


https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/213551

is_thread_crashed maps how each platform reports the bad access the test suite uses to simulate a crash, and had no case for Wasm, where there are no signals and a bad access raises a trap that a runtime reports as an exception. Without one it fell through to a description match that never held, so a crashed thread read as running fine.

>From 5ad5dfa0dae188637fa47b3bca205a8ca2412ba3 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Sat, 1 Aug 2026 23:45:15 -0700
Subject: [PATCH] [lldb][test] Recognize a Wasm trap as a crash

is_thread_crashed maps how each platform reports the bad access the test suite
uses to simulate a crash, and had no case for Wasm, where there are no signals
and a bad access raises a trap that a runtime reports as an exception. Without
one it fell through to a description match that never held, so a crashed thread
read as running fine.
---
 lldb/packages/Python/lldbsuite/test/lldbutil.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index f2e0b013f8402..78f7155ee2507 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -979,6 +979,10 @@ def is_thread_crashed(test, thread):
         )
     elif test.getPlatform() == "windows":
         return "Exception 0xc0000005" in thread.GetStopDescription(200)
+    elif test.getPlatform() in ["wasip1", "wasi"]:
+        # Wasm has no signals. What a bad access raises is a trap, which a
+        # runtime reports as an exception described by the trap it hit.
+        return thread.GetStopReason() == lldb.eStopReasonException
     else:
         return "invalid address" in thread.GetStopDescription(100)
 



More information about the lldb-commits mailing list