mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 02:58:08 +00:00
fix -V, code format
This commit is contained in:
@ -133,8 +133,10 @@ void write_setup_file(afl_state_t *afl, u32 argc, char **argv) {
|
||||
|
||||
}
|
||||
|
||||
static bool starts_with(char* key, char* line) {
|
||||
static bool starts_with(char *key, char *line) {
|
||||
|
||||
return strncmp(key, line, strlen(key)) == 0;
|
||||
|
||||
}
|
||||
|
||||
/* load some of the existing stats file when resuming.*/
|
||||
@ -179,25 +181,43 @@ void load_stats_file(afl_state_t *afl) {
|
||||
strcpy(keystring, lstartptr);
|
||||
lptr++;
|
||||
char *nptr;
|
||||
if (starts_with("run_time", keystring)){
|
||||
if (starts_with("run_time", keystring)) {
|
||||
|
||||
afl->prev_run_time = 1000 * strtoull(lptr, &nptr, 10);
|
||||
|
||||
}
|
||||
if (starts_with("cycles_done", keystring)){
|
||||
|
||||
if (starts_with("cycles_done", keystring)) {
|
||||
|
||||
afl->queue_cycle =
|
||||
strtoull(lptr, &nptr, 10) ? strtoull(lptr, &nptr, 10) + 1 : 0;
|
||||
|
||||
}
|
||||
if (starts_with("calibration_time", keystring)){
|
||||
|
||||
if (starts_with("calibration_time", keystring)) {
|
||||
|
||||
afl->calibration_time_us = strtoull(lptr, &nptr, 10) * 1000000;
|
||||
|
||||
}
|
||||
if (starts_with("sync_time", keystring)){
|
||||
|
||||
if (starts_with("sync_time", keystring)) {
|
||||
|
||||
afl->sync_time_us = strtoull(lptr, &nptr, 10) * 1000000;
|
||||
|
||||
}
|
||||
if (starts_with("trim_time", keystring)){
|
||||
|
||||
if (starts_with("trim_time", keystring)) {
|
||||
|
||||
afl->trim_time_us = strtoull(lptr, &nptr, 10) * 1000000;
|
||||
|
||||
}
|
||||
if (starts_with("execs_done", keystring)){
|
||||
|
||||
if (starts_with("execs_done", keystring)) {
|
||||
|
||||
afl->fsrv.total_execs = strtoull(lptr, &nptr, 10);
|
||||
|
||||
}
|
||||
|
||||
if (starts_with("corpus_count", keystring)) {
|
||||
|
||||
u32 corpus_count = strtoul(lptr, &nptr, 10);
|
||||
@ -206,27 +226,46 @@ void load_stats_file(afl_state_t *afl) {
|
||||
WARNF(
|
||||
"queue/ has been modified -- things might not work, you're "
|
||||
"on your own!");
|
||||
sleep(3);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (starts_with("corpus_found", keystring)){
|
||||
|
||||
if (starts_with("corpus_found", keystring)) {
|
||||
|
||||
afl->queued_discovered = strtoul(lptr, &nptr, 10);
|
||||
|
||||
}
|
||||
if (starts_with("corpus_imported", keystring)){
|
||||
|
||||
if (starts_with("corpus_imported", keystring)) {
|
||||
|
||||
afl->queued_imported = strtoul(lptr, &nptr, 10);
|
||||
|
||||
}
|
||||
|
||||
if (starts_with("max_depth", keystring)) {
|
||||
|
||||
afl->max_depth = strtoul(lptr, &nptr, 10);
|
||||
|
||||
}
|
||||
|
||||
if (starts_with("saved_crashes", keystring)) {
|
||||
|
||||
afl->saved_crashes = strtoull(lptr, &nptr, 10);
|
||||
|
||||
}
|
||||
|
||||
if (starts_with("saved_hangs", keystring)) {
|
||||
|
||||
afl->saved_hangs = strtoull(lptr, &nptr, 10);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (afl->saved_crashes) { write_crash_readme(afl); }
|
||||
|
||||
return;
|
||||
@ -334,7 +373,7 @@ void write_stats_file(afl_state_t *afl, u32 t_bytes, double bitmap_cvg,
|
||||
"\n"
|
||||
"target_mode : %s%s%s%s%s%s%s%s%s%s\n"
|
||||
"command_line : %s\n",
|
||||
(afl->start_time - afl->prev_run_time) / 1000, cur_time / 1000,
|
||||
(afl->start_time /*- afl->prev_run_time*/) / 1000, cur_time / 1000,
|
||||
runtime / 1000, (u32)getpid(),
|
||||
afl->queue_cycle ? (afl->queue_cycle - 1) : 0, afl->cycles_wo_finds,
|
||||
afl->longest_find_time > cur_time - afl->last_find_time
|
||||
@ -342,11 +381,13 @@ void write_stats_file(afl_state_t *afl, u32 t_bytes, double bitmap_cvg,
|
||||
: ((afl->start_time == 0 || afl->last_find_time == 0)
|
||||
? 0
|
||||
: (cur_time - afl->last_find_time) / 1000),
|
||||
(runtime - (afl->calibration_time_us + afl->sync_time_us + afl->trim_time_us) / 1000) / 1000,
|
||||
afl->calibration_time_us / 1000000,
|
||||
afl->sync_time_us / 1000000,
|
||||
afl->trim_time_us / 1000000,
|
||||
afl->fsrv.total_execs, afl->fsrv.total_execs / ((double)(runtime) / 1000),
|
||||
(runtime -
|
||||
(afl->calibration_time_us + afl->sync_time_us + afl->trim_time_us) /
|
||||
1000) /
|
||||
1000,
|
||||
afl->calibration_time_us / 1000000, afl->sync_time_us / 1000000,
|
||||
afl->trim_time_us / 1000000, afl->fsrv.total_execs,
|
||||
afl->fsrv.total_execs / ((double)(runtime) / 1000),
|
||||
afl->last_avg_execs_saved, afl->queued_items, afl->queued_favored,
|
||||
afl->queued_discovered, afl->queued_imported, afl->queued_variable,
|
||||
afl->max_depth, afl->current_entry, afl->pending_favored,
|
||||
@ -415,6 +456,7 @@ void write_stats_file(afl_state_t *afl, u32 t_bytes, double bitmap_cvg,
|
||||
|
||||
fclose(f);
|
||||
rename(fn_tmp, fn_final);
|
||||
|
||||
}
|
||||
|
||||
#ifdef INTROSPECTION
|
||||
@ -2438,20 +2480,28 @@ void show_init_stats(afl_state_t *afl) {
|
||||
#undef IB
|
||||
|
||||
}
|
||||
void update_calibration_time(afl_state_t *afl, u64* time){
|
||||
u64 cur = get_cur_time_us();
|
||||
afl->calibration_time_us += cur-*time;
|
||||
|
||||
void update_calibration_time(afl_state_t *afl, u64 *time) {
|
||||
|
||||
u64 cur = get_cur_time_us();
|
||||
afl->calibration_time_us += cur - *time;
|
||||
*time = cur;
|
||||
|
||||
}
|
||||
|
||||
void update_trim_time(afl_state_t *afl, u64* time){
|
||||
u64 cur = get_cur_time_us();
|
||||
afl->trim_time_us += cur-*time;
|
||||
void update_trim_time(afl_state_t *afl, u64 *time) {
|
||||
|
||||
u64 cur = get_cur_time_us();
|
||||
afl->trim_time_us += cur - *time;
|
||||
*time = cur;
|
||||
|
||||
}
|
||||
|
||||
void update_sync_time(afl_state_t *afl, u64* time){
|
||||
u64 cur = get_cur_time_us();
|
||||
afl->sync_time_us += cur-*time;
|
||||
void update_sync_time(afl_state_t *afl, u64 *time) {
|
||||
|
||||
u64 cur = get_cur_time_us();
|
||||
afl->sync_time_us += cur - *time;
|
||||
*time = cur;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user