1 //===-- xray_interface_internal.h -------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file is a part of XRay, a dynamic runtime instrumentation system.
12 // Implementation of the API functions. See also include/xray/xray_interface.h.
14 //===----------------------------------------------------------------------===//
15 #ifndef XRAY_INTERFACE_INTERNAL_H
16 #define XRAY_INTERFACE_INTERNAL_H
18 #include "sanitizer_common/sanitizer_platform.h"
19 #include "xray/xray_interface.h"
25 struct XRaySledEntry {
26 #if SANITIZER_WORDSIZE == 64
30 unsigned char AlwaysInstrument;
31 unsigned char Version;
32 unsigned char Padding[13]; // Need 32 bytes
33 #elif SANITIZER_WORDSIZE == 32
37 unsigned char AlwaysInstrument;
38 unsigned char Version;
39 unsigned char Padding[5]; // Need 16 bytes
41 #error "Unsupported word size."
45 struct XRayFunctionSledIndex {
46 const XRaySledEntry* Begin;
47 const XRaySledEntry* End;
54 const XRaySledEntry *Sleds;
56 const XRayFunctionSledIndex *SledsIndex;
60 bool patchFunctionEntry(bool Enable, uint32_t FuncId,
61 const XRaySledEntry &Sled, void (*Trampoline)());
62 bool patchFunctionExit(bool Enable, uint32_t FuncId, const XRaySledEntry &Sled);
63 bool patchFunctionTailExit(bool Enable, uint32_t FuncId,
64 const XRaySledEntry &Sled);
65 bool patchCustomEvent(bool Enable, uint32_t FuncId, const XRaySledEntry &Sled);
70 // The following functions have to be defined in assembler, on a per-platform
71 // basis. See xray_trampoline_*.S files for implementations.
72 extern void __xray_FunctionEntry();
73 extern void __xray_FunctionExit();
74 extern void __xray_FunctionTailExit();
75 extern void __xray_ArgLoggerEntry();
76 extern void __xray_CustomEvent();