Merge remote-tracking branch 'origin/GP-0_Dan_testFixes-2024-02-22-1'

This commit is contained in:
Ryan Kurtz 2024-02-22 13:56:22 -05:00
commit 6b9cb2e55a
4 changed files with 343 additions and 32 deletions

View file

@ -26,7 +26,7 @@ import org.junit.Test;
import db.Transaction; import db.Transaction;
import ghidra.app.plugin.assembler.*; import ghidra.app.plugin.assembler.*;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest;
import ghidra.app.services.*; import ghidra.app.services.DebuggerControlService;
import ghidra.app.services.DebuggerControlService.StateEditor; import ghidra.app.services.DebuggerControlService.StateEditor;
import ghidra.async.AsyncUtils.TemperamentalRunnable; import ghidra.async.AsyncUtils.TemperamentalRunnable;
import ghidra.dbg.target.TargetRegisterBank; import ghidra.dbg.target.TargetRegisterBank;
@ -73,15 +73,14 @@ public class DebuggerControlServiceTest extends AbstractGhidraHeadedDebuggerTest
<E extends Throwable> E expecting(Class<E> cls, TemperamentalRunnable action) { <E extends Throwable> E expecting(Class<E> cls, TemperamentalRunnable action) {
try { try {
action.run(); action.run();
fail("Expected exception type " + cls + ", but got no error.");
} }
catch (Throwable e) { catch (Throwable e) {
if (cls.isInstance(e)) { if (cls.isInstance(e)) {
return cls.cast(e); return cls.cast(e);
} }
fail("Expection exception type " + cls + ", but got " + e); throw new AssertionError("Expection exception type " + cls + ", but got " + e, e);
} }
throw new AssertionError(); throw new AssertionError("Expected exception type " + cls + ", but got no error.");
} }
@Before @Before
@ -518,6 +517,7 @@ public class DebuggerControlServiceTest extends AbstractGhidraHeadedDebuggerTest
@Test @Test
public void testWriteReadOnlyMemoryErr() throws Throwable { public void testWriteReadOnlyMemoryErr() throws Throwable {
createAndOpenTrace(); createAndOpenTrace();
targetService.publishTarget(new MockTarget(tb.trace));
activateTrace(); activateTrace();
controlService.setCurrentMode(tb.trace, ControlMode.RO_TARGET); controlService.setCurrentMode(tb.trace, ControlMode.RO_TARGET);
@ -531,6 +531,7 @@ public class DebuggerControlServiceTest extends AbstractGhidraHeadedDebuggerTest
@Test @Test
public void testWriteReadOnlyRegisterErr() throws Throwable { public void testWriteReadOnlyRegisterErr() throws Throwable {
createAndOpenTrace(); createAndOpenTrace();
targetService.publishTarget(new MockTarget(tb.trace));
activateTrace(); activateTrace();
controlService.setCurrentMode(tb.trace, ControlMode.RO_TARGET); controlService.setCurrentMode(tb.trace, ControlMode.RO_TARGET);

View file

@ -0,0 +1,254 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.app.plugin.core.debug.service.control;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import docking.ActionContext;
import ghidra.async.AsyncUtils;
import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;
import ghidra.debug.api.target.ActionName;
import ghidra.debug.api.target.Target;
import ghidra.debug.api.target.Target.ActionEntry;
import ghidra.debug.api.tracemgr.DebuggerCoordinates;
import ghidra.program.model.address.*;
import ghidra.program.model.lang.Register;
import ghidra.program.model.lang.RegisterValue;
import ghidra.trace.model.Trace;
import ghidra.trace.model.breakpoint.TraceBreakpoint;
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
import ghidra.trace.model.guest.TracePlatform;
import ghidra.trace.model.stack.TraceStackFrame;
import ghidra.trace.model.target.TraceObjectKeyPath;
import ghidra.trace.model.thread.TraceThread;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
class MockTarget implements Target {
private final Trace trace;
private long snap = 0;
public MockTarget(Trace trace) {
this.trace = trace;
}
@Override
public boolean isValid() {
return true;
}
@Override
public Trace getTrace() {
return trace;
}
public void setSnap(long snap) {
this.snap = snap;
}
@Override
public long getSnap() {
return snap;
}
@Override
public Map<String, ActionEntry> collectActions(ActionName name, ActionContext context) {
return Map.of();
}
@Override
public TraceThread getThreadForSuccessor(TraceObjectKeyPath path) {
return null;
}
@Override
public TargetExecutionState getThreadExecutionState(TraceThread thread) {
return null;
}
@Override
public TraceStackFrame getStackFrameForSuccessor(TraceObjectKeyPath path) {
return null;
}
@Override
public boolean isSupportsFocus() {
return false;
}
@Override
public TraceObjectKeyPath getFocus() {
return null;
}
@Override
public CompletableFuture<Void> activateAsync(DebuggerCoordinates prev,
DebuggerCoordinates coords) {
return AsyncUtils.nil();
}
@Override
public void activate(DebuggerCoordinates prev, DebuggerCoordinates coords) {
}
@Override
public CompletableFuture<Void> invalidateMemoryCachesAsync() {
return AsyncUtils.nil();
}
@Override
public void invalidateMemoryCaches() {
}
@Override
public CompletableFuture<Void> readMemoryAsync(AddressSetView set, TaskMonitor monitor) {
return AsyncUtils.nil();
}
@Override
public void readMemory(AddressSetView set, TaskMonitor monitor) throws CancelledException {
}
@Override
public CompletableFuture<Void> writeMemoryAsync(Address address, byte[] data) {
return AsyncUtils.nil();
}
@Override
public void writeMemory(Address address, byte[] data) {
}
@Override
public CompletableFuture<Void> readRegistersAsync(TracePlatform platform,
TraceThread thread, int frame, Set<Register> registers) {
return AsyncUtils.nil();
}
@Override
public void readRegisters(TracePlatform platform, TraceThread thread, int frame,
Set<Register> registers) {
}
@Override
public CompletableFuture<Void> readRegistersAsync(TracePlatform platform,
TraceThread thread, int frame, AddressSetView guestSet) {
return AsyncUtils.nil();
}
@Override
public void readRegisters(TracePlatform platform, TraceThread thread, int frame,
AddressSetView guestSet) {
}
@Override
public CompletableFuture<Void> writeRegisterAsync(TracePlatform platform,
TraceThread thread, int frame, RegisterValue value) {
return AsyncUtils.nil();
}
@Override
public void writeRegister(TracePlatform platform, TraceThread thread, int frame,
RegisterValue value) {
}
@Override
public CompletableFuture<Void> writeRegisterAsync(TracePlatform platform,
TraceThread thread, int frame, Address address, byte[] data) {
return AsyncUtils.nil();
}
@Override
public void writeRegister(TracePlatform platform, TraceThread thread, int frame,
Address address, byte[] data) {
}
@Override
public boolean isVariableExists(TracePlatform platform, TraceThread thread, int frame,
Address address, int length) {
return false;
}
@Override
public CompletableFuture<Void> writeVariableAsync(TracePlatform platform,
TraceThread thread, int frame, Address address, byte[] data) {
return AsyncUtils.nil();
}
@Override
public void writeVariable(TracePlatform platform, TraceThread thread, int frame,
Address address, byte[] data) {
}
@Override
public Set<TraceBreakpointKind> getSupportedBreakpointKinds() {
return Set.of();
}
@Override
public CompletableFuture<Void> placeBreakpointAsync(AddressRange range,
Set<TraceBreakpointKind> kinds, String condition, String commands) {
return AsyncUtils.nil();
}
@Override
public void placeBreakpoint(AddressRange range, Set<TraceBreakpointKind> kinds,
String condition, String commands) {
}
@Override
public boolean isBreakpointValid(TraceBreakpoint breakpoint) {
return false;
}
@Override
public CompletableFuture<Void> deleteBreakpointAsync(TraceBreakpoint breakpoint) {
return AsyncUtils.nil();
}
@Override
public void deleteBreakpoint(TraceBreakpoint breakpoint) {
}
@Override
public CompletableFuture<Void> toggleBreakpointAsync(TraceBreakpoint breakpoint,
boolean enabled) {
return AsyncUtils.nil();
}
@Override
public void toggleBreakpoint(TraceBreakpoint breakpoint, boolean enabled) {
}
@Override
public CompletableFuture<Void> forceTerminateAsync() {
return AsyncUtils.nil();
}
@Override
public void forceTerminate() {
}
@Override
public CompletableFuture<Void> disconnectAsync() {
return AsyncUtils.nil();
}
@Override
public void disconnect() {
}
}

View file

@ -21,6 +21,8 @@ import java.io.IOException;
import java.math.BigInteger; import java.math.BigInteger;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate; import java.util.function.Predicate;
import org.junit.Test; import org.junit.Test;
@ -28,8 +30,11 @@ import org.junit.Test;
import db.Transaction; import db.Transaction;
import docking.widgets.fieldpanel.Layout; import docking.widgets.fieldpanel.Layout;
import docking.widgets.fieldpanel.field.Field; import docking.widgets.fieldpanel.field.Field;
import docking.widgets.fieldpanel.listener.IndexMapper;
import docking.widgets.fieldpanel.listener.LayoutModelListener;
import docking.widgets.fieldpanel.support.FieldLocation; import docking.widgets.fieldpanel.support.FieldLocation;
import generic.Unique; import generic.Unique;
import generic.test.rule.Repeated;
import ghidra.app.decompiler.*; import ghidra.app.decompiler.*;
import ghidra.app.decompiler.component.*; import ghidra.app.decompiler.component.*;
import ghidra.app.plugin.assembler.*; import ghidra.app.plugin.assembler.*;
@ -37,6 +42,7 @@ import ghidra.app.plugin.assembler.sleigh.sem.*;
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin; import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
import ghidra.app.plugin.core.debug.disassemble.TraceDisassembleCommand; import ghidra.app.plugin.core.debug.disassemble.TraceDisassembleCommand;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest;
import ghidra.app.plugin.core.debug.gui.action.NoneLocationTrackingSpec;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin; import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin;
import ghidra.app.plugin.core.debug.gui.stack.vars.*; import ghidra.app.plugin.core.debug.gui.stack.vars.*;
import ghidra.app.plugin.core.debug.gui.stack.vars.VariableValueRow.*; import ghidra.app.plugin.core.debug.gui.stack.vars.VariableValueRow.*;
@ -80,6 +86,7 @@ import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.Scheduler; import ghidra.trace.model.time.schedule.Scheduler;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.NumericUtilities; import ghidra.util.NumericUtilities;
import junit.framework.AssertionFailedError;
public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest { public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@ -882,8 +889,6 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
} }
protected Function runToTallestRecursionAndCreateFrames(int n) throws Throwable { protected Function runToTallestRecursionAndCreateFrames(int n) throws Throwable {
addPlugins();
Function function = createFibonacciProgramX86_32(); Function function = createFibonacciProgramX86_32();
Address entry = function.getEntryPoint(); Address entry = function.getEntryPoint();
@ -932,8 +937,6 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
} }
protected Function runToRetSetGlobalAndCreateFrames() throws Throwable { protected Function runToRetSetGlobalAndCreateFrames() throws Throwable {
addPlugins();
Function function = createSetGlobalProgramX86_32(); Function function = createSetGlobalProgramX86_32();
Address entry = function.getEntryPoint(); Address entry = function.getEntryPoint();
@ -976,8 +979,6 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
} }
protected Function runToRetFillStructAndCreateFrames() throws Throwable { protected Function runToRetFillStructAndCreateFrames() throws Throwable {
addPlugins();
Function function = createFillStructProgramX86_32(); Function function = createFillStructProgramX86_32();
Address entry = function.getEntryPoint(); Address entry = function.getEntryPoint();
@ -1020,8 +1021,6 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
} }
protected Function runToRetFillStructArrayAndCreateFrames() throws Throwable { protected Function runToRetFillStructArrayAndCreateFrames() throws Throwable {
addPlugins();
Function function = createFillStructArrayProgramX86_32(); Function function = createFillStructArrayProgramX86_32();
Address entry = function.getEntryPoint(); Address entry = function.getEntryPoint();
@ -1065,6 +1064,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testCreateFramesTallestX86_32() throws Throwable { public void testCreateFramesTallestX86_32() throws Throwable {
addPlugins();
Function function = runToTallestRecursionAndCreateFrames(9); Function function = runToTallestRecursionAndCreateFrames(9);
DebuggerCoordinates tallest = traceManager.getCurrent(); DebuggerCoordinates tallest = traceManager.getCurrent();
@ -1174,6 +1174,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testStackVariableHover() throws Throwable { public void testStackVariableHover() throws Throwable {
addPlugins();
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
Function function = runToTallestRecursionAndCreateFrames(2); Function function = runToTallestRecursionAndCreateFrames(2);
@ -1195,6 +1196,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testRegisterVariableHover() throws Throwable { public void testRegisterVariableHover() throws Throwable {
addPlugins();
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
Function function = runToTallestRecursionAndCreateFrames(2); Function function = runToTallestRecursionAndCreateFrames(2);
@ -1215,6 +1217,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testReturnParameterHover() throws Throwable { public void testReturnParameterHover() throws Throwable {
addPlugins();
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
Function function = runToTallestRecursionAndCreateFrames(2); Function function = runToTallestRecursionAndCreateFrames(2);
@ -1235,6 +1238,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testGlobalOperandHover() throws Throwable { public void testGlobalOperandHover() throws Throwable {
addPlugins();
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
runToRetSetGlobalAndCreateFrames(); runToRetSetGlobalAndCreateFrames();
@ -1280,6 +1284,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testGlobalOperandInTraceHover() throws Throwable { public void testGlobalOperandInTraceHover() throws Throwable {
addPlugins();
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
runToRetSetGlobalAndCreateFrames(); runToRetSetGlobalAndCreateFrames();
@ -1305,6 +1310,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testStackReferenceHover() throws Throwable { public void testStackReferenceHover() throws Throwable {
addPlugins();
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
runToTallestRecursionAndCreateFrames(2); runToTallestRecursionAndCreateFrames(2);
@ -1327,6 +1333,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testRegisterReferenceHover() throws Throwable { public void testRegisterReferenceHover() throws Throwable {
addPlugins();
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
runToTallestRecursionAndCreateFrames(2); runToTallestRecursionAndCreateFrames(2);
@ -1348,6 +1355,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testSavedRegisterReferenceHover() throws Throwable { public void testSavedRegisterReferenceHover() throws Throwable {
addPlugins();
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
// need 3 frames. 0 has already popped EBP, so not saved. 1 will save on behalf of 2. // need 3 frames. 0 has already popped EBP, so not saved. 1 will save on behalf of 2.
@ -1369,6 +1377,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testRegisterReferenceInTraceHover() throws Throwable { public void testRegisterReferenceInTraceHover() throws Throwable {
addPlugins();
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
runToTallestRecursionAndCreateFrames(2); runToTallestRecursionAndCreateFrames(2);
@ -1451,13 +1460,34 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
}); });
} }
protected HoverLocation findTokenLocation(Function function, String tokText, String fieldText) { protected HoverLocation findTokenLocation(Function function, String tokText, String fieldText)
throws Throwable {
CompletableFuture<Void> ready = new CompletableFuture<>();
decompilerPanel.getLayoutController().addLayoutModelListener(new LayoutModelListener() {
@Override
public void modelSizeChanged(IndexMapper indexMapper) {
if (decompilerPanel.getCurrentLocation() != null) {
ready.complete(null);
}
}
@Override
public void dataChanged(BigInteger start, BigInteger end) {
}
});
tool.showComponentProvider(decompilerProvider, true); tool.showComponentProvider(decompilerProvider, true);
ready.get(5, TimeUnit.SECONDS);
try {
return findTokenLocation(decompilerPanel, function, tokText, fieldText); return findTokenLocation(decompilerPanel, function, tokText, fieldText);
} }
catch (AssertionFailedError e) {
throw e;
}
}
@Test @Test
public void testGlobalHighVarHover() throws Throwable { public void testGlobalHighVarHover() throws Throwable {
addPlugins();
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
Function function = runToRetSetGlobalAndCreateFrames(); Function function = runToRetSetGlobalAndCreateFrames();
@ -1480,6 +1510,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testStackHighVarHover() throws Throwable { public void testStackHighVarHover() throws Throwable {
addPlugins();
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
Function function = runToTallestRecursionAndCreateFrames(2); Function function = runToTallestRecursionAndCreateFrames(2);
@ -1501,6 +1532,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testRegisterHighVarHover() throws Throwable { public void testRegisterHighVarHover() throws Throwable {
addPlugins();
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
Function function = runToTallestRecursionAndCreateFrames(2); Function function = runToTallestRecursionAndCreateFrames(2);
@ -1522,6 +1554,9 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testStructureGlobalHighVarStruct() throws Throwable { public void testStructureGlobalHighVarStruct() throws Throwable {
addPlugins();
// PC Tracking interferes with goTo
listingPlugin.setTrackingSpec(NoneLocationTrackingSpec.INSTANCE);
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
Function function = runToRetFillStructAndCreateFrames(); Function function = runToRetFillStructAndCreateFrames();
@ -1544,6 +1579,9 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testStructureGlobalHighVarStructField() throws Throwable { public void testStructureGlobalHighVarStructField() throws Throwable {
addPlugins();
// PC Tracking interferes with goTo
listingPlugin.setTrackingSpec(NoneLocationTrackingSpec.INSTANCE);
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
Function function = runToRetFillStructAndCreateFrames(); Function function = runToRetFillStructAndCreateFrames();
@ -1565,6 +1603,9 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testStructureStackHighVarStruct() throws Throwable { public void testStructureStackHighVarStruct() throws Throwable {
addPlugins();
// PC Tracking interferes with goTo
listingPlugin.setTrackingSpec(NoneLocationTrackingSpec.INSTANCE);
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
Function function = runToRetFillStructAndCreateFrames(); Function function = runToRetFillStructAndCreateFrames();
@ -1588,6 +1629,9 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testStructureStackHighVarStructField() throws Throwable { public void testStructureStackHighVarStructField() throws Throwable {
addPlugins();
// PC Tracking interferes with goTo
listingPlugin.setTrackingSpec(NoneLocationTrackingSpec.INSTANCE);
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
Function function = runToRetFillStructAndCreateFrames(); Function function = runToRetFillStructAndCreateFrames();
@ -1610,6 +1654,9 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testStructurePointerRegisterHighVarStruct() throws Throwable { public void testStructurePointerRegisterHighVarStruct() throws Throwable {
addPlugins();
// PC Tracking interferes with goTo
listingPlugin.setTrackingSpec(NoneLocationTrackingSpec.INSTANCE);
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
runToRetFillStructAndCreateFrames(); runToRetFillStructAndCreateFrames();
@ -1634,6 +1681,9 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testStructurePointerRegisterHighVarStructField() throws Throwable { public void testStructurePointerRegisterHighVarStructField() throws Throwable {
addPlugins();
// PC Tracking interferes with goTo
listingPlugin.setTrackingSpec(NoneLocationTrackingSpec.INSTANCE);
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
runToRetFillStructAndCreateFrames(); runToRetFillStructAndCreateFrames();
@ -1656,6 +1706,9 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
@Test @Test
public void testArrayGlobalHighVarIndexedField() throws Throwable { public void testArrayGlobalHighVarIndexedField() throws Throwable {
addPlugins();
// PC Tracking interferes with goTo
listingPlugin.setTrackingSpec(NoneLocationTrackingSpec.INSTANCE);
VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class); VariableValueHoverPlugin valuesPlugin = addPlugin(tool, VariableValueHoverPlugin.class);
VariableValueHoverService valuesService = valuesPlugin.getHoverService(); VariableValueHoverService valuesService = valuesPlugin.getHoverService();
runToRetFillStructArrayAndCreateFrames(); runToRetFillStructArrayAndCreateFrames();
@ -1680,7 +1733,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {
/** /**
* e.g., dstack._12_4_ * e.g., dstack._12_4_
*/ */
public void testOffcutPieceReference() throws Throwable { public void testOffcutPieceReference() {
Unfinished.TODO(); Unfinished.TODO();
} }

View file

@ -355,11 +355,11 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
})); }));
escapePopupMenu(); escapePopupMenu();
waitForPass(() -> {
lb.disableForProgram(); lb.disableForProgram();
waitForDomainObject(program); waitForDomainObject(program);
waitForPass( assertEquals(State.INCONSISTENT_DISABLED, lb.computeStateForProgram(program));
() -> assertEquals(State.INCONSISTENT_DISABLED, });
lb.computeStateForProgram(program)));
waitForPass(noExc(() -> { waitForPass(noExc(() -> {
clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123), clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),
@ -387,10 +387,11 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
})); }));
escapePopupMenu(); escapePopupMenu();
waitForPass(() -> {
lb.enableForProgram(); lb.enableForProgram();
waitForDomainObject(program); waitForDomainObject(program);
waitForPass( assertEquals(State.INCONSISTENT_ENABLED, lb.computeStateForProgram(program));
() -> assertEquals(State.INCONSISTENT_ENABLED, lb.computeStateForProgram(program))); });
waitForPass(noExc(() -> { waitForPass(noExc(() -> {
clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123), clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),
@ -424,10 +425,11 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
})); }));
escapePopupMenu(); escapePopupMenu();
waitForPass(() -> {
lb.disableForProgram(); // Adds "enable", which will only affect bookmark lb.disableForProgram(); // Adds "enable", which will only affect bookmark
waitForDomainObject(program); waitForDomainObject(program);
waitForPass( assertEquals(State.INCONSISTENT_ENABLED, lb.computeStateForTrace(trace));
() -> assertEquals(State.INCONSISTENT_ENABLED, lb.computeStateForTrace(trace))); });
waitForPass(noExc(() -> { waitForPass(noExc(() -> {
clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123), clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123),
@ -455,10 +457,11 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
})); }));
escapePopupMenu(); escapePopupMenu();
waitForPass(() -> {
lb.enableForProgram(); // This time, adds "disable", which will only affect bookmark lb.enableForProgram(); // This time, adds "disable", which will only affect bookmark
waitForDomainObject(program); waitForDomainObject(program);
waitForPass( assertEquals(State.INCONSISTENT_DISABLED, lb.computeStateForTrace(trace));
() -> assertEquals(State.INCONSISTENT_DISABLED, lb.computeStateForTrace(trace))); });
waitForPass(noExc(() -> { waitForPass(noExc(() -> {
clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123), clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123),