forked from OSchip/llvm-project
parent
aab220f307
commit
0954e9c01d
|
@ -293,15 +293,6 @@ class AtExitContext {
|
|||
|
||||
static AtExitContext *atexit_ctx;
|
||||
|
||||
static void finalize(void *arg) {
|
||||
ThreadState * thr = cur_thread();
|
||||
uptr pc = 0;
|
||||
atexit_ctx->exit(thr, pc);
|
||||
int status = Finalize(cur_thread());
|
||||
if (status)
|
||||
_exit(status);
|
||||
}
|
||||
|
||||
TSAN_INTERCEPTOR(int, atexit, void (*f)()) {
|
||||
if (cur_thread()->in_symbolizer)
|
||||
return 0;
|
||||
|
@ -1521,6 +1512,11 @@ TSAN_INTERCEPTOR(uptr, fwrite, const void *p, uptr size, uptr nmemb, void *f) {
|
|||
return REAL(fwrite)(p, size, nmemb, f);
|
||||
}
|
||||
|
||||
TSAN_INTERCEPTOR(int, fflush, void *stream) {
|
||||
SCOPED_TSAN_INTERCEPTOR(fflush, stream);
|
||||
return REAL(fflush)(stream);
|
||||
}
|
||||
|
||||
TSAN_INTERCEPTOR(int, puts, const char *s) {
|
||||
SCOPED_TSAN_INTERCEPTOR(puts, s);
|
||||
MemoryAccessRange(thr, pc, (uptr)s, internal_strlen(s), false);
|
||||
|
@ -1819,6 +1815,16 @@ void ProcessPendingSignals(ThreadState *thr) {
|
|||
thr->in_signal_handler = false;
|
||||
}
|
||||
|
||||
static void finalize(void *arg) {
|
||||
ThreadState * thr = cur_thread();
|
||||
uptr pc = 0;
|
||||
atexit_ctx->exit(thr, pc);
|
||||
int status = Finalize(cur_thread());
|
||||
REAL(fflush)(0);
|
||||
if (status)
|
||||
_exit(status);
|
||||
}
|
||||
|
||||
static void unreachable() {
|
||||
Printf("FATAL: ThreadSanitizer: unreachable called\n");
|
||||
Die();
|
||||
|
@ -1972,6 +1978,7 @@ void InitializeInterceptors() {
|
|||
TSAN_INTERCEPT(fclose);
|
||||
TSAN_INTERCEPT(fread);
|
||||
TSAN_INTERCEPT(fwrite);
|
||||
TSAN_INTERCEPT(fflush);
|
||||
TSAN_INTERCEPT(puts);
|
||||
TSAN_INTERCEPT(rmdir);
|
||||
TSAN_INTERCEPT(opendir);
|
||||
|
|
|
@ -358,10 +358,6 @@ const char *InitializePlatform() {
|
|||
return GetEnv(kTsanOptionsEnv);
|
||||
}
|
||||
|
||||
void FinalizePlatform() {
|
||||
fflush(0);
|
||||
}
|
||||
|
||||
void GetThreadStackAndTls(bool main, uptr *stk_addr, uptr *stk_size,
|
||||
uptr *tls_addr, uptr *tls_size) {
|
||||
#ifndef TSAN_GO
|
||||
|
|
|
@ -241,6 +241,7 @@ void StatOutput(u64 *stat) {
|
|||
name[StatInt_fclose] = " fclose ";
|
||||
name[StatInt_fread] = " fread ";
|
||||
name[StatInt_fwrite] = " fwrite ";
|
||||
name[StatInt_fflush] = " fflush ";
|
||||
name[StatInt_puts] = " puts ";
|
||||
name[StatInt_rmdir] = " rmdir ";
|
||||
name[StatInt_opendir] = " opendir ";
|
||||
|
|
|
@ -237,6 +237,7 @@ enum StatType {
|
|||
StatInt_fclose,
|
||||
StatInt_fread,
|
||||
StatInt_fwrite,
|
||||
StatInt_fflush,
|
||||
StatInt_puts,
|
||||
StatInt_rmdir,
|
||||
StatInt_opendir,
|
||||
|
|
Loading…
Reference in New Issue