Changes to print stats more periodically rather than relying on a new block being instrumented
MODIFY
frida_mode/hook/frida_hook.c
frida_mode/hook/frida_hook.c
*
*/
-
#include <stdint.h>
#include <string.h>

MODIFY
frida_mode/include/stats.h
frida_mode/include/stats.h
@@ -28,6 +28,7 @@ gboolean stats_is_supported_arch(void);
size_t stats_data_size_arch(void);
void stats_collect_arch(const cs_insn *instr);
void stats_write_arch(void);
+void stats_on_fork(void);
#endif

MODIFY
frida_mode/src/entry.c
frida_mode/src/entry.c
#include "persistent.h"
#include "ranges.h"
#include "stalker.h"
+#include "stats.h"
#include "util.h"
extern void __afl_manual_init();
@@ -21,6 +22,7 @@ static void entry_launch(void) {
/* Child here */
instrument_previous_pc = 0;
+ stats_on_fork();
}

MODIFY
frida_mode/src/stats/stats.c
frida_mode/src/stats/stats.c
@@ -178,10 +178,12 @@ void stats_write(void) {
}
-static void stats_maybe_write(void) {
+void stats_on_fork(void) {
guint64 current_time;
+ if (stats_filename == NULL) { return; }
+
if (stats_interval == 0) { return; }
current_time = g_get_monotonic_time();
@@ -208,7 +210,5 @@ void stats_collect(const cs_insn *instr, gboolean begin) {
stats_collect_arch(instr);
- stats_maybe_write();
-
}

Changes to print stats more periodically rather than relying on a new block being instrumented (#1011)

Co-authored-by: Your Name <you@example.com>