diff options
author | Kostya Serebryany <kcc@google.com> | 2016-09-23 00:22:46 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2016-09-23 00:22:46 +0000 |
commit | d28099de5db44eb3f9f115ab60a11d9d4f9f0ecf (patch) | |
tree | 8f940407af3e8dfbcbe9889a1cb75de4e2babf74 /llvm/lib/Fuzzer/FuzzerLoop.cpp | |
parent | 5b16d931dc25d6318d4751ce4f4c0b346c86a562 (diff) | |
download | bcm5719-llvm-d28099de5db44eb3f9f115ab60a11d9d4f9f0ecf.tar.gz bcm5719-llvm-d28099de5db44eb3f9f115ab60a11d9d4f9f0ecf.zip |
[libFuzzer] change ValueBitMap to remember the number of bits in it
llvm-svn: 282216
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerLoop.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp index 2e2d38cfb3b..781266a4d98 100644 --- a/llvm/lib/Fuzzer/FuzzerLoop.cpp +++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp @@ -105,19 +105,18 @@ bool Fuzzer::RecordMaxCoverage(Fuzzer::Coverage *C) { if (Options.UseCounters) { uint64_t CounterDelta = EF->__sanitizer_update_counter_bitset_and_clear_counters( - C->CounterBitmap.data()) + - TPC.UpdateCounterMap(&C->TPCMap); + C->CounterBitmap.data()); if (CounterDelta > 0) { Res = true; C->CounterBitmapBits += CounterDelta; } } - size_t NewVPMapBits = VPMapMergeFromCurrent(C->VPMap); - if (NewVPMapBits > C->VPMapBits) { + if (TPC.UpdateCounterMap(&C->TPCMap)) + Res = true; + + if (VPMapMergeFromCurrent(C->VPMap)) Res = true; - C->VPMapBits = NewVPMapBits; - } if (EF->__sanitizer_get_coverage_pc_buffer_pos) { uint64_t NewPcBufferPos = EF->__sanitizer_get_coverage_pc_buffer_pos(); @@ -327,10 +326,12 @@ void Fuzzer::PrintStats(const char *Where, const char *End) { Printf("#%zd\t%s", TotalNumberOfRuns, Where); if (MaxCoverage.BlockCoverage) Printf(" cov: %zd", MaxCoverage.BlockCoverage); - if (MaxCoverage.VPMapBits) - Printf(" vp: %zd", MaxCoverage.VPMapBits); + if (MaxCoverage.VPMap.GetNumBitsSinceLastMerge()) + Printf(" vp: %zd", MaxCoverage.VPMap.GetNumBitsSinceLastMerge()); if (auto TB = MaxCoverage.CounterBitmapBits) Printf(" bits: %zd", TB); + if (auto TB = MaxCoverage.TPCMap.GetNumBitsSinceLastMerge()) + Printf(" bits: %zd", MaxCoverage.TPCMap.GetNumBitsSinceLastMerge()); if (MaxCoverage.CallerCalleeCoverage) Printf(" indir: %zd", MaxCoverage.CallerCalleeCoverage); Printf(" units: %zd exec/s: %zd", Corpus.size(), ExecPerSec); @@ -479,8 +480,8 @@ std::string Fuzzer::Coverage::DebugString() const { std::string("Coverage{") + "BlockCoverage=" + std::to_string(BlockCoverage) + " CallerCalleeCoverage=" + std::to_string(CallerCalleeCoverage) + " CounterBitmapBits=" + - std::to_string(CounterBitmapBits) + - " VPMapBits " + std::to_string(VPMapBits) + "}"; + std::to_string(CounterBitmapBits) + " VPMapBits " + + std::to_string(VPMap.GetNumBitsSinceLastMerge()) + "}"; return Result; } |