|
| 1 | +#pragma once |
| 2 | +#include "tsan_defs.h" |
| 3 | +#include "tsan_rtl.h" |
| 4 | +#include "sanitizer_common/sanitizer_libc.h" |
| 5 | +#include "sanitizer_common/sanitizer_allocator_internal.h" |
| 6 | + |
| 7 | +//class __tsan::ThreadState; |
| 8 | + |
| 9 | +namespace Robustness{ |
| 10 | + using __tsan::s8; |
| 11 | + using __tsan::u8; |
| 12 | + using __tsan::s16; |
| 13 | + using __tsan::u16; |
| 14 | + using __tsan::s32; |
| 15 | + using __tsan::u32; |
| 16 | + using __tsan::s64; |
| 17 | + using __tsan::u64; |
| 18 | + using __tsan::uptr; |
| 19 | + typedef s64 timestamp_t; |
| 20 | + typedef s64 ssize_t; |
| 21 | + typedef u64 uint64_t; |
| 22 | + typedef s64 int64_t; |
| 23 | + typedef __PTRDIFF_TYPE__ ptrdiff_t; |
| 24 | + typedef __SIZE_TYPE__ size_t; |
| 25 | + |
| 26 | + typedef u8 uint8_t;; |
| 27 | + |
| 28 | + typedef u64 Address; |
| 29 | + typedef u64 LocationId; |
| 30 | + |
| 31 | + typedef u32 ThreadId; |
| 32 | + |
| 33 | + using __tsan::InternalScopedString; |
| 34 | + |
| 35 | + using __tsan::flags; |
| 36 | + |
| 37 | + using __sanitizer::IsAligned; |
| 38 | + |
| 39 | + using __sanitizer::LowLevelAllocator; |
| 40 | + using __sanitizer::InternalAlloc; |
| 41 | + using __sanitizer::InternalFree; |
| 42 | + using __sanitizer::internal_memcpy; |
| 43 | + using __sanitizer::internal_memmove; |
| 44 | + using __sanitizer::internal_memset; |
| 45 | + using __sanitizer::RoundUpTo; |
| 46 | + using __sanitizer::RoundUpToPowerOfTwo; |
| 47 | + using __sanitizer::GetPageSizeCached; |
| 48 | + using __sanitizer::MostSignificantSetBitIndex; |
| 49 | + using __sanitizer::MmapOrDie; |
| 50 | + using __sanitizer::UnmapOrDie; |
| 51 | + using __sanitizer::Max; |
| 52 | + using __sanitizer::Swap; |
| 53 | + using __sanitizer::forward; |
| 54 | + using __sanitizer::move; |
| 55 | + |
| 56 | + using __sanitizer::Printf; |
| 57 | + using __sanitizer::Report; |
| 58 | + |
| 59 | + using __sanitizer::Lock; |
| 60 | + using __sanitizer::Mutex; |
| 61 | + |
| 62 | + template <typename T1, typename T2> |
| 63 | + struct Pair{ |
| 64 | + T1 first; |
| 65 | + T2 second; |
| 66 | + }; |
| 67 | + template <typename T1, typename T2> |
| 68 | + auto pair(T1 fst, T2 snd){ |
| 69 | + return Pair<T1, T2>{fst, snd}; |
| 70 | + } |
| 71 | + |
| 72 | + using __tsan::max; |
| 73 | + using __tsan::min; |
| 74 | + |
| 75 | + enum class ViolationType{ |
| 76 | + read, write, |
| 77 | + }; |
| 78 | + |
| 79 | + struct DebugInfo { |
| 80 | + __tsan::ThreadState* thr = nullptr; |
| 81 | + uptr pc = 0xDEADBEEF; |
| 82 | + }; |
| 83 | + |
| 84 | + template<class> |
| 85 | + inline constexpr bool always_false_v = false; |
| 86 | + |
| 87 | + inline bool isRobustness() { |
| 88 | + return __tsan::flags()->enable_robustness; |
| 89 | + } |
| 90 | +} // namespace Robustness |
0 commit comments