Path: blob/main/contrib/llvm-project/compiler-rt/lib/tsan/dd/dd_rtl.h
35267 views
//===-- dd_rtl.h ----------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7#ifndef DD_RTL_H8#define DD_RTL_H910#include "sanitizer_common/sanitizer_internal_defs.h"11#include "sanitizer_common/sanitizer_deadlock_detector_interface.h"12#include "sanitizer_common/sanitizer_flags.h"13#include "sanitizer_common/sanitizer_allocator_internal.h"14#include "sanitizer_common/sanitizer_addrhashmap.h"15#include "sanitizer_common/sanitizer_mutex.h"1617namespace __dsan {1819typedef DDFlags Flags;2021struct UserMutex {22DDMutex dd;23};2425struct Thread {26DDPhysicalThread *dd_pt;27DDLogicalThread *dd_lt;2829bool ignore_interceptors;30};3132struct Callback final : public DDCallback {33Thread *thr;3435Callback(Thread *thr);36u32 Unwind() override;37};3839typedef AddrHashMap<UserMutex, 31051> MutexHashMap;4041struct Context {42DDetector *dd;4344Mutex report_mutex;45MutexHashMap mutex_map;46};4748inline Flags* flags() {49static Flags flags;50return &flags;51}5253void Initialize();54void InitializeInterceptors();5556void ThreadInit(Thread *thr);57void ThreadDestroy(Thread *thr);5859void MutexBeforeLock(Thread *thr, uptr m, bool writelock);60void MutexAfterLock(Thread *thr, uptr m, bool writelock, bool trylock);61void MutexBeforeUnlock(Thread *thr, uptr m, bool writelock);62void MutexDestroy(Thread *thr, uptr m);6364} // namespace __dsan65#endif // DD_RTL_H666768