From 73fa8e19d9f4c0c73ac8eb81c118a05ade9b55aa Mon Sep 17 00:00:00 2001 From: GhidraHamster Date: Thu, 28 Sep 2023 19:46:52 +0000 Subject: [PATCH] GP-3706: updated review changes GP-3706: Fixed emulator resume button after Pcode step --- .../gui/control/DebuggerControlPlugin.java | 4 +++- .../control/DebuggerControlPluginTest.java | 22 +++++++++++++++++++ certification.local.manifest | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/control/DebuggerControlPlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/control/DebuggerControlPlugin.java index 8e84fb196f..65e8cba072 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/control/DebuggerControlPlugin.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/control/DebuggerControlPlugin.java @@ -56,6 +56,7 @@ import ghidra.trace.model.Trace.TraceObjectChangeType; import ghidra.trace.model.target.TraceObject; import ghidra.trace.model.target.TraceObjectValue; import ghidra.trace.model.time.schedule.Scheduler; +import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.util.*; @PluginInfo( @@ -875,7 +876,8 @@ public class DebuggerControlPlugin extends AbstractDebuggerPlugin return; } DebuggerCoordinates current = this.current; - emulationService.backgroundRun(current.getPlatform(), current.getTime(), + TraceSchedule time = current.getTime(); + emulationService.backgroundRun(current.getPlatform(), time.steppedForward(null, 0), Scheduler.oneThread(current.getThread())).thenAcceptAsync(r -> { traceManager.activate(current.time(r.schedule()), ActivationCause.USER); }, AsyncUtils.SWING_EXECUTOR).exceptionally(ex -> { diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/control/DebuggerControlPluginTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/control/DebuggerControlPluginTest.java index 3672d49d9a..2bd228b5e1 100644 --- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/control/DebuggerControlPluginTest.java +++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/control/DebuggerControlPluginTest.java @@ -306,6 +306,28 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerGUITe assertTrue(controlPlugin.actionEmulateResume.isEnabled()); } + /** + * Tests the UI so it does not error when the user presses resume + * after already stepped into a pcode instruction. + */ + @Test + public void testEmulateResumeActionAfterPcodeStep() throws Throwable { + TraceThread thread = createToyLoopTrace(); + controlService.setCurrentMode(tb.trace, ControlMode.RW_EMULATOR); + + traceManager.activateThread(thread); + traceManager.activateTime(TraceSchedule.parse("0:.t0-2")); + waitForSwing(); + + performEnabledAction(null, controlPlugin.actionEmulateResume, true); + waitForPass(() -> assertFalse(controlPlugin.actionEmulateResume.isEnabled())); + + CachedEmulator ce = Unique.assertOne(emulationService.getBusyEmulators()); + ce.emulator().setSuspended(true); + waitForTasks(); + assertTrue(controlPlugin.actionEmulateResume.isEnabled()); + } + @Test public void testEmulateInterruptAction() throws Throwable { TraceThread thread = createToyLoopTrace(); diff --git a/certification.local.manifest b/certification.local.manifest index 59f4759ca5..58244501fa 100644 --- a/certification.local.manifest +++ b/certification.local.manifest @@ -7,4 +7,5 @@ DevGuide.md||GHIDRA||||END| LICENSE||GHIDRA||||END| NOTICE||GHIDRA||||END| README.md||GHIDRA||||END| +ghidra.repos.config||GHIDRA||||END| gradle.properties||GHIDRA||||END|