summaryrefslogtreecommitdiff
path: root/lib/esan/esan.cpp
diff options
context:
space:
mode:
authorQin Zhao <zhaoqin@google.com>2016-05-25 17:49:00 +0000
committerQin Zhao <zhaoqin@google.com>2016-05-25 17:49:00 +0000
commita9494465352c28ce019b9e8ea8ae0eeb6ca03176 (patch)
tree9e6cf47c137a8a23f38a8c0e31d033469c1d2c4f /lib/esan/esan.cpp
parent4502401cf8de82c0e2a12aa8fe6971b0d6e56121 (diff)
[esan][cfrag] Add skeleton for cache fragmentation tool support
Summary: Adds cache_frag.h and cache_frag.cpp for the cache fragmentation tool. Updates test struct-simple.cpp. Reviewers: aizatsky Subscribers: filcab, zhaoqin, llvm-commits, eugenis, vitalybuka, kcc, bruening, kubabrecka Differential Revision: http://reviews.llvm.org/D20538 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/esan/esan.cpp')
-rw-r--r--lib/esan/esan.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/esan/esan.cpp b/lib/esan/esan.cpp
index f4087bcf2..b2110bb04 100644
--- a/lib/esan/esan.cpp
+++ b/lib/esan/esan.cpp
@@ -16,6 +16,7 @@
#include "esan_flags.h"
#include "esan_interface_internal.h"
#include "esan_shadow.h"
+#include "cache_frag.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_flag_parser.h"
#include "sanitizer_common/sanitizer_flags.h"
@@ -175,7 +176,7 @@ void initializeLibrary(ToolType Tool) {
initializeInterceptors();
if (WhichTool == ESAN_CacheFrag) {
- // FIXME: add runtime code for this tool
+ initializeCacheFrag();
} else if (WhichTool == ESAN_WorkingSet) {
initializeWorkingSet();
}
@@ -186,10 +187,7 @@ void initializeLibrary(ToolType Tool) {
int finalizeLibrary() {
VPrintf(1, "in esan::%s\n", __FUNCTION__);
if (WhichTool == ESAN_CacheFrag) {
- // FIXME NYI: we need to add sampling + callstack gathering and have a
- // strategy for how to generate a final report.
- // We'll move this to cache_frag.cpp once we have something.
- Report("%s is not finished: nothing yet to report\n", SanitizerToolName);
+ return finalizeCacheFrag();
} else if (WhichTool == ESAN_WorkingSet) {
return finalizeWorkingSet();
}
@@ -198,12 +196,18 @@ int finalizeLibrary() {
void processCompilationUnitInit(void *Ptr) {
VPrintf(2, "in esan::%s\n", __FUNCTION__);
+ if (WhichTool == ESAN_CacheFrag) {
+ processCacheFragCompilationUnitInit(Ptr);
+ }
}
// This is called when the containing module is unloaded.
// For the main executable module, this is called after finalizeLibrary.
void processCompilationUnitExit(void *Ptr) {
VPrintf(2, "in esan::%s\n", __FUNCTION__);
+ if (WhichTool == ESAN_CacheFrag) {
+ processCacheFragCompilationUnitExit(Ptr);
+ }
}
} // namespace __esan