#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <sys/stat.h>
#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_APPLE
#include <sys/syscall.h>
#endif
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include "sanitizer_common/sanitizer_allocator_internal.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "xray/xray_records.h"
#include "xray_recursion_guard.h"
#include "xray_basic_flags.h"
#include "xray_basic_logging.h"
#include "xray_defs.h"
#include "xray_flags.h"
#include "xray_interface_internal.h"
#include "xray_tsc.h"
#include "xray_utils.h"
namespace __xray {
static SpinMutex LogMutex;
namespace {
struct alignas(16) StackEntry { … };
static_assert …;
struct XRAY_TLS_ALIGNAS(64) ThreadLocalData { … };
struct BasicLoggingOptions { … };
}
static pthread_key_t PThreadKey;
static atomic_uint8_t BasicInitialized{ … };
struct BasicLoggingOptions GlobalOptions;
thread_local atomic_uint8_t Guard{ … };
static atomic_uint8_t UseRealTSC{ … };
static atomic_uint64_t ThresholdTicks{ … };
static atomic_uint64_t TicksPerSec{ … };
static atomic_uint64_t CycleFrequency{ … };
static LogWriter *getLog() XRAY_NEVER_INSTRUMENT { … }
static LogWriter *getGlobalLog() XRAY_NEVER_INSTRUMENT { … }
static ThreadLocalData &getThreadLocalData() XRAY_NEVER_INSTRUMENT { … }
template <class RDTSC>
void InMemoryRawLog(int32_t FuncId, XRayEntryType Type,
RDTSC ReadTSC) XRAY_NEVER_INSTRUMENT { … }
template <class RDTSC>
void InMemoryRawLogWithArg(int32_t FuncId, XRayEntryType Type, uint64_t Arg1,
RDTSC ReadTSC) XRAY_NEVER_INSTRUMENT { … }
void basicLoggingHandleArg0RealTSC(int32_t FuncId,
XRayEntryType Type) XRAY_NEVER_INSTRUMENT { … }
void basicLoggingHandleArg0EmulateTSC(int32_t FuncId, XRayEntryType Type)
XRAY_NEVER_INSTRUMENT { … }
void basicLoggingHandleArg1RealTSC(int32_t FuncId, XRayEntryType Type,
uint64_t Arg1) XRAY_NEVER_INSTRUMENT { … }
void basicLoggingHandleArg1EmulateTSC(int32_t FuncId, XRayEntryType Type,
uint64_t Arg1) XRAY_NEVER_INSTRUMENT { … }
static void TLDDestructor(void *P) XRAY_NEVER_INSTRUMENT { … }
XRayLogInitStatus basicLoggingInit(UNUSED size_t BufferSize,
UNUSED size_t BufferMax, void *Options,
size_t OptionsSize) XRAY_NEVER_INSTRUMENT { … }
XRayLogInitStatus basicLoggingFinalize() XRAY_NEVER_INSTRUMENT { … }
XRayLogFlushStatus basicLoggingFlush() XRAY_NEVER_INSTRUMENT { … }
void basicLoggingHandleArg0Empty(int32_t, XRayEntryType) XRAY_NEVER_INSTRUMENT { … }
bool basicLogDynamicInitializer() XRAY_NEVER_INSTRUMENT { … }
}
static auto UNUSED Unused = …;