1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

[libFuzzer] properly reset the guards when reseting the coverage. Also try to fix check-fuzzer on the bot

llvm-svn: 281814
This commit is contained in:
Kostya Serebryany 2016-09-17 06:01:55 +00:00
parent 3efb00834f
commit 9e8e432014
3 changed files with 12 additions and 1 deletions

View File

@ -380,6 +380,7 @@ class TracePC {
NumNewPCs = 0;
CounterMap.Reset();
TotalCoverageMap.Reset();
ResetGuards();
}
void PrintModuleInfo();
@ -394,6 +395,8 @@ private:
size_t NumNewPCs = 0;
void AddNewPC(uintptr_t PC) { NewPCs[(NumNewPCs++) % kMaxNewPCs] = PC; }
void ResetGuards();
struct Module {
uint64_t *Start, *Stop;
};

View File

@ -34,6 +34,8 @@ void TracePC::HandleTrace(uint64_t *Guard, uintptr_t PC) {
}
if (Counter < 255)
Value++;
else
Value |= kBit63;
} else {
Value |= kBit63;
TotalCoverage++;
@ -60,6 +62,12 @@ void TracePC::PrintModuleInfo() {
Printf("\n");
}
void TracePC::ResetGuards() {
for (size_t M = 0; M < NumModules; M++)
for (uint64_t *X = Modules[M].Start; X < Modules[M].Stop; X++)
*X = (*X >> 32) << 32;
}
void TracePC::FinalizeTrace() {
if (UseCounters && TotalCoverage) {
for (size_t M = 0; M < NumModules; M++) {

View File

@ -36,4 +36,4 @@ set_target_properties(LLVMFuzzer-DSO1 PROPERTIES LIBRARY_OUTPUT_DIRECTORY
set_target_properties(LLVMFuzzer-DSO2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/lib/Fuzzer/lib")
set(TestBinaries ${TestBinaries} LLVMFuzzer-DSOTest)
set(TestBinaries ${TestBinaries} LLVMFuzzer-DSOTest PARENT_SCOPE)