use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CMemoryRefreshButtonSynchronizerTest method testThreads.
@Test
public void testThreads() throws DebugExceptionWrapper {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
debugger.getProcessManager().setAttached(true);
final TargetProcessThread thread = new TargetProcessThread(1, ThreadState.RUNNING);
m_model.setActiveDebugger(debugger);
debugger.getProcessManager().setActiveThread(null);
assertFalse(m_refreshButton.isEnabled());
debugger.getProcessManager().addThread(thread);
assertFalse(m_refreshButton.isEnabled());
debugger.getProcessManager().setActiveThread(thread);
assertTrue(m_refreshButton.isEnabled());
debugger.getProcessManager().setActiveThread(null);
assertFalse(m_refreshButton.isEnabled());
debugger.getProcessManager().removeThread(thread);
assertFalse(m_refreshButton.isEnabled());
debugger.getProcessManager().setAttached(false);
m_synchronizer.dispose();
debugger.close();
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CMemoryRefreshButtonSynchronizerTest method testReceiveTargetInformation.
@Test
public void testReceiveTargetInformation() throws DebugExceptionWrapper {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
m_model.setActiveDebugger(debugger);
debugger.connection.m_synchronizer.receivedEvent(new TargetInformationReply(0, 0, new TargetInformation(32, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, false, false, true, false, false, false, false, 1, 0, new ArrayList<DebuggerException>(), false, false, false))));
assertFalse(m_refreshButton.isEnabled());
assertEquals(m_defaultAction, m_refreshButton.getAction());
debugger.connection.m_synchronizer.receivedEvent(new TargetInformationReply(0, 0, new TargetInformation(32, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 1, 0, new ArrayList<DebuggerException>(), false, false, false))));
assertFalse(m_refreshButton.isEnabled());
assertEquals(m_askAction, m_refreshButton.getAction());
m_synchronizer.dispose();
debugger.close();
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CDebuggerSynchronizerTest method setUp.
@Before
public void setUp() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
mockDebugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
mockDebugger.setAddressTranslator(CommonTestObjects.MODULE, new CAddress(0), new CAddress(0x1000));
breakpointManager = mockDebugger.getBreakpointManager();
debuggerSynchronizer = new DebuggerSynchronizer(mockDebugger);
debuggerSynchronizer.addListener(listener);
// assign the synchronizer to the internally used one by the debugger so we can test the
// synchronizer itself
// as well as the combination of synchronizer and debugger
final Field synchronizerField = AbstractDebugger.class.getDeclaredField("synchronizer");
synchronizerField.setAccessible(true);
synchronizerField.set(mockDebugger, debuggerSynchronizer);
}
Aggregations