Ghidra is a software reverse engineering (SRE) framework
GP-2715: Call modifier.initialExecuteCallback only once per thread
Dan043a6aa3bbb0
diff --git a/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/pcode/emu/ModifiedPcodeThread.java b/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/pcode/emu/ModifiedPcodeThread.javaindex b967904182..e08771f78e 100644--- a/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/pcode/emu/ModifiedPcodeThread.java+++ b/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/pcode/emu/ModifiedPcodeThread.java@@ -113,7 +113,15 @@ public class ModifiedPcodeThread<T> extends DefaultPcodeThread<T> {}}- // Part of the glue that makes existing state modifiers work in new emulation framework+ /**+ * Part of the glue that makes existing state modifiers work in new emulation framework+ *+ * <p>+ * <b>NOTE:</b> These are instantiated one per thread, rather than sharing one across the+ * machine, because some of the modifiers are stateful and assume a single-threaded model. The+ * best way to mitigate that assumption is to ensure a modifier is responsible for only a single+ * thread, even though a machine may have multiple threads.+ */protected final EmulateInstructionStateModifier modifier;protected final Emulate emulate;@@ -194,7 +202,8 @@ public class ModifiedPcodeThread<T> extends DefaultPcodeThread<T> {}@Override- protected void preExecuteInstruction() {+ public void reInitialize() {+ super.reInitialize();if (modifier != null) {savedCounter = getCounter();modifier.initialExecuteCallback(emulate, savedCounter, getContext());