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