use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CRegisterViewSynchronizerTest method testThreads.
@Test
public void testThreads() throws DebugExceptionWrapper {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
debugger.getProcessManager().setAttached(true);
debugger.connection.m_synchronizer.receivedEvent(new TargetInformationReply(0, 0, new TargetInformation(32, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, true, false, false, false, false, false, false, 1, 0, new ArrayList<DebuggerException>(), false, false, false))));
final MemorySection section1 = new MemorySection(new CAddress(0x100), new CAddress(0x1FF));
final MemorySection section2 = new MemorySection(new CAddress(0x300), new CAddress(0x3FF));
final MemoryMap memoryMap = new MemoryMap(Lists.newArrayList(section1, section2));
debugger.connection.m_synchronizer.receivedEvent(new MemoryMapReply(0, 0, memoryMap));
final TargetProcessThread thread = new TargetProcessThread(1, ThreadState.RUNNING);
debugger.getProcessManager().addThread(thread);
m_model.setActiveDebugger(debugger);
assertFalse(m_registerView.isEnabled());
final TargetProcessThread thread2 = new TargetProcessThread(2, ThreadState.RUNNING);
debugger.getProcessManager().addThread(thread2);
assertFalse(m_registerView.isEnabled());
debugger.getProcessManager().setActiveThread(thread2);
assertTrue(m_registerView.isEnabled());
debugger.getProcessManager().setActiveThread(null);
assertFalse(m_registerView.isEnabled());
debugger.getProcessManager().removeThread(thread);
assertFalse(m_registerView.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 CMemoryViewerSynchronizerTest method setUp.
@Before
public void setUp() {
final IGraphModel graphModel = new MockGraphModel();
m_model = new CDebugPerspectiveModel(graphModel);
final CMemoryProvider provider = new CMemoryProvider();
m_hexView.setData(provider);
m_synchronizer = new CMemoryViewerSynchronizer(m_hexView, provider, m_model);
m_debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
m_model.setActiveDebugger(m_debugger);
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CDumpAllWaiterTest method testFailure.
@Test
public void testFailure() throws Exception {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
final CDumpAllWaiter waiter = new CDumpAllWaiter(debugger, new CAddress(0x300), 0x100);
waiter.start();
new Thread() {
@Override
public void run() {
try {
waiter.runExpensiveCommand();
} catch (final Exception e) {
}
}
}.start();
Thread.sleep(250);
debugger.connection.m_synchronizer.receivedEvent(new ReadMemoryReply(0, 3, null, null));
Thread.sleep(250);
assertFalse(waiter.isAlive());
assertFalse(waiter.success());
debugger.close();
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CSearchWaiterTest method testCloseRequested.
@Test
public void testCloseRequested() throws Exception {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(0x300), 0x100, new byte[] { 10 });
waiter.start();
new Thread() {
@Override
public void run() {
try {
waiter.runExpensiveCommand();
} catch (final Exception e) {
}
}
}.start();
Thread.sleep(250);
waiter.closeRequested();
Thread.sleep(250);
debugger.close();
assertFalse(waiter.isAlive());
assertNull(waiter.getReply());
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CSearchWaiterTest method testFailure.
@Test
public void testFailure() throws Exception {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(0x300), 0x100, new byte[] { 10 });
waiter.start();
new Thread() {
@Override
public void run() {
try {
waiter.runExpensiveCommand();
} catch (final Exception e) {
}
}
}.start();
Thread.sleep(250);
debugger.connection.m_synchronizer.receivedEvent(new SearchReply(0, 3, null));
Thread.sleep(250);
assertFalse(waiter.isAlive());
assertNotNull(waiter.getReply());
assertFalse(waiter.getReply().success());
debugger.close();
}
Aggregations