mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
GP-0: Fixing ModulesProviderTest
This commit is contained in:
parent
6398db9587
commit
f421f49d78
2 changed files with 26 additions and 9 deletions
|
@ -46,6 +46,7 @@ import ghidra.dbg.model.TestTargetModule;
|
||||||
import ghidra.dbg.model.TestTargetTypedefDataType;
|
import ghidra.dbg.model.TestTargetTypedefDataType;
|
||||||
import ghidra.dbg.util.TargetDataTypeConverter;
|
import ghidra.dbg.util.TargetDataTypeConverter;
|
||||||
import ghidra.framework.main.DataTreeDialog;
|
import ghidra.framework.main.DataTreeDialog;
|
||||||
|
import ghidra.framework.model.DomainObject;
|
||||||
import ghidra.framework.store.LockException;
|
import ghidra.framework.store.LockException;
|
||||||
import ghidra.plugin.importer.ImporterPlugin;
|
import ghidra.plugin.importer.ImporterPlugin;
|
||||||
import ghidra.program.model.address.AddressOverflowException;
|
import ghidra.program.model.address.AddressOverflowException;
|
||||||
|
@ -493,6 +494,13 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
|
||||||
new AddressSet(listing.getCurrentSelection()));
|
new AddressSet(listing.getCurrentSelection()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void waitForLock(DomainObject lockable) {
|
||||||
|
waitForPass(() -> { // This is so gross
|
||||||
|
assertTrue(lockable.lock(null));
|
||||||
|
lockable.unlock();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testActionCaptureTypes() throws Exception {
|
public void testActionCaptureTypes() throws Exception {
|
||||||
assertFalse(modulesProvider.actionCaptureTypes.isEnabled());
|
assertFalse(modulesProvider.actionCaptureTypes.isEnabled());
|
||||||
|
@ -523,7 +531,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
|
||||||
// TODO: When action is included, put this assertion back
|
// TODO: When action is included, put this assertion back
|
||||||
//assertTrue(modulesProvider.actionCaptureTypes.isEnabled());
|
//assertTrue(modulesProvider.actionCaptureTypes.isEnabled());
|
||||||
|
|
||||||
performAction(modulesProvider.actionCaptureTypes, false);
|
performAction(modulesProvider.actionCaptureTypes, true);
|
||||||
waitForBusyTool(tool);
|
waitForBusyTool(tool);
|
||||||
waitForDomainObject(trace);
|
waitForDomainObject(trace);
|
||||||
|
|
||||||
|
@ -533,11 +541,14 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
|
||||||
DataType expType =
|
DataType expType =
|
||||||
conv.convertTargetDataType(typedef).get(DEFAULT_WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
|
conv.convertTargetDataType(typedef).get(DEFAULT_WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
|
||||||
// TODO: Some heuristic or convention to extract the module name, if applicable
|
// TODO: Some heuristic or convention to extract the module name, if applicable
|
||||||
DataType actType = dtm.getDataType("/Processes[1].Modules[first_proc].Types/myInt");
|
waitForPass(() -> {
|
||||||
assertTypeEquals(expType, actType);
|
DataType actType = dtm.getDataType("/Processes[1].Modules[first_proc].Types/myInt");
|
||||||
|
assertTypeEquals(expType, actType);
|
||||||
|
});
|
||||||
|
|
||||||
// TODO: When capture-types action is included, put this assertion back
|
// TODO: When capture-types action is included, put this assertion back
|
||||||
//assertTrue(modulesProvider.actionCaptureTypes.isEnabled());
|
//assertTrue(modulesProvider.actionCaptureTypes.isEnabled());
|
||||||
|
waitForLock(trace);
|
||||||
recorder.stopRecording();
|
recorder.stopRecording();
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
assertFalse(modulesProvider.actionCaptureTypes.isEnabled());
|
assertFalse(modulesProvider.actionCaptureTypes.isEnabled());
|
||||||
|
@ -567,11 +578,15 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
|
||||||
|
|
||||||
traceManager.activateTrace(trace);
|
traceManager.activateTrace(trace);
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
modulesProvider.setSelectedModules(Set.of(recorder.getTraceModule(module)));
|
waitForPass(() -> {
|
||||||
waitForSwing();
|
TraceModule traceModule = recorder.getTraceModule(module);
|
||||||
assertTrue(modulesProvider.actionCaptureSymbols.isEnabled());
|
assertNotNull(traceModule);
|
||||||
|
modulesProvider.setSelectedModules(Set.of(traceModule));
|
||||||
|
waitForSwing();
|
||||||
|
assertTrue(modulesProvider.actionCaptureSymbols.isEnabled());
|
||||||
|
});
|
||||||
|
|
||||||
performAction(modulesProvider.actionCaptureSymbols, false);
|
performAction(modulesProvider.actionCaptureSymbols, true);
|
||||||
waitForBusyTool(tool);
|
waitForBusyTool(tool);
|
||||||
waitForDomainObject(trace);
|
waitForDomainObject(trace);
|
||||||
|
|
||||||
|
@ -589,6 +604,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
|
||||||
// TODO: Check data type once those are captured in Data units.
|
// TODO: Check data type once those are captured in Data units.
|
||||||
|
|
||||||
assertTrue(modulesProvider.actionCaptureSymbols.isEnabled());
|
assertTrue(modulesProvider.actionCaptureSymbols.isEnabled());
|
||||||
|
waitForLock(trace);
|
||||||
recorder.stopRecording();
|
recorder.stopRecording();
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
assertFalse(modulesProvider.actionCaptureSymbols.isEnabled());
|
assertFalse(modulesProvider.actionCaptureSymbols.isEnabled());
|
||||||
|
|
|
@ -19,8 +19,9 @@ import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import ghidra.dbg.target.TargetBreakpointSpecContainer;
|
import ghidra.dbg.target.TargetBreakpointLocationContainer;
|
||||||
import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointKind;
|
import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointKind;
|
||||||
|
import ghidra.dbg.target.TargetBreakpointSpecContainer;
|
||||||
import ghidra.program.model.address.AddressRange;
|
import ghidra.program.model.address.AddressRange;
|
||||||
|
|
||||||
// TODO: Test some other breakpoint conventions:
|
// TODO: Test some other breakpoint conventions:
|
||||||
|
@ -31,7 +32,7 @@ import ghidra.program.model.address.AddressRange;
|
||||||
|
|
||||||
public class TestTargetBreakpointContainer
|
public class TestTargetBreakpointContainer
|
||||||
extends DefaultTestTargetObject<TestTargetBreakpoint, TestTargetProcess>
|
extends DefaultTestTargetObject<TestTargetBreakpoint, TestTargetProcess>
|
||||||
implements TargetBreakpointSpecContainer {
|
implements TargetBreakpointSpecContainer, TargetBreakpointLocationContainer {
|
||||||
|
|
||||||
protected static final TargetBreakpointKindSet ALL_KINDS =
|
protected static final TargetBreakpointKindSet ALL_KINDS =
|
||||||
TargetBreakpointKindSet.of(TargetBreakpointKind.values());
|
TargetBreakpointKindSet.of(TargetBreakpointKind.values());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue