LLVM 24.0.0git
ConcurrencySanitizer.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "csan"

Functions

 STATISTIC (NumInstrumentedReads, "Number of instrumented reads")
 STATISTIC (NumInstrumentedWrites, "Number of instrumented writes")
 STATISTIC (NumOmittedReadsBeforeWrite, "Number of reads ignored due to following writes")

Variables

static cl::opt< bool > ClInstrumentMemoryAccesses ("csan-instrument-memory-accesses", cl::init(true), cl::desc("Instrument memory accesses"), cl::Hidden)
static cl::opt< bool > ClInstrumentFuncEntryExit ("csan-instrument-func-entry-exit", cl::init(true), cl::desc("Instrument function entry and exit"), cl::Hidden)
static cl::opt< bool > ClHandleCxxExceptions ("csan-handle-cxx-exceptions", cl::init(true), cl::desc("Handle C++ exceptions (insert cleanup blocks for unwinding)"), cl::Hidden)
static cl::opt< bool > ClInstrumentAtomics ("csan-instrument-atomics", cl::init(true), cl::desc("Instrument atomics"), cl::Hidden)
static cl::opt< bool > ClInstrumentMemIntrinsics ("csan-instrument-memintrinsics", cl::init(true), cl::desc("Instrument memintrinsics (memset/memcpy/memmove)"), cl::Hidden)
static cl::opt< bool > ClDistinguishVolatile ("csan-distinguish-volatile", cl::init(false), cl::desc("Treat aligned volatile accesses up to 8 bytes as atomic"), cl::Hidden)
static constexpr char kCsanModuleCtorName [] = "csan.module_ctor"
static constexpr char kCsanInitName [] = "__csan_init"
static constexpr size_t kNumAccessSizes = 5
static constexpr StringLiteral kCsanReadNames [kNumAccessSizes]
static constexpr StringLiteral kCsanWriteNames [kNumAccessSizes]
static constexpr StringLiteral kCsanUnalignedReadNames [kNumAccessSizes]
static constexpr StringLiteral kCsanUnalignedWriteNames [kNumAccessSizes]
static constexpr StringLiteral kCsanCompoundRWNames [kNumAccessSizes]
static constexpr StringLiteral kCsanUnalignedCompoundRWNames [kNumAccessSizes]

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "csan"

Definition at line 44 of file ConcurrencySanitizer.cpp.

Function Documentation

◆ STATISTIC() [1/3]

STATISTIC ( NumInstrumentedReads ,
"Number of instrumented reads"  )

◆ STATISTIC() [2/3]

STATISTIC ( NumInstrumentedWrites ,
"Number of instrumented writes"  )

◆ STATISTIC() [3/3]

STATISTIC ( NumOmittedReadsBeforeWrite ,
"Number of reads ignored due to following writes"  )

Variable Documentation

◆ ClDistinguishVolatile

cl::opt< bool > ClDistinguishVolatile("csan-distinguish-volatile", cl::init(false), cl::desc("Treat aligned volatile accesses up to 8 bytes as atomic"), cl::Hidden) ( "csan-distinguish-volatile" ,
cl::init(false) ,
cl::desc("Treat aligned volatile accesses up to 8 bytes as atomic") ,
cl::Hidden  )
static

◆ ClHandleCxxExceptions

cl::opt< bool > ClHandleCxxExceptions("csan-handle-cxx-exceptions", cl::init(true), cl::desc("Handle C++ exceptions (insert cleanup blocks for unwinding)"), cl::Hidden) ( "csan-handle-cxx-exceptions" ,
cl::init(true) ,
cl::desc("Handle C++ exceptions (insert cleanup blocks for unwinding)") ,
cl::Hidden  )
static

◆ ClInstrumentAtomics

cl::opt< bool > ClInstrumentAtomics("csan-instrument-atomics", cl::init(true), cl::desc("Instrument atomics"), cl::Hidden) ( "csan-instrument-atomics" ,
cl::init(true) ,
cl::desc("Instrument atomics") ,
cl::Hidden  )
static

◆ ClInstrumentFuncEntryExit

cl::opt< bool > ClInstrumentFuncEntryExit("csan-instrument-func-entry-exit", cl::init(true), cl::desc("Instrument function entry and exit"), cl::Hidden) ( "csan-instrument-func-entry-exit" ,
cl::init(true) ,
cl::desc("Instrument function entry and exit") ,
cl::Hidden  )
static

◆ ClInstrumentMemIntrinsics

cl::opt< bool > ClInstrumentMemIntrinsics("csan-instrument-memintrinsics", cl::init(true), cl::desc("Instrument memintrinsics (memset/memcpy/memmove)"), cl::Hidden) ( "csan-instrument-memintrinsics" ,
cl::init(true) ,
cl::desc("Instrument memintrinsics (memset/memcpy/memmove)") ,
cl::Hidden  )
static

◆ ClInstrumentMemoryAccesses

cl::opt< bool > ClInstrumentMemoryAccesses("csan-instrument-memory-accesses", cl::init(true), cl::desc("Instrument memory accesses"), cl::Hidden) ( "csan-instrument-memory-accesses" ,
cl::init(true) ,
cl::desc("Instrument memory accesses") ,
cl::Hidden  )
static

◆ kCsanCompoundRWNames

StringLiteral kCsanCompoundRWNames[kNumAccessSizes]
staticconstexpr
Initial value:
= {
"__csan_read_write1", "__csan_read_write2", "__csan_read_write4",
"__csan_read_write8", "__csan_read_write16"}

Definition at line 92 of file ConcurrencySanitizer.cpp.

◆ kCsanInitName

char kCsanInitName[] = "__csan_init"
staticconstexpr

Definition at line 74 of file ConcurrencySanitizer.cpp.

◆ kCsanModuleCtorName

char kCsanModuleCtorName[] = "csan.module_ctor"
staticconstexpr

Definition at line 73 of file ConcurrencySanitizer.cpp.

◆ kCsanReadNames

StringLiteral kCsanReadNames[kNumAccessSizes]
staticconstexpr
Initial value:
= {
"__csan_read1", "__csan_read2", "__csan_read4", "__csan_read8",
"__csan_read16"}

Definition at line 78 of file ConcurrencySanitizer.cpp.

◆ kCsanUnalignedCompoundRWNames

StringLiteral kCsanUnalignedCompoundRWNames[kNumAccessSizes]
staticconstexpr
Initial value:
=
{"__csan_unaligned_read_write1", "__csan_unaligned_read_write2",
"__csan_unaligned_read_write4", "__csan_unaligned_read_write8",
"__csan_unaligned_read_write16"}

Definition at line 95 of file ConcurrencySanitizer.cpp.

◆ kCsanUnalignedReadNames

StringLiteral kCsanUnalignedReadNames[kNumAccessSizes]
staticconstexpr
Initial value:
= {
"__csan_unaligned_read1", "__csan_unaligned_read2",
"__csan_unaligned_read4", "__csan_unaligned_read8",
"__csan_unaligned_read16"}

Definition at line 84 of file ConcurrencySanitizer.cpp.

◆ kCsanUnalignedWriteNames

StringLiteral kCsanUnalignedWriteNames[kNumAccessSizes]
staticconstexpr
Initial value:
= {
"__csan_unaligned_write1", "__csan_unaligned_write2",
"__csan_unaligned_write4", "__csan_unaligned_write8",
"__csan_unaligned_write16"}

Definition at line 88 of file ConcurrencySanitizer.cpp.

◆ kCsanWriteNames

StringLiteral kCsanWriteNames[kNumAccessSizes]
staticconstexpr
Initial value:
= {
"__csan_write1", "__csan_write2", "__csan_write4", "__csan_write8",
"__csan_write16"}

Definition at line 81 of file ConcurrencySanitizer.cpp.

◆ kNumAccessSizes

size_t kNumAccessSizes = 5
staticconstexpr

Definition at line 77 of file ConcurrencySanitizer.cpp.