about summary refs log tree commit diff
path: root/frida_mode/src/instrument.c
diff options
context:
space:
mode:
Diffstat (limited to 'frida_mode/src/instrument.c')
-rw-r--r--frida_mode/src/instrument.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/frida_mode/src/instrument.c b/frida_mode/src/instrument.c
index 042fdab8..22910062 100644
--- a/frida_mode/src/instrument.c
+++ b/frida_mode/src/instrument.c
@@ -174,7 +174,13 @@ void instrument_coverage_optimize(const cs_insn *   instr,
 
 static void on_basic_block(GumCpuContext *context, gpointer user_data) {
 
-  /* Avoid stack operations in potentially performance critical code */
+  /*
+   * This function is performance critical as it is called to instrument every
+   * basic block. By moving our print buffer to a global, we avoid it affecting
+   * the critical path with additional stack adjustments if tracing is not
+   * enabled. If tracing is enabled, then we're printing a load of diagnostic
+   * information so this overhead is unlikely to be noticeable.
+   */
   static char buffer[200];
   int         len;
   guint64     current_pc = (guint64)user_data;