tsan: add a flag to control RunningOnValgrind() return value

llvm-svn: 157383
This commit is contained in:
Dmitry Vyukov 2012-05-24 09:24:45 +00:00
parent 26dcb95dfc
commit 65c21a5e6d
3 changed files with 5 additions and 1 deletions

View File

@ -49,6 +49,8 @@ void InitializeFlags(Flags *f, const char *env) {
f->profile_memory = "";
f->flush_memory_ms = 0;
f->stop_on_start = false;
f->running_on_valgrind = false;
// Let a frontend override.
OverrideFlags(f);

View File

@ -52,6 +52,8 @@ struct Flags {
int flush_memory_ms;
// Stops on start until __tsan_resume() is called (for debugging).
bool stop_on_start;
// Controls whether RunningOnValgrind() returns true or false.
bool running_on_valgrind;
};
Flags *flags();

View File

@ -332,7 +332,7 @@ void WTFAnnotateBenignRaceSized(char *f, int l, uptr mem, uptr sz, char *desc) {
}
int RunningOnValgrind() {
return 0;
return flags()->running_on_valgrind;
}
double __attribute__((weak)) ValgrindSlowdown(void) {