Skip to content

Commit bb76775

Browse files
committed
Add test for UBSan trap fram recognizer
1 parent 616cef0 commit bb76775

File tree

2 files changed

+25
-0
lines changed

2 files changed

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

0 commit comments

Comments
 (0)