GP-3706: updated review changes

GP-3706: Fixed emulator resume button after Pcode step
This commit is contained in:
GhidraHamster 2023-09-28 19:46:52 +00:00
parent ebaaed7d53
commit 73fa8e19d9
3 changed files with 26 additions and 1 deletions

View File

@ -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 -> {

View File

@ -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();

View File

@ -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|