[libFuzzer] deprecate exit_on_first flag

llvm-svn: 262417
This commit is contained in:
Kostya Serebryany 2016-03-01 22:33:14 +00:00
parent 8ddd12bfcb
commit 96af1208c1
4 changed files with 10 additions and 12 deletions

View File

@ -40,16 +40,20 @@ struct FlagDescription {
};
struct {
#define FUZZER_DEPRECATED_FLAG(Name)
#define FUZZER_FLAG_INT(Name, Default, Description) int Name;
#define FUZZER_FLAG_UNSIGNED(Name, Default, Description) unsigned int Name;
#define FUZZER_FLAG_STRING(Name, Description) const char *Name;
#include "FuzzerFlags.def"
#undef FUZZER_DEPRECATED_FLAG
#undef FUZZER_FLAG_INT
#undef FUZZER_FLAG_UNSIGNED
#undef FUZZER_FLAG_STRING
} Flags;
static const FlagDescription FlagDescriptions [] {
#define FUZZER_DEPRECATED_FLAG(Name) \
{#Name, "Deprecated; don't use", 0, nullptr, nullptr, nullptr},
#define FUZZER_FLAG_INT(Name, Default, Description) \
{#Name, Description, Default, &Flags.Name, nullptr, nullptr},
#define FUZZER_FLAG_UNSIGNED(Name, Default, Description) \
@ -58,6 +62,7 @@ static const FlagDescription FlagDescriptions [] {
#define FUZZER_FLAG_STRING(Name, Description) \
{#Name, Description, 0, nullptr, &Flags.Name, nullptr},
#include "FuzzerFlags.def"
#undef FUZZER_DEPRECATED_FLAG
#undef FUZZER_FLAG_INT
#undef FUZZER_FLAG_UNSIGNED
#undef FUZZER_FLAG_STRING
@ -151,6 +156,9 @@ static bool ParseOneFlag(const char *Param) {
if (Flags.verbosity >= 2)
Printf("Flag: %s %s\n", Name, Str);
return true;
} else { // Deprecated flag.
Printf("Flag: %s: deprecated, don't use\n", Name);
return true;
}
}
}
@ -269,7 +277,6 @@ static int FuzzerDriver(const std::vector<std::string> &Args,
Options.MaxTotalTimeSec = Flags.max_total_time;
Options.DoCrossOver = Flags.cross_over;
Options.MutateDepth = Flags.mutate_depth;
Options.ExitOnFirst = Flags.exit_on_first;
Options.UseCounters = Flags.use_counters;
Options.UseIndirCalls = Flags.use_indir_calls;
Options.UseTraces = Flags.use_traces;
@ -348,11 +355,6 @@ static int FuzzerDriver(const std::vector<std::string> &Args,
exit(0);
}
if (Flags.save_minimized_corpus) {
Printf("The flag -save_minimized_corpus is deprecated; use -merge=1\n");
exit(1);
}
if (Flags.merge) {
F.Merge(*Inputs);
exit(0);

View File

@ -23,8 +23,6 @@ FUZZER_FLAG_INT(
prefer_small_during_initial_shuffle, -1,
"If 1, always prefer smaller inputs during the initial corpus shuffle."
" If 0, never do that. If -1, do it sometimes.")
FUZZER_FLAG_INT(exit_on_first, 0,
"If 1, exit after the first new interesting input is found.")
FUZZER_FLAG_INT(
timeout, 1200,
"Timeout in seconds (if positive). "
@ -36,7 +34,6 @@ FUZZER_FLAG_INT(error_exit_code, 77, "When libFuzzer's signal handlers are in "
FUZZER_FLAG_INT(max_total_time, 0, "If positive, indicates the maximal total "
"time in seconds to run the fuzzer.")
FUZZER_FLAG_INT(help, 0, "Print help.")
FUZZER_FLAG_INT(save_minimized_corpus, 0, "Deprecated. Use -merge=1")
FUZZER_FLAG_INT(merge, 0, "If 1, the 2-nd, 3-rd, etc corpora will be "
"merged into the 1-st corpus. Only interesting units will be taken.")
FUZZER_FLAG_INT(use_counters, 1, "Use coverage counters")
@ -83,3 +80,5 @@ FUZZER_FLAG_INT(handle_abrt, 1, "If 1, try to intercept SIGABRT.")
FUZZER_FLAG_INT(handle_ill, 1, "If 1, try to intercept SIGILL.")
FUZZER_FLAG_INT(handle_fpe, 1, "If 1, try to intercept SIGFPE.")
FUZZER_FLAG_INT(handle_int, 1, "If 1, try to intercept SIGINT.")
FUZZER_DEPRECATED_FLAG(exit_on_first)
FUZZER_DEPRECATED_FLAG(save_minimized_corpus)

View File

@ -281,7 +281,6 @@ public:
int MaxTotalTimeSec = 0;
bool DoCrossOver = true;
int MutateDepth = 5;
bool ExitOnFirst = false;
bool UseCounters = false;
bool UseIndirCalls = true;
bool UseTraces = false;

View File

@ -419,8 +419,6 @@ void Fuzzer::ReportNewCoverage(const Unit &U) {
PrintStatusForNewUnit(U);
WriteToOutputCorpus(U);
NumberOfNewUnitsAdded++;
if (Options.ExitOnFirst)
exit(0);
}
void Fuzzer::Merge(const std::vector<std::string> &Corpora) {