https://github.com/anthonyhatran created https://github.com/llvm/llvm-project/pull/151231
@Michael137 @delcypher Part of a GSoC 2025 Project. >From bb767753b00a51fb7757e78f6b45cc556d3d3683 Mon Sep 17 00:00:00 2001 From: Anthony Tran <atran...@usc.edu> Date: Tue, 29 Jul 2025 14:06:48 -0700 Subject: [PATCH] Add test for UBSan trap fram recognizer --- .../Recognizer/Inputs/ubsan_add_overflow.cpp | 8 ++++++++ .../Shell/Recognizer/ubsan_add_overflow.test | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 lldb/test/Shell/Recognizer/Inputs/ubsan_add_overflow.cpp create mode 100644 lldb/test/Shell/Recognizer/ubsan_add_overflow.test diff --git a/lldb/test/Shell/Recognizer/Inputs/ubsan_add_overflow.cpp b/lldb/test/Shell/Recognizer/Inputs/ubsan_add_overflow.cpp new file mode 100644 index 0000000000000..0258ff296ea63 --- /dev/null +++ b/lldb/test/Shell/Recognizer/Inputs/ubsan_add_overflow.cpp @@ -0,0 +1,8 @@ +#include <limits.h> + +int main() { + volatile int a = INT_MAX; + volatile int b = 1; + volatile int c = a + b; + return c; +} \ No newline at end of file diff --git a/lldb/test/Shell/Recognizer/ubsan_add_overflow.test b/lldb/test/Shell/Recognizer/ubsan_add_overflow.test new file mode 100644 index 0000000000000..f9312b5bf15bb --- /dev/null +++ b/lldb/test/Shell/Recognizer/ubsan_add_overflow.test @@ -0,0 +1,17 @@ +# REQUIRES: clang + +# RUN: %clang_host -g -O0 %S/Inputs/ubsan_add_overflow.cpp -o %t.out \ +# RUN: -fsanitize=signed-integer-overflow -fsanitize-trap=signed-integer-overflow + +# RUN: %lldb -b -s %s %t.out | FileCheck %s + +run +# CHECK: thread #{{.*}} stop reason = Undefined Behavior Sanitizer: Integer addition overflowed + +frame info +# CHECK: frame #{{.*}}`main at ubsan_add_overflow.cpp + +frame recognizer info 0 +# CHECK: frame 0 is recognized by Verbose Trap StackFrame Recognizer + +quit \ No newline at end of file _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits