[asan] Add tests for direct (mmap-ed) mode for BB- and edge-level coverage.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224571 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] Test BB- and edge- level coverage on Android.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224572 91177308-0d34-0410-b5e6-96231b3b80d8
tsan: intercept closedir



git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224575 91177308-0d34-0410-b5e6-96231b3b80d8
[sanitizer] Rename InitIfLinkerInitialized to InitLinkerInitialized.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224577 91177308-0d34-0410-b5e6-96231b3b80d8
[lsan] Add debug output to leak_check_before_thread_started.cc.

Trying to investigate why this test is flaky.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224580 91177308-0d34-0410-b5e6-96231b3b80d8
builtins: rely on the compiler for user label prefix

clang does not like the definition of builtins.  In order to work around this,
we use a SUN CC to redefine the generated name.  However, this requires that we
account for the user label prefix.  Rather than hard coding that into the file,
rely on the compiler to tell us the information and use the preprocessor to
generate the name as we do in the assembly routines.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224597 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan] Move flag validation from ParseFlagsFromString() to InitializeFlags().

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224600 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan] Restrict the set of flags overriden at activation.

Summary:
Change the way ASan flag parsing is performed at activation: instead
of overwriting all ASan and common flags from the activation string,
ASan will now only override a handful of whitelisted flags.
This is a first step towards making runtime flags immutable after
initialization. I plan to re-factor the activation stragegy to
the following one:

  - Parse commandline flags. Override the defaults from compile
    definition, env var, etc. Flags are immutable at this point.
  - Initiailize the runtime from commandline flags.
  - If ASan needs to be started deactivated, stash the runtime
    state in "asan_deactivated_flags" and deactivate the runtime.
  - When ASan is activated, override "asan_deactivated_flags" with
    activation flags, and use it to re-activate the runtime.

Test Plan: regression test suite

Reviewers: eugenis, kcc

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D6709

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224601 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan] Introduce AllocatorOptions to configure allocator behavior.

Summary:
Reduce the dependency of allocator code on runtime flags. Instead,
pass a bunch of options that configure allocator behavior at
initialization or re-initialization. That would allow us to
cleaner modify allocator behavior during a program execution
when ASan is activated or de-activated.

Test Plan: regression test suite

Reviewers: kcc

Subscribers: llvm-commits, eugenis

Differential Revision: http://reviews.llvm.org/D6711

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224605 91177308-0d34-0410-b5e6-96231b3b80d8
[Sanitizer] Make Quarantine::Init slightly safer.

ASan Quarantine can be reinitialized at activation/deactivation.
Make max_size_/min_size_ atomic.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224613 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan] Change activation strategy.

Now ASan deactivation doesn't modify common or ASan-specific runtime
flags. Flags stay constant after initialization, and "deactivation"
instead stashes initialized runtime state, and deactivates the
runtime. Activation then just restores the original state (possibly,
overriden by some activation flags provided in system property on
Android).

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224614 91177308-0d34-0410-b5e6-96231b3b80d8
[Sanitizer] Refactor CommonFlags interface. NFC.

Add CommonFlags::SetDefaults() and CommonFlags::ParseFromString(),
so that this object can be easily tested. Enforce
that ParseCommonFlagsFromString() and SetCommonFlagsDefaults()
work only with singleton CommonFlags, shared across all sanitizer
runtimes.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224617 91177308-0d34-0410-b5e6-96231b3b80d8
[sanitizer] initialize two flas in SetCommonFlagsDefaults

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224645 91177308-0d34-0410-b5e6-96231b3b80d8
[sanitizer] fix a performance regression in sanitizer coverage: move a small perf-critical function to a header. ALso set the coverage guard to 1 before the early return from CoverageData::Add

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224660 91177308-0d34-0410-b5e6-96231b3b80d8