llvm/compiler-rt/lib/xray/xray_log_interface.cpp

//===-- xray_log_interface.cpp --------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file is a part of XRay, a function call tracing system.
//
//===----------------------------------------------------------------------===//
#include "xray/xray_log_interface.h"

#include "sanitizer_common/sanitizer_allocator_internal.h"
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_mutex.h"
#include "xray/xray_interface.h"
#include "xray_defs.h"

namespace __xray {
static SpinMutex XRayImplMutex;
static XRayLogImpl CurrentXRayImpl{};
static XRayLogImpl *GlobalXRayImpl =;

// This is the default implementation of a buffer iterator, which always yields
// a null buffer.
XRayBuffer NullBufferIterator(XRayBuffer) XRAY_NEVER_INSTRUMENT {}

// This is the global function responsible for iterating through given buffers.
atomic_uintptr_t XRayBufferIterator{};

// We use a linked list of Mode to XRayLogImpl mappings. This is a linked list
// when it should be a map because we're avoiding having to depend on C++
// standard library data structures at this level of the implementation.
struct ModeImpl {};

static ModeImpl SentinelModeImpl{};
static ModeImpl *ModeImpls =;
static const ModeImpl *CurrentMode =;

} // namespace __xray

usingnamespace__xray;

void __xray_log_set_buffer_iterator(XRayBuffer (*Iterator)(XRayBuffer))
    XRAY_NEVER_INSTRUMENT {}

void __xray_log_remove_buffer_iterator() XRAY_NEVER_INSTRUMENT {}

XRayLogRegisterStatus
__xray_log_register_mode(const char *Mode,
                         XRayLogImpl Impl) XRAY_NEVER_INSTRUMENT {}

XRayLogRegisterStatus
__xray_log_select_mode(const char *Mode) XRAY_NEVER_INSTRUMENT {}

const char *__xray_log_get_current_mode() XRAY_NEVER_INSTRUMENT {}

void __xray_set_log_impl(XRayLogImpl Impl) XRAY_NEVER_INSTRUMENT {}

void __xray_remove_log_impl() XRAY_NEVER_INSTRUMENT {}

XRayLogInitStatus __xray_log_init(size_t BufferSize, size_t MaxBuffers,
                                  void *Args,
                                  size_t ArgsSize) XRAY_NEVER_INSTRUMENT {}

XRayLogInitStatus __xray_log_init_mode(const char *Mode, const char *Config)
    XRAY_NEVER_INSTRUMENT {}

XRayLogInitStatus
__xray_log_init_mode_bin(const char *Mode, const char *Config,
                         size_t ConfigSize) XRAY_NEVER_INSTRUMENT {}

XRayLogInitStatus __xray_log_finalize() XRAY_NEVER_INSTRUMENT {}

XRayLogFlushStatus __xray_log_flushLog() XRAY_NEVER_INSTRUMENT {}

XRayLogFlushStatus __xray_log_process_buffers(
    void (*Processor)(const char *, XRayBuffer)) XRAY_NEVER_INSTRUMENT {}