[Lldb-commits] [lldb] c577c6c - [lldb] Test undefined return addresses in signal frames (#223046)
via lldb-commits
lldb-commits at lists.llvm.org
Sun Sep 13 15:29:26 PDT 2026
Author: Minsoo Choo
Date: 2026-09-13T18:29:21-04:00
New Revision: c577c6c3f88baddcb2f5368c5cf7f2ca6137b5be
URL: https://github.com/llvm/llvm-project/commit/c577c6c3f88baddcb2f5368c5cf7f2ca6137b5be
DIFF: https://github.com/llvm/llvm-project/commit/c577c6c3f88baddcb2f5368c5cf7f2ca6137b5be.diff
LOG: [lldb] Test undefined return addresses in signal frames (#223046)
Signal-frame CFI can explicitly mark its return-address register
undefined to represent a terminal synthetic context. This is useful for
contexts such as newly created FreeBSD kernel threads that do not have
an interrupted caller.
Verify that LLDB keeps the signal frame in the backtrace and terminates
the unwind without creating a caller.
Assisted-by: GPT
Added:
lldb/test/Shell/Unwind/Inputs/signal-frame-undefined-ra.s
lldb/test/Shell/Unwind/signal-frame-undefined-ra.test
Modified:
Removed:
################################################################################
diff --git a/lldb/test/Shell/Unwind/Inputs/signal-frame-undefined-ra.s b/lldb/test/Shell/Unwind/Inputs/signal-frame-undefined-ra.s
new file mode 100644
index 0000000000000..247584db9dd0a
--- /dev/null
+++ b/lldb/test/Shell/Unwind/Inputs/signal-frame-undefined-ra.s
@@ -0,0 +1,19 @@
+ .att_syntax
+ .text
+ .globl asm_main
+asm_main:
+ .cfi_startproc
+ callq terminal
+ xorl %eax, %eax
+ retq
+ .cfi_endproc
+
+ .globl terminal
+terminal:
+ .cfi_startproc
+ .cfi_signal_frame
+ .cfi_def_cfa %rsp, 8
+ .cfi_undefined %rip
+ int3
+ retq
+ .cfi_endproc
diff --git a/lldb/test/Shell/Unwind/signal-frame-undefined-ra.test b/lldb/test/Shell/Unwind/signal-frame-undefined-ra.test
new file mode 100644
index 0000000000000..5b4ae97d01451
--- /dev/null
+++ b/lldb/test/Shell/Unwind/signal-frame-undefined-ra.test
@@ -0,0 +1,18 @@
+# Test that an undefined return address terminates a signal frame without
+# creating a caller.
+
+# UNSUPPORTED: system-windows
+# REQUIRES: target-x86_64, native
+
+# RUN: %clang_host %p/Inputs/call-asm.c %p/Inputs/signal-frame-undefined-ra.s -o %t
+# RUN: %lldb %t -s %s -o exit | FileCheck %s
+
+breakpoint set -n terminal
+# CHECK: Breakpoint 1: where = {{.*}}`terminal
+
+process launch
+# CHECK: stop reason = breakpoint 1.1
+
+thread backtrace -u
+# CHECK: frame #0: {{.*}}`terminal
+# CHECK-NOT: frame #1:
More information about the lldb-commits
mailing list