[llvm] r282225 - [libFuzzer] be more precise about what we reset in TracePC
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 22 19:18:59 PDT 2016
Author: kcc
Date: Thu Sep 22 21:18:59 2016
New Revision: 282225
URL: http://llvm.org/viewvc/llvm-project?rev=282225&view=rev
Log:
[libFuzzer] be more precise about what we reset in TracePC
Modified:
llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
llvm/trunk/lib/Fuzzer/FuzzerTracePC.h
Modified: llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp?rev=282225&r1=282224&r2=282225&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp Thu Sep 22 21:18:59 2016
@@ -68,7 +68,6 @@ void Fuzzer::ResetCounters() {
}
if (EF->__sanitizer_get_coverage_pc_buffer_pos)
PcBufferPos = EF->__sanitizer_get_coverage_pc_buffer_pos();
- TPC.ResetNewPCIDs();
}
void Fuzzer::PrepareCounters(Fuzzer::Coverage *C) {
@@ -163,7 +162,8 @@ Fuzzer::Fuzzer(UserCallback CB, InputCor
assert(!F);
F = this;
TPC.ResetTotalPCCoverage();
- TPC.Reset();
+ TPC.ResetMaps();
+ TPC.ResetGuards();
ResetCoverage();
IsMyThread = true;
if (Options.DetectLeaks && EF->__sanitizer_install_malloc_and_free_hooks)
@@ -470,6 +470,7 @@ void Fuzzer::ExecuteCallback(const uint8
AllocTracer.Start();
UnitStartTime = system_clock::now();
ResetCounters(); // Reset coverage right before the callback.
+ TPC.ResetMaps();
int Res = CB(DataCopy, Size);
UnitStopTime = system_clock::now();
(void)Res;
@@ -565,7 +566,8 @@ UnitVector Fuzzer::FindExtraUnits(const
size_t OldSize = Res.size();
for (int Iter = 0; Iter < 10; Iter++) {
ShuffleCorpus(&Res);
- TPC.Reset();
+ TPC.ResetMaps();
+ TPC.ResetGuards();
ResetCoverage();
for (auto &U : Initial)
Modified: llvm/trunk/lib/Fuzzer/FuzzerTracePC.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerTracePC.h?rev=282225&r1=282224&r2=282225&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerTracePC.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerTracePC.h Thu Sep 22 21:18:59 2016
@@ -43,13 +43,14 @@ class TracePC {
void ResetNewPCIDs() { NumNewPCIDs = 0; }
uintptr_t GetPCbyPCID(uintptr_t PCID) { return PCs[PCID]; }
- void Reset() {
+ void ResetMaps() {
NumNewPCIDs = 0;
CounterMap.Reset();
ValueProfileMap.Reset();
- ResetGuards();
}
+ void ResetGuards();
+
void PrintModuleInfo();
void PrintCoverage();
@@ -66,7 +67,6 @@ private:
NewPCIDs[(NumNewPCIDs++) % kMaxNewPCIDs] = PCID;
}
- void ResetGuards();
struct Module {
uintptr_t *Start, *Stop;
More information about the llvm-commits
mailing list