aboutsummaryrefslogtreecommitdiff
path: root/frida_mode/src/instrument
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-12-20 18:14:57 +0000
committerYour Name <you@example.com>2021-12-20 18:14:57 +0000
commitd59a76261db02141dae06bf804fd0f84679f0d34 (patch)
treeabe5e84e618ba5ae0a926bdd9e3a37cf2c4af4c7 /frida_mode/src/instrument
parentdb19116ce692a7a317ee3e0f4a553f754465eb47 (diff)
downloadafl++-d59a76261db02141dae06bf804fd0f84679f0d34.tar.gz
Improvements to debug output
Diffstat (limited to 'frida_mode/src/instrument')
-rw-r--r--frida_mode/src/instrument/instrument.c28
-rw-r--r--frida_mode/src/instrument/instrument_coverage.c22
-rw-r--r--frida_mode/src/instrument/instrument_debug.c10
-rw-r--r--frida_mode/src/instrument/instrument_x64.c8
4 files changed, 38 insertions, 30 deletions
diff --git a/frida_mode/src/instrument/instrument.c b/frida_mode/src/instrument/instrument.c
index 8ee21f5b..e3f3717e 100644
--- a/frida_mode/src/instrument/instrument.c
+++ b/frida_mode/src/instrument/instrument.c
@@ -274,14 +274,19 @@ void instrument_init(void) {
if (!instrument_is_coverage_optimize_supported()) instrument_optimize = false;
- FOKF("Instrumentation - optimize [%c]", instrument_optimize ? 'X' : ' ');
- FOKF("Instrumentation - tracing [%c]", instrument_tracing ? 'X' : ' ');
- FOKF("Instrumentation - unique [%c]", instrument_unique ? 'X' : ' ');
- FOKF("Instrumentation - fixed seed [%c] [0x%016" G_GINT64_MODIFIER "x]",
+ FOKF(cBLU "Instrumentation" cRST " - " cGRN "optimize:" cYEL " [%c]",
+ instrument_optimize ? 'X' : ' ');
+ FOKF(cBLU "Instrumentation" cRST " - " cGRN "tracing:" cYEL " [%c]",
+ instrument_tracing ? 'X' : ' ');
+ FOKF(cBLU "Instrumentation" cRST " - " cGRN "unique:" cYEL " [%c]",
+ instrument_unique ? 'X' : ' ');
+ FOKF(cBLU "Instrumentation" cRST " - " cGRN "fixed seed:" cYEL
+ " [%c] [0x%016" G_GINT64_MODIFIER "x]",
instrument_use_fixed_seed ? 'X' : ' ', instrument_fixed_seed);
- FOKF("Instrumentation - unstable coverage [%c] [%s]",
- instrument_coverage_unstable_filename == NULL ? ' ' : 'X',
- instrument_coverage_unstable_filename);
+ FOKF(cBLU "Instrumentation" cRST " - " cGRN "unstable coverage:" cYEL " [%s]",
+ instrument_coverage_unstable_filename == NULL
+ ? " "
+ : instrument_coverage_unstable_filename);
if (instrument_tracing && instrument_optimize) {
@@ -366,15 +371,16 @@ void instrument_init(void) {
}
- FOKF("Instrumentation - seed [0x%016" G_GINT64_MODIFIER "x]",
+ FOKF(cBLU "Instrumentation" cRST " - " cGRN "seed:" cYEL
+ " [0x%016" G_GINT64_MODIFIER "x]",
instrument_hash_seed);
instrument_hash_zero = instrument_get_offset_hash(0);
- instrument_coverage_optimize_init();
- instrument_debug_init();
- instrument_coverage_init();
asan_init();
cmplog_init();
+ instrument_coverage_init();
+ instrument_coverage_optimize_init();
+ instrument_debug_init();
}
diff --git a/frida_mode/src/instrument/instrument_coverage.c b/frida_mode/src/instrument/instrument_coverage.c
index c1984eb2..098e7269 100644
--- a/frida_mode/src/instrument/instrument_coverage.c
+++ b/frida_mode/src/instrument/instrument_coverage.c
@@ -659,17 +659,17 @@ void instrument_coverage_config(void) {
void instrument_coverage_normal_init(void) {
- FOKF("Coverage - enabled [%c]",
- instrument_coverage_filename == NULL ? ' ' : 'X');
+ FOKF(cBLU "Instrumentation" cRST " - " cGRN "coverage:" cYEL " [%s]",
+ instrument_coverage_filename == NULL ? " "
+ : instrument_coverage_filename);
if (instrument_coverage_filename == NULL) { return; }
- FOKF("Coverage - file [%s]", instrument_coverage_filename);
-
char *path = g_canonicalize_filename(instrument_coverage_filename,
g_get_current_dir());
- FOKF("Coverage - path [%s]", path);
+ FOKF(cBLU "Instrumentation" cRST " - " cGRN "coverage path:" cYEL " [%s]",
+ path);
normal_coverage_fd = open(path, O_RDWR | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
@@ -718,7 +718,7 @@ void instrument_coverage_unstable_find_output(void) {
GDir *dir = g_dir_open(fds_name, 0, NULL);
- FOKF("Coverage Unstable - fds: %s", fds_name);
+ FVERBOSE("Coverage Unstable - fds: %s", fds_name);
for (const gchar *filename = g_dir_read_name(dir); filename != NULL;
filename = g_dir_read_name(dir)) {
@@ -782,18 +782,24 @@ void instrument_coverage_unstable_find_output(void) {
}
- FOKF("Fuzzer stats: %s", unstable_coverage_fuzzer_stats);
+ FVERBOSE("Fuzzer stats: %s", unstable_coverage_fuzzer_stats);
}
void instrument_coverage_unstable_init(void) {
+ FOKF(cBLU "Instrumentation" cRST " - " cGRN "unstable coverage:" cYEL " [%s]",
+ instrument_coverage_unstable_filename == NULL
+ ? " "
+ : instrument_coverage_unstable_filename);
if (instrument_coverage_unstable_filename == NULL) { return; }
char *path = g_canonicalize_filename(instrument_coverage_unstable_filename,
g_get_current_dir());
- FOKF("Coverage - unstable path [%s]", instrument_coverage_unstable_filename);
+ FOKF(cBLU "Instrumentation" cRST " - " cGRN "unstable coverage path:" cYEL
+ " [%s]",
+ path == NULL ? " " : path);
unstable_coverage_fd = open(path, O_RDWR | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
diff --git a/frida_mode/src/instrument/instrument_debug.c b/frida_mode/src/instrument/instrument_debug.c
index b5fdf988..a1f80467 100644
--- a/frida_mode/src/instrument/instrument_debug.c
+++ b/frida_mode/src/instrument/instrument_debug.c
@@ -94,19 +94,15 @@ void instrument_debug_config(void) {
void instrument_debug_init(void) {
- FOKF("Instrumentation debugging - enabled [%c]",
- instrument_debug_filename == NULL ? ' ' : 'X');
-
- if (instrument_debug_filename == NULL) { return; }
-
- FOKF("Instrumentation debugging - file [%s]", instrument_debug_filename);
+ FOKF(cBLU "Instrumentation" cRST " - " cGRN "debugging:" cYEL " [%s]",
+ instrument_debug_filename == NULL ? " " : instrument_debug_filename);
if (instrument_debug_filename == NULL) { return; }
char *path =
g_canonicalize_filename(instrument_debug_filename, g_get_current_dir());
- FOKF("Instrumentation debugging - path [%s]", path);
+ FOKF(cBLU "Instrumentation" cRST " - " cGRN "path:" cYEL " [%s]", path);
debugging_fd = open(path, O_RDWR | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
diff --git a/frida_mode/src/instrument/instrument_x64.c b/frida_mode/src/instrument/instrument_x64.c
index b51cb697..b7b6ca6f 100644
--- a/frida_mode/src/instrument/instrument_x64.c
+++ b/frida_mode/src/instrument/instrument_x64.c
@@ -323,7 +323,7 @@ void instrument_coverage_optimize_init(void) {
gum_process_enumerate_ranges(GUM_PAGE_NO_ACCESS, instrument_coverage_find_low,
&low_address);
- FOKF("Low address: %p", low_address);
+ FVERBOSE("Low address: %p", low_address);
if (low_address == 0 ||
GPOINTER_TO_SIZE(low_address) > ((2UL << 20) - __afl_map_size)) {
@@ -335,7 +335,7 @@ void instrument_coverage_optimize_init(void) {
ranges_print_debug_maps();
char *shm_env = getenv(SHM_ENV_VAR);
- FOKF("SHM_ENV_VAR: %s", shm_env);
+ FVERBOSE("SHM_ENV_VAR: %s", shm_env);
if (shm_env == NULL) {
@@ -359,8 +359,8 @@ void instrument_coverage_optimize_init(void) {
}
- FOKF("__afl_area_ptr: %p", __afl_area_ptr);
- FOKF("instrument_previous_pc: %p", &instrument_previous_pc);
+ FVERBOSE("__afl_area_ptr: %p", __afl_area_ptr);
+ FVERBOSE("instrument_previous_pc: %p", &instrument_previous_pc);
}