diff options
| author | Kostya Serebryany <kcc@google.com> | 2017-08-02 18:48:45 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2017-08-02 18:48:45 +0000 |
| commit | 1ca948a2b4aec23e9fdb8cac96df941828c845dc (patch) | |
| tree | d70e1b536312b240bbbe9baf3fa768f78827aec7 /compiler-rt/lib | |
| parent | 33aef072c1b81ed879b454de0b598d373c656762 (diff) | |
| download | bcm5719-llvm-1ca948a2b4aec23e9fdb8cac96df941828c845dc.tar.gz bcm5719-llvm-1ca948a2b4aec23e9fdb8cac96df941828c845dc.zip | |
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
llvm-svn: 309854
Diffstat (limited to 'compiler-rt/lib')
| -rw-r--r-- | compiler-rt/lib/asan/asan_flags.inc | 4 | ||||
| -rw-r--r-- | compiler-rt/lib/asan/asan_rtl.cc | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/asan_flags.inc b/compiler-rt/lib/asan/asan_flags.inc index f2216c2e9b3..19ebc696edc 100644 --- a/compiler-rt/lib/asan/asan_flags.inc +++ b/compiler-rt/lib/asan/asan_flags.inc @@ -79,6 +79,10 @@ ASAN_FLAG( "Number of seconds to sleep between printing an error report and " "terminating the program. Useful for debugging purposes (e.g. when one " "needs to attach gdb).") +ASAN_FLAG( + int, sleep_after_init, 0, + "Number of seconds to sleep after AddressSanitizer is initialized. " + "Useful for debugging purposes (e.g. when one needs to attach gdb).") ASAN_FLAG(bool, check_malloc_usable_size, true, "Allows the users to work around the bug in Nvidia drivers prior to " "295.*.") diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc index 376c50b5862..c75a4639977 100644 --- a/compiler-rt/lib/asan/asan_rtl.cc +++ b/compiler-rt/lib/asan/asan_rtl.cc @@ -484,6 +484,11 @@ static void AsanInitInternal() { } VReport(1, "AddressSanitizer Init done\n"); + + if (flags()->sleep_after_init) { + Report("Sleeping for %d second(s)\n", flags()->sleep_after_init); + SleepForSeconds(flags()->sleep_after_init); + } } // Initialize as requested from some part of ASan runtime library (interceptors, |

