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