mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 23:24:34 +00:00
[fuzzer] add option -save_minimized_corpus
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227395 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -96,7 +96,7 @@ size_t Fuzzer::RunOne(const Unit &U) {
|
||||
|
||||
void Fuzzer::WriteToOutputCorpus(const Unit &U) {
|
||||
if (Options.OutputCorpus.empty()) return;
|
||||
std::string Path = Options.OutputCorpus + "/" + Hash(U);
|
||||
std::string Path = DirPlusFile(Options.OutputCorpus, Hash(U));
|
||||
WriteToFile(U, Path);
|
||||
if (Options.Verbosity >= 2)
|
||||
std::cerr << "Written to " << Path << std::endl;
|
||||
@ -108,6 +108,15 @@ void Fuzzer::WriteToCrash(const Unit &U, const char *Prefix) {
|
||||
std::cerr << "CRASHED; file written to " << Path << std::endl;
|
||||
}
|
||||
|
||||
void Fuzzer::SaveCorpus() {
|
||||
if (Options.OutputCorpus.empty()) return;
|
||||
for (const auto &U : Corpus)
|
||||
WriteToFile(U, DirPlusFile(Options.OutputCorpus, Hash(U)));
|
||||
if (Options.Verbosity)
|
||||
std::cerr << "Written corpus of " << Corpus.size() << " files to "
|
||||
<< Options.OutputCorpus << "\n";
|
||||
}
|
||||
|
||||
size_t Fuzzer::MutateAndTestOne(Unit *U) {
|
||||
size_t NewUnits = 0;
|
||||
for (size_t i = 0; i < Options.MutateDepth; i++) {
|
||||
|
Reference in New Issue
Block a user