summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2013-03-21 12:50:43 +0000
committerDmitry Vyukov <dvyukov@google.com>2013-03-21 12:50:43 +0000
commit69c323d66fdeb32297bfc0b0f8c6bb6072431963 (patch)
tree00e2300e8ea5368767522215eda1cef4b536a8e5 /compiler-rt/lib/tsan
parent6911a7f1d123a88e6302481c0603cc02aee41130 (diff)
downloadbcm5719-llvm-69c323d66fdeb32297bfc0b0f8c6bb6072431963.tar.gz
bcm5719-llvm-69c323d66fdeb32297bfc0b0f8c6bb6072431963.zip
tsan: intercept abort() to fflush() libc streams
llvm-svn: 177637
Diffstat (limited to 'compiler-rt/lib/tsan')
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_interceptors.cc7
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_stat.cc1
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_stat.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
index 5dc4497879d..01848a41a9b 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
@@ -1520,6 +1520,12 @@ TSAN_INTERCEPTOR(int, fflush, void *stream) {
return REAL(fflush)(stream);
}
+TSAN_INTERCEPTOR(void, abort, int fake) {
+ SCOPED_TSAN_INTERCEPTOR(abort, fake);
+ REAL(fflush)(0);
+ REAL(abort)(fake);
+}
+
TSAN_INTERCEPTOR(int, puts, const char *s) {
SCOPED_TSAN_INTERCEPTOR(puts, s);
MemoryAccessRange(thr, pc, (uptr)s, internal_strlen(s), false);
@@ -1981,6 +1987,7 @@ void InitializeInterceptors() {
TSAN_INTERCEPT(fread);
TSAN_INTERCEPT(fwrite);
TSAN_INTERCEPT(fflush);
+ TSAN_INTERCEPT(abort);
TSAN_INTERCEPT(puts);
TSAN_INTERCEPT(rmdir);
TSAN_INTERCEPT(opendir);
diff --git a/compiler-rt/lib/tsan/rtl/tsan_stat.cc b/compiler-rt/lib/tsan/rtl/tsan_stat.cc
index 723b8f5231c..9a427e4a652 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_stat.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_stat.cc
@@ -243,6 +243,7 @@ void StatOutput(u64 *stat) {
name[StatInt_fread] = " fread ";
name[StatInt_fwrite] = " fwrite ";
name[StatInt_fflush] = " fflush ";
+ name[StatInt_abort] = " abort ";
name[StatInt_puts] = " puts ";
name[StatInt_rmdir] = " rmdir ";
name[StatInt_opendir] = " opendir ";
diff --git a/compiler-rt/lib/tsan/rtl/tsan_stat.h b/compiler-rt/lib/tsan/rtl/tsan_stat.h
index c30e5ccf34a..51058305851 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_stat.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_stat.h
@@ -238,6 +238,7 @@ enum StatType {
StatInt_fread,
StatInt_fwrite,
StatInt_fflush,
+ StatInt_abort,
StatInt_puts,
StatInt_rmdir,
StatInt_opendir,
OpenPOWER on IntegriCloud