mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-13 11:22:03 +00:00
[TSan] #include header instead of forward declaring interceptees
llvm-svn: 369601
This commit is contained in:
parent
c20d1f90b5
commit
894abb46f8
@ -23,6 +23,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <libkern/OSAtomic.h>
|
#include <libkern/OSAtomic.h>
|
||||||
#include <objc/objc-sync.h>
|
#include <objc/objc-sync.h>
|
||||||
|
#include <os/lock.h>
|
||||||
#include <sys/ucontext.h>
|
#include <sys/ucontext.h>
|
||||||
|
|
||||||
#if defined(__has_include) && __has_include(<xpc/xpc.h>)
|
#if defined(__has_include) && __has_include(<xpc/xpc.h>)
|
||||||
@ -246,21 +247,7 @@ TSAN_INTERCEPTOR(void, os_lock_unlock, void *lock) {
|
|||||||
REAL(os_lock_unlock)(lock);
|
REAL(os_lock_unlock)(lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
TSAN_INTERCEPTOR(void, os_unfair_lock_lock, os_unfair_lock_t lock) {
|
||||||
#define _LOCK_AVAILABILITY \
|
|
||||||
__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) \
|
|
||||||
__TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
|
|
||||||
|
|
||||||
_LOCK_AVAILABILITY void os_unfair_lock_lock(void *lock);
|
|
||||||
// NOTE: `options` actually has type `os_unfair_lock_options_t` but this
|
|
||||||
// should be ABI compatible.
|
|
||||||
_LOCK_AVAILABILITY void os_unfair_lock_lock_with_options(void *lock,
|
|
||||||
u32 options);
|
|
||||||
_LOCK_AVAILABILITY bool os_unfair_lock_trylock(void *lock);
|
|
||||||
_LOCK_AVAILABILITY void os_unfair_lock_unlock(void *lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
TSAN_INTERCEPTOR(void, os_unfair_lock_lock, void *lock) {
|
|
||||||
if (!cur_thread()->is_inited || cur_thread()->is_dead) {
|
if (!cur_thread()->is_inited || cur_thread()->is_dead) {
|
||||||
return REAL(os_unfair_lock_lock)(lock);
|
return REAL(os_unfair_lock_lock)(lock);
|
||||||
}
|
}
|
||||||
@ -269,7 +256,7 @@ TSAN_INTERCEPTOR(void, os_unfair_lock_lock, void *lock) {
|
|||||||
Acquire(thr, pc, (uptr)lock);
|
Acquire(thr, pc, (uptr)lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
TSAN_INTERCEPTOR(void, os_unfair_lock_lock_with_options, void *lock,
|
TSAN_INTERCEPTOR(void, os_unfair_lock_lock_with_options, os_unfair_lock_t lock,
|
||||||
u32 options) {
|
u32 options) {
|
||||||
if (!cur_thread()->is_inited || cur_thread()->is_dead) {
|
if (!cur_thread()->is_inited || cur_thread()->is_dead) {
|
||||||
return REAL(os_unfair_lock_lock_with_options)(lock, options);
|
return REAL(os_unfair_lock_lock_with_options)(lock, options);
|
||||||
@ -279,7 +266,7 @@ TSAN_INTERCEPTOR(void, os_unfair_lock_lock_with_options, void *lock,
|
|||||||
Acquire(thr, pc, (uptr)lock);
|
Acquire(thr, pc, (uptr)lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
TSAN_INTERCEPTOR(bool, os_unfair_lock_trylock, void *lock) {
|
TSAN_INTERCEPTOR(bool, os_unfair_lock_trylock, os_unfair_lock_t lock) {
|
||||||
if (!cur_thread()->is_inited || cur_thread()->is_dead) {
|
if (!cur_thread()->is_inited || cur_thread()->is_dead) {
|
||||||
return REAL(os_unfair_lock_trylock)(lock);
|
return REAL(os_unfair_lock_trylock)(lock);
|
||||||
}
|
}
|
||||||
@ -290,7 +277,7 @@ TSAN_INTERCEPTOR(bool, os_unfair_lock_trylock, void *lock) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TSAN_INTERCEPTOR(void, os_unfair_lock_unlock, void *lock) {
|
TSAN_INTERCEPTOR(void, os_unfair_lock_unlock, os_unfair_lock_t lock) {
|
||||||
if (!cur_thread()->is_inited || cur_thread()->is_dead) {
|
if (!cur_thread()->is_inited || cur_thread()->is_dead) {
|
||||||
return REAL(os_unfair_lock_unlock)(lock);
|
return REAL(os_unfair_lock_unlock)(lock);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user