LLVM 20.0.0git
|
#include "llvm/Transforms/Instrumentation/SanitizerCoverage.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/EHPersonalities.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/SpecialCaseList.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "sancov" |
Functions | |
static bool | isFullDominator (const BasicBlock *BB, const DominatorTree &DT) |
static bool | isFullPostDominator (const BasicBlock *BB, const PostDominatorTree &PDT) |
static bool | shouldInstrumentBlock (const Function &F, const BasicBlock *BB, const DominatorTree &DT, const PostDominatorTree &PDT, const SanitizerCoverageOptions &Options) |
static bool | IsBackEdge (BasicBlock *From, BasicBlock *To, const DominatorTree &DT) |
static bool | IsInterestingCmp (ICmpInst *CMP, const DominatorTree &DT, const SanitizerCoverageOptions &Options) |
Variables | |
const char | SanCovTracePCIndirName [] = "__sanitizer_cov_trace_pc_indir" |
const char | SanCovTracePCName [] = "__sanitizer_cov_trace_pc" |
const char | SanCovTraceCmp1 [] = "__sanitizer_cov_trace_cmp1" |
const char | SanCovTraceCmp2 [] = "__sanitizer_cov_trace_cmp2" |
const char | SanCovTraceCmp4 [] = "__sanitizer_cov_trace_cmp4" |
const char | SanCovTraceCmp8 [] = "__sanitizer_cov_trace_cmp8" |
const char | SanCovTraceConstCmp1 [] = "__sanitizer_cov_trace_const_cmp1" |
const char | SanCovTraceConstCmp2 [] = "__sanitizer_cov_trace_const_cmp2" |
const char | SanCovTraceConstCmp4 [] = "__sanitizer_cov_trace_const_cmp4" |
const char | SanCovTraceConstCmp8 [] = "__sanitizer_cov_trace_const_cmp8" |
const char | SanCovLoad1 [] = "__sanitizer_cov_load1" |
const char | SanCovLoad2 [] = "__sanitizer_cov_load2" |
const char | SanCovLoad4 [] = "__sanitizer_cov_load4" |
const char | SanCovLoad8 [] = "__sanitizer_cov_load8" |
const char | SanCovLoad16 [] = "__sanitizer_cov_load16" |
const char | SanCovStore1 [] = "__sanitizer_cov_store1" |
const char | SanCovStore2 [] = "__sanitizer_cov_store2" |
const char | SanCovStore4 [] = "__sanitizer_cov_store4" |
const char | SanCovStore8 [] = "__sanitizer_cov_store8" |
const char | SanCovStore16 [] = "__sanitizer_cov_store16" |
const char | SanCovTraceDiv4 [] = "__sanitizer_cov_trace_div4" |
const char | SanCovTraceDiv8 [] = "__sanitizer_cov_trace_div8" |
const char | SanCovTraceGep [] = "__sanitizer_cov_trace_gep" |
const char | SanCovTraceSwitchName [] = "__sanitizer_cov_trace_switch" |
const char | SanCovModuleCtorTracePcGuardName [] |
const char | SanCovModuleCtor8bitCountersName [] |
const char | SanCovModuleCtorBoolFlagName [] = "sancov.module_ctor_bool_flag" |
static const uint64_t | SanCtorAndDtorPriority = 2 |
const char | SanCovTracePCGuardName [] = "__sanitizer_cov_trace_pc_guard" |
const char | SanCovTracePCGuardInitName [] = "__sanitizer_cov_trace_pc_guard_init" |
const char | SanCov8bitCountersInitName [] = "__sanitizer_cov_8bit_counters_init" |
const char | SanCovBoolFlagInitName [] = "__sanitizer_cov_bool_flag_init" |
const char | SanCovPCsInitName [] = "__sanitizer_cov_pcs_init" |
const char | SanCovCFsInitName [] = "__sanitizer_cov_cfs_init" |
const char | SanCovGuardsSectionName [] = "sancov_guards" |
const char | SanCovCountersSectionName [] = "sancov_cntrs" |
const char | SanCovBoolFlagSectionName [] = "sancov_bools" |
const char | SanCovPCsSectionName [] = "sancov_pcs" |
const char | SanCovCFsSectionName [] = "sancov_cfs" |
const char | SanCovCallbackGateSectionName [] = "sancov_gate" |
const char | SanCovLowestStackName [] = "__sancov_lowest_stack" |
const char | SanCovCallbackGateName [] = "__sancov_should_track" |
static cl::opt< int > | ClCoverageLevel ("sanitizer-coverage-level", cl::desc("Sanitizer Coverage. 0: none, 1: entry block, 2: all blocks, " "3: all blocks and critical edges"), cl::Hidden) |
static cl::opt< bool > | ClTracePC ("sanitizer-coverage-trace-pc", cl::desc("Experimental pc tracing"), cl::Hidden) |
static cl::opt< bool > | ClTracePCGuard ("sanitizer-coverage-trace-pc-guard", cl::desc("pc tracing with a guard"), cl::Hidden) |
static cl::opt< bool > | ClCreatePCTable ("sanitizer-coverage-pc-table", cl::desc("create a static PC table"), cl::Hidden) |
static cl::opt< bool > | ClInline8bitCounters ("sanitizer-coverage-inline-8bit-counters", cl::desc("increments 8-bit counter for every edge"), cl::Hidden) |
static cl::opt< bool > | ClInlineBoolFlag ("sanitizer-coverage-inline-bool-flag", cl::desc("sets a boolean flag for every edge"), cl::Hidden) |
static cl::opt< bool > | ClCMPTracing ("sanitizer-coverage-trace-compares", cl::desc("Tracing of CMP and similar instructions"), cl::Hidden) |
static cl::opt< bool > | ClDIVTracing ("sanitizer-coverage-trace-divs", cl::desc("Tracing of DIV instructions"), cl::Hidden) |
static cl::opt< bool > | ClLoadTracing ("sanitizer-coverage-trace-loads", cl::desc("Tracing of load instructions"), cl::Hidden) |
static cl::opt< bool > | ClStoreTracing ("sanitizer-coverage-trace-stores", cl::desc("Tracing of store instructions"), cl::Hidden) |
static cl::opt< bool > | ClGEPTracing ("sanitizer-coverage-trace-geps", cl::desc("Tracing of GEP instructions"), cl::Hidden) |
static cl::opt< bool > | ClPruneBlocks ("sanitizer-coverage-prune-blocks", cl::desc("Reduce the number of instrumented blocks"), cl::Hidden, cl::init(true)) |
static cl::opt< bool > | ClStackDepth ("sanitizer-coverage-stack-depth", cl::desc("max stack depth tracing"), cl::Hidden) |
static cl::opt< bool > | ClCollectCF ("sanitizer-coverage-control-flow", cl::desc("collect control flow for each function"), cl::Hidden) |
static cl::opt< bool > | ClGatedCallbacks ("sanitizer-coverage-gated-trace-callbacks", cl::desc("Gate the invocation of the tracing callbacks on a global variable" ". Currently only supported for trace-pc-guard and trace-cmp."), cl::Hidden, cl::init(false)) |
#define DEBUG_TYPE "sancov" |
Definition at line 42 of file SanitizerCoverage.cpp.
|
static |
Definition at line 613 of file SanitizerCoverage.cpp.
References llvm::DominatorTree::dominates(), From, and llvm::BasicBlock::getUniqueSuccessor().
Referenced by IsInterestingCmp().
|
static |
Definition at line 559 of file SanitizerCoverage.cpp.
References llvm::all_of(), llvm::DominatorTree::dominates(), llvm::succ_empty(), and llvm::successors().
Referenced by shouldInstrumentBlock().
|
static |
Definition at line 569 of file SanitizerCoverage.cpp.
References llvm::all_of(), llvm::PostDominatorTree::dominates(), llvm::pred_empty(), and llvm::predecessors().
Referenced by shouldInstrumentBlock().
|
static |
Definition at line 628 of file SanitizerCoverage.cpp.
References B, IsBackEdge(), and Options.
|
static |
Definition at line 579 of file SanitizerCoverage.cpp.
References llvm::BasicBlock::end(), F, llvm::BasicBlock::getFirstInsertionPt(), llvm::BasicBlock::getFirstNonPHIOrDbgOrLifetime(), llvm::BasicBlock::getSinglePredecessor(), isFullDominator(), isFullPostDominator(), Options, and llvm::SanitizerCoverageOptions::SCK_Function.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 77 of file SanitizerCoverage.cpp.
Definition at line 78 of file SanitizerCoverage.cpp.
Definition at line 84 of file SanitizerCoverage.cpp.
Definition at line 90 of file SanitizerCoverage.cpp.
Definition at line 87 of file SanitizerCoverage.cpp.
Definition at line 80 of file SanitizerCoverage.cpp.
Definition at line 86 of file SanitizerCoverage.cpp.
Definition at line 83 of file SanitizerCoverage.cpp.
Definition at line 82 of file SanitizerCoverage.cpp.
Definition at line 54 of file SanitizerCoverage.cpp.
Definition at line 58 of file SanitizerCoverage.cpp.
Definition at line 55 of file SanitizerCoverage.cpp.
Definition at line 56 of file SanitizerCoverage.cpp.
Definition at line 57 of file SanitizerCoverage.cpp.
Definition at line 89 of file SanitizerCoverage.cpp.
Definition at line 70 of file SanitizerCoverage.cpp.
Definition at line 72 of file SanitizerCoverage.cpp.
Definition at line 68 of file SanitizerCoverage.cpp.
Definition at line 79 of file SanitizerCoverage.cpp.
Definition at line 85 of file SanitizerCoverage.cpp.
Definition at line 59 of file SanitizerCoverage.cpp.
Definition at line 63 of file SanitizerCoverage.cpp.
Definition at line 60 of file SanitizerCoverage.cpp.
Definition at line 61 of file SanitizerCoverage.cpp.
Definition at line 62 of file SanitizerCoverage.cpp.
Definition at line 46 of file SanitizerCoverage.cpp.
Definition at line 47 of file SanitizerCoverage.cpp.
Definition at line 48 of file SanitizerCoverage.cpp.
Definition at line 49 of file SanitizerCoverage.cpp.
Definition at line 50 of file SanitizerCoverage.cpp.
Definition at line 51 of file SanitizerCoverage.cpp.
Definition at line 52 of file SanitizerCoverage.cpp.
Definition at line 53 of file SanitizerCoverage.cpp.
Definition at line 64 of file SanitizerCoverage.cpp.
Definition at line 65 of file SanitizerCoverage.cpp.
Definition at line 66 of file SanitizerCoverage.cpp.
Definition at line 76 of file SanitizerCoverage.cpp.
Definition at line 75 of file SanitizerCoverage.cpp.
Definition at line 44 of file SanitizerCoverage.cpp.
Definition at line 45 of file SanitizerCoverage.cpp.
Definition at line 67 of file SanitizerCoverage.cpp.
Definition at line 73 of file SanitizerCoverage.cpp.