50% less globals

This commit is contained in:
Dominik Maier
2020-03-19 19:22:57 +01:00
parent fd9587d26e
commit 51a346bcbe
16 changed files with 144 additions and 129 deletions

View File

@ -109,6 +109,8 @@
#define CASE_PREFIX "id_"
#endif /* ^!SIMPLE_FILES */
#define STAGE_BUF_SIZE (64) /* usable size of the stage name buf in afl_state */
extern s8 interesting_8[INTERESTING_8_LEN];
extern s16 interesting_16[INTERESTING_8_LEN + INTERESTING_16_LEN];
extern s32
@ -479,7 +481,7 @@ typedef struct afl_state {
*stage_short, /* Short stage name */
*syncing_party; /* Currently syncing with... */
u8 stage_name_buf64[64]; /* A name buf with len 64 if needed */
u8 stage_name_buf[STAGE_BUF_SIZE]; /* reused stagename buf with len 64 */
s32 stage_cur, stage_max; /* Stage progression */
s32 splicing_with; /* Splicing with which test case? */
@ -540,6 +542,7 @@ typedef struct afl_state {
/* cmplog forkserver ids */
s32 cmplog_fsrv_ctl_fd, cmplog_fsrv_st_fd;
u32 cmplog_prev_timed_out;
u8 describe_op_buf_256[256]; /* describe_op will use this to return a string
up to 256 */
@ -555,6 +558,20 @@ typedef struct afl_state {
u32 document_counter;
#endif
/* statis file */
double last_bitmap_cvg, last_stability, last_eps;
/* plot file saves from last run */
u32 plot_prev_qp, plot_prev_pf, plot_prev_pnf, plot_prev_ce, plot_prev_md;
u64 plot_prev_qc, plot_prev_uc, plot_prev_uh;
u64 stats_last_stats_ms, stats_last_plot_ms, stats_last_ms, stats_last_execs;
double stats_avg_exec;
u8 clean_trace[MAP_SIZE];
u8 clean_trace_custom[MAP_SIZE];
u8 first_trace[MAP_SIZE];
} afl_state_t;
/* A global pointer to all instances is needed (for now) for signals to arrive
@ -786,7 +803,7 @@ u8 has_new_bits(afl_state_t *, u8 *);
u8 *DI(u64);
u8 *DF(double);
u8 *DMS(u64);
u8 *DTD(u64, u64);
void DTD(u8 *, size_t, u64, u64);
/* Extras */