use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.DetachReply in project binnavi by google.
the class CStackViewSynchronizerTest method testDetach.
@Test
public void testDetach() throws DebugExceptionWrapper {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
final TargetProcessThread thread = new TargetProcessThread(1, ThreadState.SUSPENDED);
debugger.getProcessManager().addThread(thread);
debugger.getProcessManager().setActiveThread(thread);
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, 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));
assertTrue(m_stackView.isEnabled());
debugger.connection.m_synchronizer.receivedEvent(new DetachReply(0, 0));
assertFalse(m_stackView.isEnabled());
m_synchronizer.dispose();
debugger.close();
}
use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.DetachReply in project binnavi by google.
the class CDebuggerSynchronizerTest method testDetachError.
@Test
public void testDetachError() {
debuggerSynchronizer.receivedEvent(new DetachReply(0, 5));
assertFalse(mockDebugger.isConnected());
assertEquals("ERROR_DETACH/5;", listener.events);
}
use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.DetachReply in project binnavi by google.
the class DebuggerTest method testListeners2.
@SuppressWarnings("unchecked")
@Test
public void testListeners2() throws DebugExceptionWrapper {
final DebuggerListener listener = new DebuggerListener();
debugger.addListener(listener);
mockDebugger.connect();
mockDebugger.getProcessManager().addThread(new TargetProcessThread(1, ThreadState.RUNNING));
mockDebugger.connection.m_synchronizer.receivedEvent(new BreakpointConditionSetReply(0, 0));
mockDebugger.connection.m_synchronizer.receivedEvent(new BreakpointConditionSetReply(0, 1));
mockDebugger.connection.m_synchronizer.receivedEvent(new BreakpointHitReply(0, 0, 1, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(1, Lists.newArrayList(new RegisterValue("eip", BigInteger.ONE, new byte[0], true, false)))))));
mockDebugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_123_SET);
mockDebugger.connection.m_synchronizer.receivedEvent(new BreakpointSetReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 0))));
mockDebugger.connection.m_synchronizer.receivedEvent(new BreakpointSetReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 1))));
mockDebugger.connection.m_synchronizer.receivedEvent(new BreakpointsRemovedReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 0))));
mockDebugger.connection.m_synchronizer.receivedEvent(new BreakpointsRemovedReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 1))));
mockDebugger.getBreakpointManager().removeBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_123_SET);
mockDebugger.connection.m_synchronizer.receivedEvent(new DebuggerClosedUnexpectedlyReply());
mockDebugger.connection.m_synchronizer.receivedEvent(new DetachReply(0, 0));
mockDebugger.connection.m_synchronizer.receivedEvent(new DetachReply(0, 1));
mockDebugger.connection.m_synchronizer.receivedEvent(new EchoBreakpointHitReply(0, 0, 1, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(1, Lists.newArrayList(new RegisterValue("eip", BigInteger.ONE, new byte[0], false, false)))))));
mockDebugger.connection.m_synchronizer.receivedEvent(new EchoBreakpointHitReply(0, 0, 1, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(1, Lists.newArrayList(new RegisterValue("eip", BigInteger.ONE, new byte[0], true, false)))))));
debugger.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.DetachReply in project binnavi by google.
the class CMemoryRefreshButtonSynchronizerTest method testDetach.
@Test
public void testDetach() throws DebugExceptionWrapper {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
final TargetProcessThread thread = new TargetProcessThread(0, ThreadState.SUSPENDED);
debugger.getProcessManager().addThread(thread);
m_model.setActiveDebugger(debugger);
debugger.getProcessManager().setActiveThread(thread);
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))));
assertEquals(thread, debugger.getProcessManager().getActiveThread());
assertTrue(m_refreshButton.isEnabled());
assertEquals(m_defaultAction, m_refreshButton.getAction());
debugger.connection.m_synchronizer.receivedEvent(new DetachReply(0, 0));
assertFalse(m_refreshButton.isEnabled());
m_synchronizer.dispose();
debugger.close();
}
use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.DetachReply in project binnavi by google.
the class CMemorySectionPanelSynchronizerTest method testDetach.
@Test
public void testDetach() throws DebugExceptionWrapper {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
final TargetProcessThread thread = new TargetProcessThread(1, ThreadState.SUSPENDED);
debugger.getProcessManager().addThread(thread);
debugger.getProcessManager().setActiveThread(thread);
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, 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));
assertEquals(2, m_sectionBox.getItemCount());
assertEquals(section1, m_sectionBox.getItemAt(0).getObject());
assertEquals(section2, m_sectionBox.getItemAt(1).getObject());
assertTrue(m_sectionBox.isEnabled());
debugger.connection.m_synchronizer.receivedEvent(new DetachReply(0, 0));
assertEquals(0, m_sectionBox.getItemCount());
assertFalse(m_sectionBox.isEnabled());
m_synchronizer.dispose();
debugger.close();
}
Aggregations