#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_internal_defs.h"
#include "sanitizer_common/sanitizer_placement_new.h"
#include "sanitizer_common/sanitizer_stacktrace.h"
#include "sanitizer_common/sanitizer_vector.h"
#include "tsan_interface_ann.h"
#include "tsan_report.h"
#include "tsan_rtl.h"
#include "tsan_mman.h"
#include "tsan_flags.h"
#include "tsan_platform.h"
#define CALLERPC …
usingnamespace__tsan;
namespace __tsan {
class ScopedAnnotation { … };
#define SCOPED_ANNOTATION_RET(typ, ret) …
#define SCOPED_ANNOTATION(typ) …
static const int kMaxDescLen = …;
struct ExpectRace { … };
struct DynamicAnnContext { … };
static DynamicAnnContext *dyn_ann_ctx;
alignas(64) static char dyn_ann_ctx_placeholder[sizeof(DynamicAnnContext)];
static void AddExpectRace(ExpectRace *list,
char *f, int l, uptr addr, uptr size, char *desc) { … }
static ExpectRace *FindRace(ExpectRace *list, uptr addr, uptr size) { … }
static bool CheckContains(ExpectRace *list, uptr addr, uptr size) { … }
static void InitList(ExpectRace *list) { … }
void InitializeDynamicAnnotations() { … }
bool IsExpectedReport(uptr addr, uptr size) { … }
}
usingnamespace__tsan;
extern "C" {
void INTERFACE_ATTRIBUTE AnnotateHappensBefore(char *f, int l, uptr addr) { … }
void INTERFACE_ATTRIBUTE AnnotateHappensAfter(char *f, int l, uptr addr) { … }
void INTERFACE_ATTRIBUTE AnnotateCondVarSignal(char *f, int l, uptr cv) { … }
void INTERFACE_ATTRIBUTE AnnotateCondVarSignalAll(char *f, int l, uptr cv) { … }
void INTERFACE_ATTRIBUTE AnnotateMutexIsNotPHB(char *f, int l, uptr mu) { … }
void INTERFACE_ATTRIBUTE AnnotateCondVarWait(char *f, int l, uptr cv,
uptr lock) { … }
void INTERFACE_ATTRIBUTE AnnotateRWLockCreate(char *f, int l, uptr m) { … }
void INTERFACE_ATTRIBUTE AnnotateRWLockCreateStatic(char *f, int l, uptr m) { … }
void INTERFACE_ATTRIBUTE AnnotateRWLockDestroy(char *f, int l, uptr m) { … }
void INTERFACE_ATTRIBUTE AnnotateRWLockAcquired(char *f, int l, uptr m,
uptr is_w) { … }
void INTERFACE_ATTRIBUTE AnnotateRWLockReleased(char *f, int l, uptr m,
uptr is_w) { … }
void INTERFACE_ATTRIBUTE AnnotateTraceMemory(char *f, int l, uptr mem) { … }
void INTERFACE_ATTRIBUTE AnnotateFlushState(char *f, int l) { … }
void INTERFACE_ATTRIBUTE AnnotateNewMemory(char *f, int l, uptr mem,
uptr size) { … }
void INTERFACE_ATTRIBUTE AnnotateNoOp(char *f, int l, uptr mem) { … }
void INTERFACE_ATTRIBUTE AnnotateFlushExpectedRaces(char *f, int l) { … }
void INTERFACE_ATTRIBUTE AnnotateEnableRaceDetection(
char *f, int l, int enable) { … }
void INTERFACE_ATTRIBUTE AnnotateMutexIsUsedAsCondVar(
char *f, int l, uptr mu) { … }
void INTERFACE_ATTRIBUTE AnnotatePCQGet(
char *f, int l, uptr pcq) { … }
void INTERFACE_ATTRIBUTE AnnotatePCQPut(
char *f, int l, uptr pcq) { … }
void INTERFACE_ATTRIBUTE AnnotatePCQDestroy(
char *f, int l, uptr pcq) { … }
void INTERFACE_ATTRIBUTE AnnotatePCQCreate(
char *f, int l, uptr pcq) { … }
void INTERFACE_ATTRIBUTE AnnotateExpectRace(
char *f, int l, uptr mem, char *desc) { … }
static void BenignRaceImpl(char *f, int l, uptr mem, uptr size, char *desc) { … }
void INTERFACE_ATTRIBUTE AnnotateBenignRaceSized(
char *f, int l, uptr mem, uptr size, char *desc) { … }
void INTERFACE_ATTRIBUTE AnnotateBenignRace(
char *f, int l, uptr mem, char *desc) { … }
void INTERFACE_ATTRIBUTE AnnotateIgnoreReadsBegin(char *f, int l) { … }
void INTERFACE_ATTRIBUTE AnnotateIgnoreReadsEnd(char *f, int l) { … }
void INTERFACE_ATTRIBUTE AnnotateIgnoreWritesBegin(char *f, int l) { … }
void INTERFACE_ATTRIBUTE AnnotateIgnoreWritesEnd(char *f, int l) { … }
void INTERFACE_ATTRIBUTE AnnotateIgnoreSyncBegin(char *f, int l) { … }
void INTERFACE_ATTRIBUTE AnnotateIgnoreSyncEnd(char *f, int l) { … }
void INTERFACE_ATTRIBUTE AnnotatePublishMemoryRange(
char *f, int l, uptr addr, uptr size) { … }
void INTERFACE_ATTRIBUTE AnnotateUnpublishMemoryRange(
char *f, int l, uptr addr, uptr size) { … }
void INTERFACE_ATTRIBUTE AnnotateThreadName(
char *f, int l, char *name) { … }
void INTERFACE_ATTRIBUTE WTFAnnotateHappensBefore(char *f, int l, uptr addr) { … }
void INTERFACE_ATTRIBUTE WTFAnnotateHappensAfter(char *f, int l, uptr addr) { … }
void INTERFACE_ATTRIBUTE WTFAnnotateBenignRaceSized(
char *f, int l, uptr mem, uptr sz, char *desc) { … }
int INTERFACE_ATTRIBUTE RunningOnValgrind() { … }
double __attribute__((weak)) INTERFACE_ATTRIBUTE ValgrindSlowdown(void) { … }
const char INTERFACE_ATTRIBUTE* ThreadSanitizerQuery(const char *query) { … }
void INTERFACE_ATTRIBUTE
AnnotateMemoryIsInitialized(char *f, int l, uptr mem, uptr sz) { … }
void INTERFACE_ATTRIBUTE
AnnotateMemoryIsUninitialized(char *f, int l, uptr mem, uptr sz) { … }
INTERFACE_ATTRIBUTE
void __tsan_mutex_create(void *m, unsigned flagz) { … }
INTERFACE_ATTRIBUTE
void __tsan_mutex_destroy(void *m, unsigned flagz) { … }
INTERFACE_ATTRIBUTE
void __tsan_mutex_pre_lock(void *m, unsigned flagz) { … }
INTERFACE_ATTRIBUTE
void __tsan_mutex_post_lock(void *m, unsigned flagz, int rec) { … }
INTERFACE_ATTRIBUTE
int __tsan_mutex_pre_unlock(void *m, unsigned flagz) { … }
INTERFACE_ATTRIBUTE
void __tsan_mutex_post_unlock(void *m, unsigned flagz) { … }
INTERFACE_ATTRIBUTE
void __tsan_mutex_pre_signal(void *addr, unsigned flagz) { … }
INTERFACE_ATTRIBUTE
void __tsan_mutex_post_signal(void *addr, unsigned flagz) { … }
INTERFACE_ATTRIBUTE
void __tsan_mutex_pre_divert(void *addr, unsigned flagz) { … }
INTERFACE_ATTRIBUTE
void __tsan_mutex_post_divert(void *addr, unsigned flagz) { … }
static void ReportMutexHeldWrongContext(ThreadState *thr, uptr pc) { … }
INTERFACE_ATTRIBUTE
void __tsan_check_no_mutexes_held() { … }
}