1 //===-- dd_rtl.h ----------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 #include "sanitizer_common/sanitizer_internal_defs.h"
12 #include "sanitizer_common/sanitizer_deadlock_detector_interface.h"
13 #include "sanitizer_common/sanitizer_flags.h"
14 #include "sanitizer_common/sanitizer_allocator_internal.h"
15 #include "sanitizer_common/sanitizer_addrhashmap.h"
16 #include "sanitizer_common/sanitizer_mutex.h"
20 typedef DDFlags Flags;
27 DDPhysicalThread *dd_pt;
28 DDLogicalThread *dd_lt;
30 bool ignore_interceptors;
33 struct Callback : DDCallback {
36 Callback(Thread *thr);
37 u32 Unwind() override;
40 typedef AddrHashMap<Mutex, 31051> MutexHashMap;
45 BlockingMutex report_mutex;
46 MutexHashMap mutex_map;
49 inline Flags* flags() {
55 void InitializeInterceptors();
57 void ThreadInit(Thread *thr);
58 void ThreadDestroy(Thread *thr);
60 void MutexBeforeLock(Thread *thr, uptr m, bool writelock);
61 void MutexAfterLock(Thread *thr, uptr m, bool writelock, bool trylock);
62 void MutexBeforeUnlock(Thread *thr, uptr m, bool writelock);
63 void MutexDestroy(Thread *thr, uptr m);