use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointSetReply in project binnavi by google.
the class CHistoryStringBuilderTest method testComplete2.
@SuppressWarnings("unchecked")
@Test
public void testComplete2() throws DebugExceptionWrapper {
final CHistoryStringBuilder builder = new CHistoryStringBuilder();
builder.setDebugger(m_debugger);
m_debugger.connect();
m_synchronizer.receivedEvent(DebuggerMessageBuilder.buildProcessStartReply(mockMemoryModule));
m_debugger.getProcessManager().addThread(new TargetProcessThread(1, ThreadState.RUNNING));
m_synchronizer.receivedEvent(new BreakpointConditionSetReply(0, 0));
m_synchronizer.receivedEvent(new BreakpointConditionSetReply(0, 1));
try {
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], false, false)))))));
fail();
} catch (final IllegalStateException e) {
}
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)))))));
m_breakpointManager.addBreakpoints(BreakpointType.REGULAR, BREAKPOINT_ADDRESS);
m_synchronizer.receivedEvent(new BreakpointSetReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(BREAKPOINT_ADDRESS_RELOC, 0))));
m_synchronizer.receivedEvent(new BreakpointSetReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(BREAKPOINT_ADDRESS_RELOC, 1))));
m_synchronizer.receivedEvent(new BreakpointsRemovedReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(BREAKPOINT_ADDRESS_RELOC, 0))));
m_synchronizer.receivedEvent(new BreakpointsRemovedReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(BREAKPOINT_ADDRESS_RELOC, 1))));
m_breakpointManager.removeBreakpoints(BreakpointType.REGULAR, BREAKPOINT_ADDRESS);
m_synchronizer.receivedEvent(new DebuggerClosedUnexpectedlyReply());
m_synchronizer.receivedEvent(new DetachReply(0, 0));
m_synchronizer.receivedEvent(new DetachReply(0, 1));
}
use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointSetReply in project binnavi by google.
the class CDebuggerSynchronizerTest method testBreakpointSetErr.
@SuppressWarnings("unchecked")
@Test
public void testBreakpointSetErr() {
breakpointManager.addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_123_SET);
debuggerSynchronizer.receivedEvent(new BreakpointSetReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 5))));
assertEquals(BreakpointStatus.BREAKPOINT_INVALID, breakpointManager.getBreakpointStatus(CommonTestObjects.BP_ADDRESS_123, BreakpointType.REGULAR));
assertEquals("ERROR_SET_BREAKPOINTS/00001123/5;", listener.events);
}
use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointSetReply in project binnavi by google.
the class CDebuggerSynchronizerTest method testBreakpointRemoveSucc.
@SuppressWarnings("unchecked")
@Test
public void testBreakpointRemoveSucc() throws DebugExceptionWrapper {
mockDebugger.connect();
breakpointManager.addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_123_SET);
debuggerSynchronizer.receivedEvent(new BreakpointSetReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 0))));
breakpointManager.setBreakpointStatus(CommonTestObjects.BP_ADDRESS_123_SET, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_DELETING);
debuggerSynchronizer.receivedEvent(new BreakpointsRemovedReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 0))));
assertEquals(0, breakpointManager.getNumberOfBreakpoints(BreakpointType.REGULAR));
}
use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointSetReply in project binnavi by google.
the class CDebuggerSynchronizerTest method testBreakpointSetSucc.
@SuppressWarnings("unchecked")
@Test
public void testBreakpointSetSucc() {
breakpointManager.addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_123_SET);
debuggerSynchronizer.receivedEvent(new BreakpointSetReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 0))));
assertEquals(1, breakpointManager.getNumberOfBreakpoints(BreakpointType.REGULAR));
assertEquals(BreakpointStatus.BREAKPOINT_ACTIVE, breakpointManager.getBreakpointStatus(CommonTestObjects.BP_ADDRESS_123, BreakpointType.REGULAR));
}
use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointSetReply 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);
}
Aggregations