1*a7c257b0Skamil //===-- sanitizer/esan_interface.h ------------------------------*- C++ -*-===// 2*a7c257b0Skamil // 3*a7c257b0Skamil // The LLVM Compiler Infrastructure 4*a7c257b0Skamil // 5*a7c257b0Skamil // This file is distributed under the University of Illinois Open Source 6*a7c257b0Skamil // License. See LICENSE.TXT for details. 7*a7c257b0Skamil // 8*a7c257b0Skamil //===----------------------------------------------------------------------===// 9*a7c257b0Skamil // 10*a7c257b0Skamil // This file is a part of EfficiencySanitizer, a family of performance tuners. 11*a7c257b0Skamil // 12*a7c257b0Skamil // Public interface header. 13*a7c257b0Skamil //===----------------------------------------------------------------------===// 14*a7c257b0Skamil #ifndef SANITIZER_ESAN_INTERFACE_H 15*a7c257b0Skamil #define SANITIZER_ESAN_INTERFACE_H 16*a7c257b0Skamil 17*a7c257b0Skamil #include <sanitizer/common_interface_defs.h> 18*a7c257b0Skamil 19*a7c257b0Skamil // We declare our interface routines as weak to allow the user to avoid 20*a7c257b0Skamil // ifdefs and instead use this pattern to allow building the same sources 21*a7c257b0Skamil // with and without our runtime library: 22*a7c257b0Skamil // if (__esan_report) 23*a7c257b0Skamil // __esan_report(); 24*a7c257b0Skamil #ifdef _MSC_VER 25*a7c257b0Skamil /* selectany is as close to weak as we'll get. */ 26*a7c257b0Skamil #define COMPILER_RT_WEAK __declspec(selectany) 27*a7c257b0Skamil #elif __GNUC__ 28*a7c257b0Skamil #define COMPILER_RT_WEAK __attribute__((weak)) 29*a7c257b0Skamil #else 30*a7c257b0Skamil #define COMPILER_RT_WEAK 31*a7c257b0Skamil #endif 32*a7c257b0Skamil 33*a7c257b0Skamil #ifdef __cplusplus 34*a7c257b0Skamil extern "C" { 35*a7c257b0Skamil #endif 36*a7c257b0Skamil 37*a7c257b0Skamil // This function can be called mid-run (or at the end of a run for 38*a7c257b0Skamil // a server process that doesn't shut down normally) to request that 39*a7c257b0Skamil // data for that point in the run be reported from the tool. 40*a7c257b0Skamil void COMPILER_RT_WEAK __esan_report(void); 41*a7c257b0Skamil 42*a7c257b0Skamil // This function returns the number of samples that the esan tool has collected 43*a7c257b0Skamil // to this point. This is useful for testing. 44*a7c257b0Skamil unsigned int COMPILER_RT_WEAK __esan_get_sample_count(void); 45*a7c257b0Skamil 46*a7c257b0Skamil #ifdef __cplusplus 47*a7c257b0Skamil } // extern "C" 48*a7c257b0Skamil #endif 49*a7c257b0Skamil 50*a7c257b0Skamil #endif // SANITIZER_ESAN_INTERFACE_H 51