summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSergey Matveev <earthdok@google.com>2014-05-12 14:27:36 +0000
committerSergey Matveev <earthdok@google.com>2014-05-12 14:27:36 +0000
commit5b1946bd1461d64b7f4cd036504b0d10314824a1 (patch)
treea9ed0c795354026ca22c4dc8d4c9ef1d15368e53 /lib
parent16b90715795dc2473c4b76fcf84e51a390dd684d (diff)
downloadcompiler-rt-5b1946bd1461d64b7f4cd036504b0d10314824a1.tar.gz
[asan] Move the "coverage" flag to common flags.
The implementation lives in sanitizer_common and will need to access that flag. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208566 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/asan/asan_flags.h1
-rw-r--r--lib/asan/asan_rtl.cc9
-rw-r--r--lib/sanitizer_common/sanitizer_flags.cc4
-rw-r--r--lib/sanitizer_common/sanitizer_flags.h1
4 files changed, 8 insertions, 7 deletions
diff --git a/lib/asan/asan_flags.h b/lib/asan/asan_flags.h
index cb1bcf47c..11392041b 100644
--- a/lib/asan/asan_flags.h
+++ b/lib/asan/asan_flags.h
@@ -52,7 +52,6 @@ struct Flags {
bool print_stats;
bool print_legend;
bool atexit;
- bool coverage;
bool disable_core;
bool allow_reexec;
bool print_full_thread_history;
diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc
index 4022bb7c1..39b186805 100644
--- a/lib/asan/asan_rtl.cc
+++ b/lib/asan/asan_rtl.cc
@@ -53,7 +53,7 @@ static void AsanDie() {
UnmapOrDie((void*)kLowShadowBeg, kHighShadowEnd - kLowShadowBeg);
}
}
- if (flags()->coverage)
+ if (common_flags()->coverage)
__sanitizer_cov_dump();
if (death_callback)
death_callback();
@@ -172,9 +172,6 @@ static void ParseFlagsFromString(Flags *f, const char *str) {
ParseFlag(str, &f->atexit, "atexit",
"If set, prints ASan exit stats even after program terminates "
"successfully.");
- ParseFlag(str, &f->coverage, "coverage",
- "If set, coverage information will be dumped at program shutdown (if the "
- "coverage instrumentation was enabled at compile time).");
ParseFlag(str, &f->disable_core, "disable_core",
"Disable core dumping. By default, disable_core=1 on 64-bit to avoid "
@@ -240,6 +237,7 @@ void InitializeFlags(Flags *f, const char *env) {
cf->external_symbolizer_path = GetEnv("ASAN_SYMBOLIZER_PATH");
cf->malloc_context_size = kDefaultMallocContextSize;
cf->intercept_tls_get_addr = true;
+ cf->coverage = false;
internal_memset(f, 0, sizeof(*f));
f->quarantine_size = (ASAN_LOW_MEMORY) ? 1UL << 26 : 1UL << 28;
@@ -266,7 +264,6 @@ void InitializeFlags(Flags *f, const char *env) {
f->print_stats = false;
f->print_legend = true;
f->atexit = false;
- f->coverage = false;
f->disable_core = (SANITIZER_WORDSIZE == 64);
f->allow_reexec = true;
f->print_full_thread_history = true;
@@ -665,7 +662,7 @@ static void AsanInitInternal() {
if (flags()->atexit)
Atexit(asan_atexit);
- if (flags()->coverage) {
+ if (common_flags()->coverage) {
__sanitizer_cov_init();
Atexit(__sanitizer_cov_dump);
}
diff --git a/lib/sanitizer_common/sanitizer_flags.cc b/lib/sanitizer_common/sanitizer_flags.cc
index cb287dfe7..86d70124e 100644
--- a/lib/sanitizer_common/sanitizer_flags.cc
+++ b/lib/sanitizer_common/sanitizer_flags.cc
@@ -54,6 +54,7 @@ void SetCommonFlagsDefaults(CommonFlags *f) {
f->color = "auto";
f->legacy_pthread_cond = false;
f->intercept_tls_get_addr = false;
+ f->coverage = false;
}
void ParseCommonFlagsFromString(CommonFlags *f, const char *str) {
@@ -122,6 +123,9 @@ void ParseCommonFlagsFromString(CommonFlags *f, const char *str) {
ParseFlag(str, &f->mmap_limit_mb, "mmap_limit_mb",
"Limit the amount of mmap-ed memory (excluding shadow) in Mb; "
"not a user-facing flag, used mosly for testing the tools");
+ ParseFlag(str, &f->coverage, "coverage",
+ "If set, coverage information will be dumped at program shutdown (if the "
+ "coverage instrumentation was enabled at compile time).");
// Do a sanity check for certain flags.
if (f->malloc_context_size < 1)
diff --git a/lib/sanitizer_common/sanitizer_flags.h b/lib/sanitizer_common/sanitizer_flags.h
index a322eadeb..cf9afffaa 100644
--- a/lib/sanitizer_common/sanitizer_flags.h
+++ b/lib/sanitizer_common/sanitizer_flags.h
@@ -53,6 +53,7 @@ struct CommonFlags {
bool intercept_tls_get_addr;
bool help;
uptr mmap_limit_mb;
+ bool coverage;
};
inline CommonFlags *common_flags() {