diff options
| author | Kostya Serebryany <kcc@google.com> | 2016-10-05 00:25:17 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2016-10-05 00:25:17 +0000 |
| commit | 2455f0d013dc7fa311ac3fd7b3fcce166a468cc1 (patch) | |
| tree | 3b14eff599b0baa5f8b754b170977e532866bcbe /llvm/lib/Fuzzer/FuzzerLoop.cpp | |
| parent | 78b04ae7ac82908348602526f5671a51bb9c9314 (diff) | |
| download | bcm5719-llvm-2455f0d013dc7fa311ac3fd7b3fcce166a468cc1.tar.gz bcm5719-llvm-2455f0d013dc7fa311ac3fd7b3fcce166a468cc1.zip | |
[libFuzzer] clear the corpus elements if they are evicted (i.e. smaller elements with proper coverage are found). Make sure we never try to mutate empty element. Print the corpus size in bytes in the status lines
llvm-svn: 283279
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
| -rw-r--r-- | llvm/lib/Fuzzer/FuzzerLoop.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp index 57dbb9fa427..35d68bce694 100644 --- a/llvm/lib/Fuzzer/FuzzerLoop.cpp +++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp @@ -309,10 +309,20 @@ void Fuzzer::PrintStats(const char *Where, const char *End, size_t Units) { Printf(" bits: %zd", MaxCoverage.TPCMap.GetNumBitsSinceLastMerge()); if (MaxCoverage.CallerCalleeCoverage) Printf(" indir: %zd", MaxCoverage.CallerCalleeCoverage); - if (size_t N = Corpus.size()) - Printf(" units: %zd", N); + if (size_t N = Corpus.size()) { + Printf(" corpus: %zd", Corpus.NumActiveUnits()); + if (size_t N = Corpus.SizeInBytes()) { + if (N < (1<<14)) + Printf("/%zdb", N); + else if (N < (1 << 24)) + Printf("/%zdKb", N >> 10); + else + Printf("/%zdMb", N >> 20); + } + } if (Units) Printf(" units: %zd", Units); + Printf(" exec/s: %zd", ExecPerSec); Printf("%s", End); } @@ -403,6 +413,10 @@ void Fuzzer::ShuffleAndMinimize(UnitVector *InitialCorpus) { if (Options.ShuffleAtStartUp) ShuffleCorpus(InitialCorpus); + // Test the callback with empty input and never try it again. + uint8_t dummy; + ExecuteCallback(&dummy, 0); + for (const auto &U : *InitialCorpus) { if (RunOne(U)) { Corpus.AddToCorpus(U); |

