Merge remote-tracking branch 'origin/patch'

This commit is contained in:
Ryan Kurtz 2023-10-02 06:48:58 -04:00
commit 4b2bc8985b
4 changed files with 39 additions and 6 deletions

View file

@ -59,6 +59,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(
@ -878,7 +879,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

@ -308,6 +308,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();