diff options
author | Kostya Serebryany <kcc@google.com> | 2019-04-13 01:57:33 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2019-04-13 01:57:33 +0000 |
commit | 5e67abd91f406c62973fb38116270a391f1d7b42 (patch) | |
tree | 2c2abb499a96571247cd1337bd309fbed2c88486 /compiler-rt/lib/fuzzer/FuzzerLoop.cpp | |
parent | cebf0b3ab54423b81f195855b287a61bd085969e (diff) | |
download | bcm5719-llvm-5e67abd91f406c62973fb38116270a391f1d7b42.tar.gz bcm5719-llvm-5e67abd91f406c62973fb38116270a391f1d7b42.zip |
[libFuzzer] speedup the merge step in the fork mode by merging only the files that have unique features.
llvm-svn: 358320
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerLoop.cpp')
-rw-r--r-- | compiler-rt/lib/fuzzer/FuzzerLoop.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerLoop.cpp b/compiler-rt/lib/fuzzer/FuzzerLoop.cpp index b68d759cf83..a323a7a465b 100644 --- a/compiler-rt/lib/fuzzer/FuzzerLoop.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerLoop.cpp @@ -446,13 +446,12 @@ void Fuzzer::PrintPulseAndReportSlowInput(const uint8_t *Data, size_t Size) { } static void WriteFeatureSetToFile(const std::string &FeaturesDir, - const uint8_t Sha1[], + const std::string &FileName, const Vector<uint32_t> &FeatureSet) { if (FeaturesDir.empty() || FeatureSet.empty()) return; WriteToFile(reinterpret_cast<const uint8_t *>(FeatureSet.data()), FeatureSet.size() * sizeof(FeatureSet[0]), - DirPlusFile(FeaturesDir, Sha1ToString(Sha1))); - Printf("Features: %s\n", Sha1ToString(Sha1).c_str()); + DirPlusFile(FeaturesDir, FileName)); } static void RenameFeatureSetFile(const std::string &FeaturesDir, @@ -490,7 +489,7 @@ bool Fuzzer::RunOne(const uint8_t *Data, size_t Size, bool MayDeleteFile, auto NewII = Corpus.AddToCorpus({Data, Data + Size}, NumNewFeatures, MayDeleteFile, TPC.ObservedFocusFunction(), UniqFeatureSetTmp, DFT, II); - WriteFeatureSetToFile(Options.FeaturesDir, NewII->Sha1, + WriteFeatureSetToFile(Options.FeaturesDir, Sha1ToString(NewII->Sha1), NewII->UniqFeatureSet); return true; } |