Skip to content

Commit a8d0ae3

Browse files
[lldb][test][NFC] Add LLDB test for UBSan trap frame recognizer (#151231)
In #145967 Clang was taught to emit trap reasons on UBSan traps in debug info using the same method as `__builtin_verbose_trap`. This patch adds a test case to make sure that the existing "Verbose Trap StackFrame Recognizer" recognizes the trap reason and sets the stop reason and stack frame appropriately. Part of a GSoC 2025 Project.
1 parent b00d4f2 commit a8d0ae3

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include <limits.h>
2+
3+
int main() { return INT_MAX + 1; }
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# RUN: %clang_host -g -O0 %S/Inputs/ubsan_add_overflow.c -o %t.out \
2+
# RUN: -fsanitize=signed-integer-overflow -fsanitize-trap=signed-integer-overflow
3+
4+
# RUN: %lldb -b -s %s %t.out | FileCheck %s
5+
6+
run
7+
# CHECK: thread #{{.*}} stop reason = Undefined Behavior Sanitizer: Integer addition overflowed
8+
# CHECK-NEXT: frame #1: {{.*}}`main at ubsan_add_overflow.c
9+
10+
bt
11+
# CHECK: frame #0: {{.*}}`__clang_trap_msg$Undefined Behavior Sanitizer$Integer addition overflowed{{.*}}
12+
# CHECK: frame #1: {{.*}}`main at ubsan_add_overflow.c
13+
14+
frame info
15+
# CHECK: frame #{{.*}}`main at ubsan_add_overflow.c
16+
17+
frame recognizer info 0
18+
# CHECK: frame 0 is recognized by Verbose Trap StackFrame Recognizer
19+
20+
quit

0 commit comments

Comments
 (0)