Search in sources :

Example 6 with BreakpointsRemovedReply

use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointsRemovedReply 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));
}
Also used : BigInteger(java.math.BigInteger) StepBreakpointSetReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointSetReply) BreakpointSetReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointSetReply) EchoBreakpointSetReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointSetReply) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) EchoBreakpointsRemovedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointsRemovedReply) BreakpointsRemovedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointsRemovedReply) Test(org.junit.Test)

Example 7 with BreakpointsRemovedReply

use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointsRemovedReply 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);
}
Also used : StepBreakpointSetReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointSetReply) BreakpointSetReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointSetReply) EchoBreakpointSetReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointSetReply) TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) BreakpointConditionSetReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointConditionSetReply) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) StepBreakpointHitReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointHitReply) EchoBreakpointHitReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointHitReply) BreakpointHitReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointHitReply) RegisterValues(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues) BigInteger(java.math.BigInteger) RegisterValue(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValue) DetachReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.DetachReply) EchoBreakpointsRemovedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointsRemovedReply) BreakpointsRemovedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointsRemovedReply) StepBreakpointsRemovedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointsRemovedReply) EchoBreakpointHitReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointHitReply) ThreadRegisters(com.google.security.zynamics.binnavi.debug.models.targetinformation.ThreadRegisters) DebuggerClosedUnexpectedlyReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.DebuggerClosedUnexpectedlyReply) Test(org.junit.Test)

Example 8 with BreakpointsRemovedReply

use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointsRemovedReply in project binnavi by google.

the class CDebuggerSynchronizerTest method testRemoveBreakpointError_Invalid.

@SuppressWarnings("unchecked")
@Test
public void testRemoveBreakpointError_Invalid() {
    debuggerSynchronizer.receivedEvent(new BreakpointsRemovedReply(0, 5, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_456_RELOC, 0))));
    assertEquals(0, listener.exception);
    assertEquals(0, breakpointManager.getNumberOfBreakpoints(BreakpointType.REGULAR));
}
Also used : BigInteger(java.math.BigInteger) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) EchoBreakpointsRemovedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointsRemovedReply) BreakpointsRemovedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointsRemovedReply) Test(org.junit.Test)

Example 9 with BreakpointsRemovedReply

use of com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointsRemovedReply in project binnavi by google.

the class CDebuggerSynchronizerTest method testRemoveBreakpoint_Active.

@SuppressWarnings("unchecked")
@Test
public void testRemoveBreakpoint_Active() throws DebugExceptionWrapper {
    mockDebugger.connect();
    breakpointManager.addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_456_SET);
    breakpointManager.setBreakpointStatus(CommonTestObjects.BP_ADDRESS_456_SET, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_ACTIVE);
    mockDebugger.getProcessManager().addThread(new TargetProcessThread(123, ThreadState.SUSPENDED));
    breakpointManager.setBreakpointStatus(CommonTestObjects.BP_ADDRESS_456_SET, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_DELETING);
    debuggerSynchronizer.receivedEvent(new BreakpointsRemovedReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_456_RELOC, 0))));
    assertEquals(0, listener.exception);
    assertEquals(0, breakpointManager.getNumberOfBreakpoints(BreakpointType.REGULAR));
}
Also used : BigInteger(java.math.BigInteger) TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) EchoBreakpointsRemovedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointsRemovedReply) BreakpointsRemovedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointsRemovedReply) Test(org.junit.Test)

Aggregations

BreakpointsRemovedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointsRemovedReply)9 RelocatedAddress (com.google.security.zynamics.binnavi.disassembly.RelocatedAddress)9 EchoBreakpointsRemovedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointsRemovedReply)8 BigInteger (java.math.BigInteger)8 Test (org.junit.Test)8 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)4 BreakpointSetReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointSetReply)3 EchoBreakpointSetReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointSetReply)3 StepBreakpointSetReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointSetReply)3 BreakpointConditionSetReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointConditionSetReply)2 BreakpointHitReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointHitReply)2 DebuggerClosedUnexpectedlyReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.DebuggerClosedUnexpectedlyReply)2 DetachReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.DetachReply)2 EchoBreakpointHitReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointHitReply)2 StepBreakpointHitReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointHitReply)2 StepBreakpointsRemovedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointsRemovedReply)2 RegisterValue (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValue)2 RegisterValues (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues)2 ThreadRegisters (com.google.security.zynamics.binnavi.debug.models.targetinformation.ThreadRegisters)2 Pair (com.google.security.zynamics.zylib.general.Pair)1