summaryrefslogtreecommitdiff
path: root/test/asan
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2017-08-02 18:48:45 +0000
committerKostya Serebryany <kcc@google.com>2017-08-02 18:48:45 +0000
commitf6f49c0e05d1847dfd55d87a683140d991c9c6c1 (patch)
treee8396927338bee96fec1612d8b9b0118083d2fd1 /test/asan
parente4760795708443dbbdb724bdcdc24a828fef1aa1 (diff)
Add new ASAN_OPTION: sleep_after_init.
Summary: As mentioned in https://github.com/google/sanitizers/issues/834, suggested option can be handy for debugging. Reviewers: kcc Reviewed By: kcc Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D35409 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309854 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/asan')
-rw-r--r--test/asan/TestCases/sleep_after_init.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/asan/TestCases/sleep_after_init.c b/test/asan/TestCases/sleep_after_init.c
new file mode 100644
index 000000000..147af67c7
--- /dev/null
+++ b/test/asan/TestCases/sleep_after_init.c
@@ -0,0 +1,10 @@
+// RUN: %clang_asan -O2 %s -o %t
+// RUN: %env_asan_opts=sleep_after_init=1 not %run %t 2>&1 | FileCheck %s
+
+#include <stdlib.h>
+int main() {
+ // CHECK: Sleeping for 1 second
+ char *x = (char*)malloc(10 * sizeof(char));
+ free(x);
+ return x[5];
+}