[Lldb-commits] [lldb] [LLDB] FIx TestBuiltinDebugTrap all platform with eStopReasonSignal (PR #235516)

via lldb-commits lldb-commits at lists.llvm.org
Sun Oct 25 12:31:59 PDT 2026


https://github.com/aokblast created https://github.com/llvm/llvm-project/pull/235516

__builtin_trap on FreeBSD also generates SIGILL. To provide more generic detection, we workaround all platform that is stopped by signal.

>From bf7ce8dc54776e5c4c622190841936a8b602cab3 Mon Sep 17 00:00:00 2001
From: ShengYi Hung <aokblast at FreeBSD.org>
Date: Mon, 26 Oct 2026 03:26:49 +0800
Subject: [PATCH] [LLDB] Changing the SIGILL handling for FreeBSD also

---
 .../builtin-debugtrap/TestBuiltinDebugTrap.py      | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lldb/test/API/functionalities/builtin-debugtrap/TestBuiltinDebugTrap.py b/lldb/test/API/functionalities/builtin-debugtrap/TestBuiltinDebugTrap.py
index 5b44f4513cd123..41e4f0adae04b0 100644
--- a/lldb/test/API/functionalities/builtin-debugtrap/TestBuiltinDebugTrap.py
+++ b/lldb/test/API/functionalities/builtin-debugtrap/TestBuiltinDebugTrap.py
@@ -58,13 +58,13 @@ def test(self):
         # "global" is now 10.
         self.assertEqual(global_value.GetValueAsUnsigned(), 10)
 
-        # Change the handling of SIGILL on Linux - do not pass it to the
-        # inferior, but stop and notify lldb. If we don't do this, the
-        # inferior will receive the SIGILL and be terminated. On x86_64,
-        # __builtin_trap() emits UD2; on ARM it emits UDF — both generate
-        # SIGILL. AArch64 uses BRK #1 (SIGTRAP, already suppressed by
-        # default), so this is harmless there.
-        if platform == "linux":
+        # Change the handling of SIGILL on the platforms that report traps as
+        # signals (Linux, the BSDs) - do not pass it to the inferior, but stop
+        # and notify lldb. If we don't do this, the inferior will receive the
+        # SIGILL and be terminated. On x86_64, __builtin_trap() emits UD2; on
+        # ARM it emits UDF — both generate SIGILL. AArch64 uses BRK #1
+        # (SIGTRAP, already suppressed by default), so this is harmless there.
+        if platform_stop_reason == lldb.eStopReasonSignal:
             self.runCmd("process handle -p false SIGILL")
 
         # We should be at the same point as before -- cannot advance



More information about the lldb-commits mailing list