Index: lib/fuzzer/FuzzerMutate.h =================================================================== --- lib/fuzzer/FuzzerMutate.h +++ lib/fuzzer/FuzzerMutate.h @@ -148,6 +148,24 @@ Vector DefaultMutators; }; +const std::map kMutationNames = { + {0, "AddWordFromManualDictionaryCount"}, + {1, "AddWordFromPersistentAutoDictionaryCount"}, + {2, "AddWordFromTORCCount"}, + {3, "ChangeASCIIIntegerCount"}, + {4, "ChangeBinaryIntegerCount"}, + {5, "ChangeBitCount"}, + {6, "CopyPartCount"}, + {7, "ChangeByteCount"}, + {8, "CrossOverCount"}, + {9, "CustomCrossoverCount"}, + {10, "CustomMutationCount"}, + {11, "EraseBytesCount"}, + {12, "InsertByteCount"}, + {13, "InsertRepeatedBytesCount"}, + {14, "ShuffleBytesCount"} +}; + } // namespace fuzzer #endif // LLVM_FUZZER_MUTATE_H Index: lib/fuzzer/FuzzerMutate.cpp =================================================================== --- lib/fuzzer/FuzzerMutate.cpp +++ lib/fuzzer/FuzzerMutate.cpp @@ -21,24 +21,6 @@ const size_t Dictionary::kMaxDictSize; -const std::map kMutationNames = { - {0, "AddWordFromManualDictionaryCount"}, - {1, "AddWordFromPersistentAutoDictionaryCount"}, - {2, "AddWordFromTORCCount"}, - {3, "ChangeASCIIIntegerCount"}, - {4, "ChangeBinaryIntegerCount"}, - {5, "ChangeBitCount"}, - {6, "CopyPartCount"}, - {7, "ChangeByteCount"}, - {8, "CrossOverCount"}, - {9, "CustomCrossoverCount"}, - {10, "CustomMutationCount"}, - {11, "EraseBytesCount"}, - {12, "InsertByteCount"}, - {13, "InsertRepeatedBytesCount"}, - {14, "ShuffleBytesCount"} -}; - static void PrintASCII(const Word &W, const char *PrintAfter) { PrintASCII(W.data(), W.size(), PrintAfter); } Index: lib/fuzzer/FuzzerMutationStats.cpp =================================================================== --- lib/fuzzer/FuzzerMutationStats.cpp +++ lib/fuzzer/FuzzerMutationStats.cpp @@ -21,7 +21,19 @@ void MutationStats::PrintMutationCounts() { // Outputs the number of each mutation used - Printf("\n\nMutations\n\n"); + + Printf("\nTotal Mutations ----------\n"); + for (int i = 0; i < MAXNUMBEROFMUTATIONTYPES; i++) { + auto current = kMutationNames.find(i); + Printf("%s: %d\n", current->second.c_str(), total.at(i)); + } + + Printf("\nUseful Mutations ----------\n"); + for (int i = 0; i < MAXNUMBEROFMUTATIONTYPES; i++) { + auto current = kMutationNames.find(i); + Printf("%s: %d\n", current->second.c_str(), useful.at(i)); + } + } // Updates the count of mutations (total/useful) depending on type.