[compiler-rt] r208566 - [asan] Move the "coverage" flag to common flags.
Sergey Matveev
earthdok at google.com
Mon May 12 07:27:37 PDT 2014
Author: smatveev
Date: Mon May 12 09:27:36 2014
New Revision: 208566
URL: http://llvm.org/viewvc/llvm-project?rev=208566&view=rev
Log:
[asan] Move the "coverage" flag to common flags.
The implementation lives in sanitizer_common and will need to access that flag.
Modified:
compiler-rt/trunk/lib/asan/asan_flags.h
compiler-rt/trunk/lib/asan/asan_rtl.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h
Modified: compiler-rt/trunk/lib/asan/asan_flags.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_flags.h?rev=208566&r1=208565&r2=208566&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_flags.h (original)
+++ compiler-rt/trunk/lib/asan/asan_flags.h Mon May 12 09:27:36 2014
@@ -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;
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=208566&r1=208565&r2=208566&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Mon May 12 09:27:36 2014
@@ -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 *
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 cha
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 cha
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);
}
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc?rev=208566&r1=208565&r2=208566&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc Mon May 12 09:27:36 2014
@@ -54,6 +54,7 @@ void SetCommonFlagsDefaults(CommonFlags
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(CommonFl
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)
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h?rev=208566&r1=208565&r2=208566&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h Mon May 12 09:27:36 2014
@@ -53,6 +53,7 @@ struct CommonFlags {
bool intercept_tls_get_addr;
bool help;
uptr mmap_limit_mb;
+ bool coverage;
};
inline CommonFlags *common_flags() {
More information about the llvm-commits
mailing list