mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
4b2bc8985b
4 changed files with 39 additions and 6 deletions
|
@ -59,6 +59,7 @@ import ghidra.trace.model.Trace.TraceObjectChangeType;
|
||||||
import ghidra.trace.model.target.TraceObject;
|
import ghidra.trace.model.target.TraceObject;
|
||||||
import ghidra.trace.model.target.TraceObjectValue;
|
import ghidra.trace.model.target.TraceObjectValue;
|
||||||
import ghidra.trace.model.time.schedule.Scheduler;
|
import ghidra.trace.model.time.schedule.Scheduler;
|
||||||
|
import ghidra.trace.model.time.schedule.TraceSchedule;
|
||||||
import ghidra.util.*;
|
import ghidra.util.*;
|
||||||
|
|
||||||
@PluginInfo(
|
@PluginInfo(
|
||||||
|
@ -878,7 +879,8 @@ public class DebuggerControlPlugin extends AbstractDebuggerPlugin
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DebuggerCoordinates current = this.current;
|
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 -> {
|
Scheduler.oneThread(current.getThread())).thenAcceptAsync(r -> {
|
||||||
traceManager.activate(current.time(r.schedule()), ActivationCause.USER);
|
traceManager.activate(current.time(r.schedule()), ActivationCause.USER);
|
||||||
}, AsyncUtils.SWING_EXECUTOR).exceptionally(ex -> {
|
}, AsyncUtils.SWING_EXECUTOR).exceptionally(ex -> {
|
||||||
|
|
|
@ -308,6 +308,28 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerGUITe
|
||||||
assertTrue(controlPlugin.actionEmulateResume.isEnabled());
|
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
|
@Test
|
||||||
public void testEmulateInterruptAction() throws Throwable {
|
public void testEmulateInterruptAction() throws Throwable {
|
||||||
TraceThread thread = createToyLoopTrace();
|
TraceThread thread = createToyLoopTrace();
|
||||||
|
|
|
@ -21,9 +21,10 @@ import java.beans.PropertyChangeEvent;
|
||||||
import docking.DockingWindowManager;
|
import docking.DockingWindowManager;
|
||||||
import docking.EmptyBorderToggleButton;
|
import docking.EmptyBorderToggleButton;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
|
import ghidra.util.Swing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toolbar buttons for Dialogs.
|
* Toolbar buttons for Dialogs.
|
||||||
*
|
*
|
||||||
* <p>This class exists because dialog actions are not added to the regular tool's toolbars. This
|
* <p>This class exists because dialog actions are not added to the regular tool's toolbars. This
|
||||||
* means that we have to create the dialog's toolbars outside of the tool. Thus, this class
|
* means that we have to create the dialog's toolbars outside of the tool. Thus, this class
|
||||||
|
@ -40,7 +41,7 @@ public class DialogToolbarButton extends EmptyBorderToggleButton {
|
||||||
addMouseListener(new MouseOverMouseListener());
|
addMouseListener(new MouseOverMouseListener());
|
||||||
action.addPropertyChangeListener(propertyChangeListener);
|
action.addPropertyChangeListener(propertyChangeListener);
|
||||||
|
|
||||||
// make sure this button gets our specialized tooltip
|
// make sure this button gets our specialized tooltip
|
||||||
DockingToolBarUtils.setToolTipText(this, dockingAction);
|
DockingToolBarUtils.setToolTipText(this, dockingAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,11 +53,18 @@ public class DialogToolbarButton extends EmptyBorderToggleButton {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doActionPerformed(ActionEvent e) {
|
protected void doActionPerformed(ActionEvent e) {
|
||||||
|
|
||||||
|
// The help is pointing to the toolbar button that triggered this call. Reset the help so
|
||||||
|
// that it is correct for any widgets triggered by the actionPeformed call below.
|
||||||
|
DockingWindowManager.clearMouseOverHelp();
|
||||||
|
|
||||||
if (dockingAction instanceof ToggleDockingActionIf) {
|
if (dockingAction instanceof ToggleDockingActionIf) {
|
||||||
ToggleDockingActionIf toggleAction = (ToggleDockingActionIf) dockingAction;
|
ToggleDockingActionIf toggleAction = (ToggleDockingActionIf) dockingAction;
|
||||||
toggleAction.setSelected(!toggleAction.isSelected());
|
toggleAction.setSelected(!toggleAction.isSelected());
|
||||||
}
|
}
|
||||||
dockingAction.actionPerformed(contextProvider.getActionContext(null));
|
|
||||||
|
// Give the Swing thread a chance to repaint
|
||||||
|
Swing.runLater(() -> dockingAction.actionPerformed(contextProvider.getActionContext(null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -84,7 +92,7 @@ public class DialogToolbarButton extends EmptyBorderToggleButton {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
// overridden to account for the fact that "special" DockableActions can be either
|
// overridden to account for the fact that "special" DockableActions can be either
|
||||||
// toggle buttons or regular non-toggle buttons, which dictates whether this
|
// toggle buttons or regular non-toggle buttons, which dictates whether this
|
||||||
// button is selected (non-toggle buttons are not selectable).
|
// button is selected (non-toggle buttons are not selectable).
|
||||||
protected boolean isButtonSelected() {
|
protected boolean isButtonSelected() {
|
||||||
if (dockingAction instanceof ToggleDockingAction) {
|
if (dockingAction instanceof ToggleDockingAction) {
|
||||||
|
@ -101,7 +109,7 @@ public class DialogToolbarButton extends EmptyBorderToggleButton {
|
||||||
// overridden to reflect the potentiality that our action is a toggle action
|
// overridden to reflect the potentiality that our action is a toggle action
|
||||||
public void setSelected(boolean b) {
|
public void setSelected(boolean b) {
|
||||||
if (dockingAction instanceof ToggleDockingActionIf) {
|
if (dockingAction instanceof ToggleDockingActionIf) {
|
||||||
// only change the state if the action is a toggle action; doing otherwise would
|
// only change the state if the action is a toggle action; doing otherwise would
|
||||||
// break the DockableAction
|
// break the DockableAction
|
||||||
((ToggleDockingActionIf) dockingAction).setSelected(b);
|
((ToggleDockingActionIf) dockingAction).setSelected(b);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,4 +7,5 @@ DevGuide.md||GHIDRA||||END|
|
||||||
LICENSE||GHIDRA||||END|
|
LICENSE||GHIDRA||||END|
|
||||||
NOTICE||GHIDRA||||END|
|
NOTICE||GHIDRA||||END|
|
||||||
README.md||GHIDRA||||END|
|
README.md||GHIDRA||||END|
|
||||||
|
ghidra.repos.config||GHIDRA||||END|
|
||||||
gradle.properties||GHIDRA||||END|
|
gradle.properties||GHIDRA||||END|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue