summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common
diff options
context:
space:
mode:
authorSergey Matveev <earthdok@google.com>2013-08-01 14:57:07 +0000
committerSergey Matveev <earthdok@google.com>2013-08-01 14:57:07 +0000
commit6459a370a707f8753cc422ee22bda862e7cb69c9 (patch)
tree0f7c7c07921a8f2e9eca818df94ad376add19ca8 /compiler-rt/lib/sanitizer_common
parent9688ff197e99734015c4225de9ffe528c5ffdaec (diff)
downloadbcm5719-llvm-6459a370a707f8753cc422ee22bda862e7cb69c9.tar.gz
bcm5719-llvm-6459a370a707f8753cc422ee22bda862e7cb69c9.zip
[lsan] Add leak_check_at_exit flag.
We needed a way to tell LSan to invoke leak checking only if __do_leak_check() is called explicitly. This can now be achieved by setting leak_check_at_exit=false. llvm-svn: 187578
Diffstat (limited to 'compiler-rt/lib/sanitizer_common')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_flags.cc1
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_flags.h4
2 files changed, 5 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc
index ed7336a75ee..6ca3247b1e9 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc
@@ -30,6 +30,7 @@ void ParseCommonFlagsFromString(const char *str) {
ParseFlag(str, &f->handle_ioctl, "handle_ioctl");
ParseFlag(str, &f->log_path, "log_path");
ParseFlag(str, &f->detect_leaks, "detect_leaks");
+ ParseFlag(str, &f->leak_check_at_exit, "leak_check_at_exit");
}
static bool GetFlagValue(const char *env, const char *name,
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.h b/compiler-rt/lib/sanitizer_common/sanitizer_flags.h
index f3f4a26f05e..d1a2961b68a 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.h
@@ -41,6 +41,10 @@ struct CommonFlags {
const char *log_path;
// Enable memory leak detection.
bool detect_leaks;
+ // Invoke leak checking in an atexit handler. Has no effect if
+ // detect_leaks=false, or if __lsan_do_leak_check() is called before the
+ // handler has a chance to run.
+ bool leak_check_at_exit;
};
extern CommonFlags common_flags_dont_use_directly;
OpenPOWER on IntegriCloud