mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
Merge remote-tracking branch 'origin/GP-0_Dan_testFixes-20220630-1'
This commit is contained in:
commit
c48bf245c1
8 changed files with 42 additions and 19 deletions
|
@ -84,6 +84,11 @@ public class DebuggerModelPlugin extends Plugin {
|
|||
@Override
|
||||
protected void dispose() {
|
||||
tool.removeComponentProvider(connectedProvider);
|
||||
synchronized (disconnectedProviders) {
|
||||
for (DebuggerModelProvider p : disconnectedProviders) {
|
||||
tool.removeComponentProvider(p);
|
||||
}
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import docking.widgets.tree.support.GTreeSelectionListener;
|
|||
import ghidra.app.plugin.core.debug.DebuggerCoordinates;
|
||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources;
|
||||
import ghidra.app.plugin.core.debug.gui.model.ObjectTreeModel.AbstractNode;
|
||||
import ghidra.trace.model.Trace;
|
||||
import ghidra.trace.model.target.TraceObjectKeyPath;
|
||||
|
||||
public class ObjectsTreePanel extends JPanel {
|
||||
|
@ -97,6 +98,16 @@ public class ObjectsTreePanel extends JPanel {
|
|||
return new KeepTreeState(tree);
|
||||
}
|
||||
|
||||
protected Trace computeDiffTrace(Trace current, Trace previous) {
|
||||
if (current == null) {
|
||||
return null;
|
||||
}
|
||||
if (previous == null) {
|
||||
return current;
|
||||
}
|
||||
return previous;
|
||||
}
|
||||
|
||||
public void goToCoordinates(DebuggerCoordinates coords) {
|
||||
// TODO: thread should probably become a TraceObject once we transition
|
||||
if (DebuggerCoordinates.equalsIgnoreRecorderAndView(current, coords)) {
|
||||
|
@ -105,7 +116,7 @@ public class ObjectsTreePanel extends JPanel {
|
|||
DebuggerCoordinates previous = current;
|
||||
this.current = coords;
|
||||
try (KeepTreeState keep = keepTreeState()) {
|
||||
treeModel.setDiffTrace(previous.getTrace());
|
||||
treeModel.setDiffTrace(computeDiffTrace(current.getTrace(), previous.getTrace()));
|
||||
treeModel.setTrace(current.getTrace());
|
||||
treeModel.setDiffSnap(previous.getSnap());
|
||||
treeModel.setSnap(current.getSnap());
|
||||
|
|
|
@ -346,10 +346,10 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerGUITest
|
|||
listingProvider, view, new ProgramLocation(view, start),
|
||||
new ProgramSelection(start, start.addWrap(3)), null);
|
||||
DockingActionIf action =
|
||||
Unique.assertOne(disassemblerPlugin.getPopupActions(tool, actionContext)
|
||||
runSwing(() -> Unique.assertOne(disassemblerPlugin.getPopupActions(tool, actionContext)
|
||||
.stream()
|
||||
.filter(a -> a.isAddToPopup(actionContext))
|
||||
.filter(actionPred));
|
||||
.filter(actionPred)));
|
||||
performAction(action, actionContext, true);
|
||||
waitForTasks();
|
||||
}
|
||||
|
@ -555,11 +555,11 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerGUITest
|
|||
listingProvider, view, new ProgramLocation(view, start),
|
||||
new ProgramSelection(start, start.addWrap(1)), null);
|
||||
FixedPlatformTracePatchInstructionAction action =
|
||||
Unique.assertOne(disassemblerPlugin.getPopupActions(tool, actionContext)
|
||||
runSwing(() -> Unique.assertOne(disassemblerPlugin.getPopupActions(tool, actionContext)
|
||||
.stream()
|
||||
.filter(a -> a instanceof FixedPlatformTracePatchInstructionAction)
|
||||
.map(a -> (FixedPlatformTracePatchInstructionAction) a)
|
||||
.filter(actionPred));
|
||||
.filter(actionPred)));
|
||||
|
||||
AssemblerPluginTestHelper helper =
|
||||
new AssemblerPluginTestHelper(action, null, listingProvider, tb.trace.getProgramView());
|
||||
|
|
|
@ -636,9 +636,11 @@ public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUI
|
|||
traceManager.activateThread(thread);
|
||||
waitForSwing();
|
||||
|
||||
RegisterRow rowR0 = registersProvider.getRegisterRow(r0);
|
||||
rowR0.setDataType(PointerDataType.dataType);
|
||||
registersProvider.setSelectedRow(rowR0);
|
||||
runSwing(() -> {
|
||||
RegisterRow rowR0 = registersProvider.getRegisterRow(r0);
|
||||
rowR0.setDataType(PointerDataType.dataType);
|
||||
registersProvider.setSelectedRow(rowR0);
|
||||
});
|
||||
waitForSwing();
|
||||
|
||||
performEnabledAction(registersProvider, watchesProvider.actionAddFromRegister, true);
|
||||
|
|
|
@ -211,8 +211,8 @@ public abstract class AbstractPatchAction extends DockingAction {
|
|||
fieldPanel = listingPanel.getFieldPanel();
|
||||
|
||||
fieldLayoutManager = new FieldPanelOverLayoutManager(fieldPanel);
|
||||
fieldPanel.setLayout(fieldLayoutManager);
|
||||
addLayoutListeners(fieldLayoutManager);
|
||||
fieldPanel.setLayout(fieldLayoutManager);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -349,8 +349,7 @@ public abstract class AbstractPatchAction extends DockingAction {
|
|||
}
|
||||
|
||||
ListingActionContext lac = (ListingActionContext) context;
|
||||
prepareLayout(lac);
|
||||
if (codeViewerProvider.isReadOnly()) {
|
||||
if (((CodeViewerProvider) lac.getComponentProvider()).isReadOnly()) {
|
||||
return null;
|
||||
}
|
||||
return lac.getCodeUnit();
|
||||
|
@ -365,9 +364,6 @@ public abstract class AbstractPatchAction extends DockingAction {
|
|||
|
||||
ListingActionContext lac = (ListingActionContext) context;
|
||||
prepareLayout(lac);
|
||||
if (codeViewerProvider.isReadOnly()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProgramLocation cur = lac.getLocation();
|
||||
program = cur.getProgram();
|
||||
|
|
|
@ -253,6 +253,10 @@ public class AssemblyDualTextField {
|
|||
super(model);
|
||||
}
|
||||
|
||||
void fakeFocusGained(JTextField field) {
|
||||
listener.fakeFocusGained(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPrefix(JTextField field) {
|
||||
if (field == assembly) {
|
||||
|
|
|
@ -18,7 +18,6 @@ package ghidra.app.plugin.core.assembler;
|
|||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
|
||||
|
@ -81,7 +80,9 @@ public class AssemblerPluginTestHelper {
|
|||
public List<AssemblyCompletion> inputAndGetCompletions(String text) {
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
instructionInput.setText(text);
|
||||
instructionInput.auto.startCompletion(instructionInput.getOperandsField());
|
||||
JTextField field = instructionInput.getOperandsField();
|
||||
instructionInput.auto.fakeFocusGained(field);
|
||||
instructionInput.auto.startCompletion(field);
|
||||
instructionInput.auto.updateNow();
|
||||
});
|
||||
return AbstractGenericTest.waitForValue(() -> AbstractGenericTest.runSwing(() -> {
|
||||
|
@ -128,7 +129,7 @@ public class AssemblerPluginTestHelper {
|
|||
AbstractGenericTest.runSwing(() -> patchInstructionAction.accept(ai));
|
||||
AbstractGhidraHeadedIntegrationTest.waitForProgram(program);
|
||||
|
||||
return Objects.requireNonNull(listing.getInstructionAt(address));
|
||||
return AbstractGTest.waitForValue(() -> listing.getInstructionAt(address));
|
||||
}
|
||||
|
||||
public Data patchDataAt(Address address, String expText, String newText) {
|
||||
|
@ -145,6 +146,6 @@ public class AssemblerPluginTestHelper {
|
|||
});
|
||||
AbstractGhidraHeadedIntegrationTest.waitForProgram(program);
|
||||
|
||||
return Objects.requireNonNull(listing.getDataAt(address));
|
||||
return AbstractGTest.waitForValue(() -> listing.getDataAt(address));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ public class TextFieldAutocompleter<T> {
|
|||
private DefaultListModel<T> listModel = new DefaultListModel<>();
|
||||
private DefaultListModel<T> blankModel = new DefaultListModel<>();
|
||||
private JList<T> list = new JList<>(listModel);
|
||||
private MyListener listener = new MyListener();
|
||||
/*test*/ protected MyListener listener = new MyListener();
|
||||
|
||||
private boolean pendingTextUpdate;
|
||||
private SwingUpdateManager updateManager = new SwingUpdateManager(DEFAULT_UPDATE_DELAY,
|
||||
|
@ -943,6 +943,10 @@ public class TextFieldAutocompleter<T> {
|
|||
updateDisplayContents();
|
||||
}
|
||||
|
||||
/*test*/ public void fakeFocusGained(JTextField field) {
|
||||
focus = field;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
Component opp = e.getOppositeComponent();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue