use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CMemoryViewerSynchronizerTest method testActiveDebugger.
@Test
public void testActiveDebugger() {
final IGraphModel graphModel = new MockGraphModel();
final CDebugPerspectiveModel model = new CDebugPerspectiveModel(graphModel);
final JHexView hexView = new JHexView();
final CMemoryProvider provider = new CMemoryProvider();
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
model.setActiveDebugger(debugger);
final CMemoryViewerSynchronizer synchronizer = new CMemoryViewerSynchronizer(hexView, provider, model);
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))));
assertEquals(AddressMode.BIT32, hexView.getAddressMode());
debugger.connection.m_synchronizer.receivedEvent(new TargetInformationReply(0, 0, new TargetInformation(64, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 1, 0, new ArrayList<DebuggerException>(), false, false, false))));
assertEquals(AddressMode.BIT64, hexView.getAddressMode());
synchronizer.dispose();
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CDumpAllWaiterTest method testSuccess.
@Test
public void testSuccess() 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, 0, new CAddress(0x300), new byte[] { 0x50, 0x50, 0x50, 0x50 }));
Thread.sleep(250);
assertFalse(waiter.isAlive());
assertTrue(waiter.success());
debugger.close();
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CDumpAllWaiterTest method testDetach.
@Test
public void testDetach() 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 DetachReply(0, 0));
Thread.sleep(250);
assertFalse(waiter.isAlive());
assertTrue(waiter.success());
debugger.close();
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CDumpAllWaiterTest method testCloseRequested.
@Test
public void testCloseRequested() 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);
waiter.closeRequested();
Thread.sleep(250);
debugger.close();
assertFalse(waiter.isAlive());
assertTrue(waiter.success());
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CSearchWaiterTest method testSuccess.
@Test
public void testSuccess() 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, 0, new CAddress(0x300)));
Thread.sleep(250);
assertFalse(waiter.isAlive());
assertNotNull(waiter.getReply());
assertTrue(waiter.getReply().success());
debugger.close();
}
Aggregations