@@ -35,120 +35,20 @@ namespace centipede {
35
35
// the flags defined in environment_flags.cc, while other users can use
36
36
// CentipedeMain() as a library function without importing the flags.
37
37
struct Environment {
38
- // Global params. See environment_flags.cc for help on each parameter. -------
39
-
40
- std::string binary;
41
- std::string coverage_binary;
42
- std::string clang_coverage_binary;
43
- std::vector<std::string> extra_binaries;
44
- std::string workdir;
45
- std::string merge_from;
46
- size_t num_runs = std::numeric_limits<size_t >::max();
47
- size_t total_shards = 1 ;
48
- size_t my_shard_index = 0 ;
49
- size_t num_threads = 1 ;
50
- size_t j = 0 ;
51
- size_t max_len = 4000 ;
52
- size_t batch_size = 1000 ;
53
- size_t mutate_batch_size = 2 ;
54
- bool use_legacy_default_mutator = false ;
55
- size_t load_other_shard_frequency = 10 ;
56
- bool serialize_shard_loads = false ;
57
- size_t seed = 0 ;
58
- size_t prune_frequency = 100 ;
59
- #ifdef __APPLE__
60
- // Address space limit is ignored on MacOS.
61
- // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=853873#c2
62
- size_t address_space_limit_mb = 0 ;
63
- #else // __APPLE__
64
- size_t address_space_limit_mb = 8192 ;
65
- #endif // __APPLE__
66
- size_t rss_limit_mb = 4096 ;
67
- size_t stack_limit_kb = 0 ;
68
- size_t timeout_per_input = 60 ;
69
- size_t timeout_per_batch = 0 ;
70
- bool ignore_timeout_reports = false ;
71
- absl::Time stop_at = absl::InfiniteFuture();
72
- bool fork_server = true ;
73
- bool full_sync = false ;
74
- bool use_corpus_weights = true ;
75
- bool use_coverage_frontier = false ;
76
- size_t max_corpus_size = 100000 ;
77
- size_t crossover_level = 50 ;
78
- bool use_pc_features = true ;
79
- size_t path_level = 0 ;
80
- bool use_cmp_features = true ;
81
- size_t callstack_level = 0 ;
82
- bool use_auto_dictionary = true ;
83
- bool use_dataflow_features = true ;
84
- bool use_counter_features = false ;
85
- bool use_pcpair_features = false ;
86
- uint64_t user_feature_domain_mask = ~0UL ;
87
- size_t feature_frequency_threshold = 100 ;
88
- bool require_pc_table = true ;
89
- int telemetry_frequency = 0 ;
90
- bool print_runner_log = false ;
91
- bool distill = false ;
92
- size_t log_features_shards = 0 ;
93
- std::string knobs_file;
94
- std::string corpus_to_files;
95
- std::string corpus_from_files;
96
- std::vector<std::string> corpus_dir;
97
- std::string symbolizer_path = " llvm-symbolizer" ;
98
- std::string objdump_path = " objdump" ;
99
- std::string runner_dl_path_suffix;
100
- std::string input_filter;
101
- std::vector<std::string> dictionary;
102
- std::string function_filter;
103
- std::string for_each_blob;
104
- std::string experiment;
105
- bool analyze = false ;
106
- bool exit_on_crash = false ;
107
- size_t max_num_crash_reports = 5 ;
108
- std::string minimize_crash_file_path;
109
- bool batch_triage_suspect_only = false ;
110
- size_t shmem_size_mb = 1024 ;
111
- #ifdef __APPLE__
112
- bool use_posix_shmem = true ;
113
- #else
114
- bool use_posix_shmem = false ;
115
- #endif
116
- bool dry_run = false ;
117
- bool save_binary_info = false ;
118
- bool populate_binary_info = true ;
119
- #ifdef CENTIPEDE_DISABLE_RIEGELI
120
- bool riegeli = false ;
121
- #else
122
- bool riegeli = true ;
123
- #endif // CENTIPEDE_DISABLE_RIEGELI
124
-
125
- // Internal settings without global flags ------------------------------------
126
-
127
- // If set, treat the first entry of `corpus_dir` as output-only.
128
- bool first_corpus_dir_output_only = false ;
129
- // If set, load/merge shards without fuzzing new inputs.
130
- bool load_shards_only = false ;
131
- // If set, operate on the corpus database for a single test specified by
132
- // FuzzTest instead of all the tests.
133
- bool fuzztest_single_test_mode = false ;
134
- // If set, deserializes the configuration from the value instead of querying
135
- // the configuration via runner callbacks.
136
- std::string fuzztest_configuration;
137
- // The crash ID used for `replay_crash` or `export_crash`.
138
- std::string crash_id;
139
- // If set, replay `crash_id` in the corpus database.
140
- bool replay_crash = false ;
141
- // If set, export the input contents of `crash_id` from the corpus database.
142
- bool export_crash = false ;
143
- // The path to export the input contents of `crash_id` for `export_crash`.
144
- std::string export_crash_file;
38
+ #define CENTIPEDE_FLAG (TYPE, NAME, DEFAULT, _DESC ) TYPE NAME = DEFAULT;
39
+ #define CENTIPEDE_FLAG_ALIAS (_TYPE, _ALIAS_NAME, _FLAG_NAME, _DEFAULT )
40
+ #define CENTIPEDE_FUZZTEST_FLAG (TYPE, NAME, DEFAULT, _DESC ) TYPE NAME = DEFAULT;
41
+ #include " ./centipede/centipede_flags.inc"
42
+ #undef CENTIPEDE_FLAG
43
+ #undef CENTIPEDE_FLAG_ALIAS
44
+ #undef CENTIPEDE_FUZZTEST_FLAG
145
45
146
46
// Command line-related fields -----------------------------------------------
147
47
148
48
std::string exec_name; // copied from argv[0]
149
49
std::vector<std::string> args; // copied from argv[1:].
150
50
std::string binary_name; // Name of `coverage_binary`, w/o directories.
151
- std::string binary_hash; // Hash of the `coverage_binary` file.
51
+ // std::string binary_hash; // Hash of the `coverage_binary` file.
152
52
bool has_input_wildcards = false ; // Set to true iff `binary` contains "@@".
153
53
154
54
// Experiment-related settings -----------------------------------------------
@@ -236,6 +136,8 @@ struct Environment {
236
136
void UpdateTimeoutPerBatchIfEqualTo (size_t val);
237
137
// If `binary_hash` is empty, updates it using the file in `coverage_binary`.
238
138
void UpdateBinaryHashIfEmpty ();
139
+
140
+ std::vector<std::string> SerializeToCommandFlags () const ;
239
141
};
240
142
241
143
} // namespace centipede
0 commit comments