From 965efde6608e651c6cf6501669bb3ea77647bacc Mon Sep 17 00:00:00 2001 From: Qin Zhao Date: Tue, 31 May 2016 21:27:39 +0000 Subject: [esan|cfrag] Add the skeleton to handle the cfrag argument Summary: Adds the struct declaration for the cache-fragmentation tool variable passed to the runtime library. Updates test struct-simple.cpp. Reviewers: aizatsky, bruening Subscribers: filcab, kubabrecka, bruening, kcc, vitalybuka, eugenis, llvm-commits, zhaoqin Differential Revision: http://reviews.llvm.org/D20542 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271337 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/esan/cache_frag.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'lib/esan/cache_frag.cpp') diff --git a/lib/esan/cache_frag.cpp b/lib/esan/cache_frag.cpp index 1ab8699b9..da168dc0c 100644 --- a/lib/esan/cache_frag.cpp +++ b/lib/esan/cache_frag.cpp @@ -16,14 +16,34 @@ namespace __esan { +// This should be kept consistent with LLVM's EfficiencySanitizer StructInfo. +struct StructInfo { + const char *StructName; + u32 NumOfFields; + u64 *FieldCounters; + const char **FieldTypeNames; +}; + +// This should be kept consistent with LLVM's EfficiencySanitizer CacheFragInfo. +// The tool-specific information per compilation unit (module). +struct CacheFragInfo { + const char *UnitName; + u32 NumOfStructs; + StructInfo *Structs; +}; + //===-- Init/exit functions -----------------------------------------------===// void processCacheFragCompilationUnitInit(void *Ptr) { - VPrintf(2, "in esan::%s\n", __FUNCTION__); + CacheFragInfo *CacheFrag = (CacheFragInfo *)Ptr; + VPrintf(2, "in esan::%s: %s with %u class(es)/struct(s)\n", + __FUNCTION__, CacheFrag->UnitName, CacheFrag->NumOfStructs); } void processCacheFragCompilationUnitExit(void *Ptr) { - VPrintf(2, "in esan::%s\n", __FUNCTION__); + CacheFragInfo *CacheFrag = (CacheFragInfo *)Ptr; + VPrintf(2, "in esan::%s: %s with %u class(es)/struct(s)\n", + __FUNCTION__, CacheFrag->UnitName, CacheFrag->NumOfStructs); } void initializeCacheFrag() { -- cgit v1.2.3