Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lldb/test/Shell/Recognizer/Inputs/ubsan_add_overflow.cpp
Original file line number Diff line number Diff line change
@@ -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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be done in one line. return INT_MAX + 1; assuming INT_MAX defaults to unsigned int still.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it into one line.

}
17 changes: 17 additions & 0 deletions lldb/test/Shell/Recognizer/ubsan_add_overflow.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# REQUIRES: clang

# RUN: %clang_host -g -O0 %S/Inputs/ubsan_add_overflow.cpp -o %t.out \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I have a feeling this doesn't need to be host, because the shell tests can be run remotely. I looked at the other tests and they are all %clang_host though.

So this is not an issue with this test it's with a category of tests. Which is not your responsibility, so you don't need to change anything here.

# RUN: -fsanitize=signed-integer-overflow -fsanitize-trap=signed-integer-overflow
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets indent here to make it easier to read

Suggested change
# RUN: -fsanitize=signed-integer-overflow -fsanitize-trap=signed-integer-overflow
# RUN: -fsanitize=signed-integer-overflow -fsanitize-trap=signed-integer-overflow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added


# 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
Loading