1 //===-- esan.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 EfficiencySanitizer, a family of performance tuners.
12 // Main internal esan header file.
15 // - C++ run-time should not be used (static CTORs, RTTI, exceptions, static
16 // function-scope locals)
17 // - All functions/classes/etc reside in namespace __esan, except for those
18 // declared in esan_interface_internal.h.
19 // - Platform-specific files should be used instead of ifdefs (*).
20 // - No system headers included in header files (*).
21 // - Platform specific headers included only into platform-specific files (*).
23 // (*) Except when inlining is critical for performance.
24 //===----------------------------------------------------------------------===//
29 #include "interception/interception.h"
30 #include "sanitizer_common/sanitizer_common.h"
31 #include "esan_interface_internal.h"
35 extern bool EsanIsInitialized;
36 extern bool EsanDuringInit;
38 void initializeLibrary(ToolType Tool);
39 int finalizeLibrary();
41 unsigned int getSampleCount();
42 // Esan creates the variable per tool per compilation unit at compile time
43 // and passes its pointer Ptr to the runtime library.
44 void processCompilationUnitInit(void *Ptr);
45 void processCompilationUnitExit(void *Ptr);
46 void processRangeAccess(uptr PC, uptr Addr, int Size, bool IsWrite);
47 void initializeInterceptors();
49 // Platform-dependent routines.
50 void verifyAddressSpace();
51 bool fixMmapAddr(void **Addr, SIZE_T Size, int Flags);
52 uptr checkMmapResult(uptr Addr, SIZE_T Size);
53 // The return value indicates whether to call the real version or not.
54 bool processSignal(int SigNum, void (*Handler)(int), void (**Result)(int));
55 bool processSigaction(int SigNum, const void *Act, void *OldAct);
56 bool processSigprocmask(int How, void *Set, void *OldSet);