[PATCH] D48054: [libFuzzer] Mutation tracking and logging implemented

Kostya Serebryany via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 27 18:17:32 PDT 2018


kcc added inline comments.


================
Comment at: lib/fuzzer/FuzzerMutate.cpp:33
       {
-          {&MutationDispatcher::Mutate_EraseBytes, "EraseBytes"},
-          {&MutationDispatcher::Mutate_InsertByte, "InsertByte"},
+          {&MutationDispatcher::Mutate_EraseBytes, 11, "EraseBytes"},
+          {&MutationDispatcher::Mutate_InsertByte, 12, "InsertByte"},
----------------
This is still pretty gross. You don't need to assign numbers to mutations. 
When you add a mutation to DefaultMutators that becomes the mutation's number. 
And so you also should not need "int Identifier;" above. 


================
Comment at: lib/fuzzer/FuzzerMutate.cpp:66
+  // Initialize mutation statistic counters.
+  TotalMutations.resize(kNumMutationTypes, 0);
+  UsefulMutations.resize(kNumMutationTypes, 0);
----------------
you should use Mutators.size() here in stead of kNumMutationTypes


================
Comment at: lib/fuzzer/FuzzerMutate.cpp:531
       CurrentMutatorSequence.push_back(M);
+      TotalMutations.at(M.Identifier)++;
       return NewSize;
----------------
instead of having M.Identifier, change the line above 
  auto M = Mutators[Rand(Mutators.size())];
to something like 

   size_t MutatorIdx = Rand(Mutators.size());   
   auto M = Mutators[MutatorIdx];

and then use MutatorIdx


================
Comment at: lib/fuzzer/FuzzerMutate.h:22
 
+const int kNumMutationTypes = 15;
+
----------------
you should not need this. 


================
Comment at: lib/fuzzer/FuzzerMutate.h:154
+
+   // A total count of each mutation used in the fuzzing process.
+  Vector<uint64_t> TotalMutations;
----------------
check text alignment. 


================
Comment at: lib/fuzzer/FuzzerOptions.h:56
+  bool PrintMutationStats = false;
+  bool PrintMutationUsefulness = false;
   bool PrintCorpusStats = false;
----------------
stale? 


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D48054





More information about the llvm-commits mailing list