use of com.google.security.zynamics.binnavi.disassembly.RelocatedAddress 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.disassembly.RelocatedAddress in project binnavi by google.
the class CDebuggerSynchronizerTest method testSingleStep_Valid.
@Test
public void testSingleStep_Valid() throws MessageParserException, MaybeNullException {
breakpointManager.addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_333_SET);
breakpointManager.setBreakpointStatus(CommonTestObjects.BP_ADDRESS_333_SET, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_HIT);
mockDebugger.getProcessManager().addThread(new TargetProcessThread(123, ThreadState.SUSPENDED));
debuggerSynchronizer.receivedEvent(new SingleStepReply(0, 0, 123, new RelocatedAddress(new CAddress(0x999)), RegisterValuesParser.parse(("<Registers><Thread id=\"123\">" + "<Register name=\"EAX\" value=\"123\" memory=\"\" />" + "<Register name=\"EBX\" value=\"456\" memory=\"\" />" + "<Register name=\"EIP\" value=\"999\" memory=\"\" pc=\"true\" />" + "</Thread></Registers>").getBytes())));
assertEquals(ThreadState.SUSPENDED, mockDebugger.getProcessManager().getThread(123).getState());
assertEquals(0x999, mockDebugger.getProcessManager().getThread(123).getCurrentAddress().getAddress().toLong());
assertEquals(0x456, mockDebugger.getProcessManager().getThread(123).getRegisterValues().get(1).getValue().longValue());
assertEquals(BreakpointStatus.BREAKPOINT_ACTIVE, breakpointManager.getBreakpointStatus(CommonTestObjects.BP_ADDRESS_333, BreakpointType.REGULAR));
}
use of com.google.security.zynamics.binnavi.disassembly.RelocatedAddress 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.disassembly.RelocatedAddress in project binnavi by google.
the class CDebuggerSynchronizerTest method testRemoveBreakpointError_Valid.
@SuppressWarnings("unchecked")
@Test
public void testRemoveBreakpointError_Valid() {
breakpointManager.addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_456_SET);
breakpointManager.setBreakpointStatus(CommonTestObjects.BP_ADDRESS_456_SET, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_ACTIVE);
debuggerSynchronizer.receivedEvent(new BreakpointsRemovedReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_456_RELOC, 5))));
assertEquals(0, listener.exception);
assertEquals(1, breakpointManager.getNumberOfBreakpoints(BreakpointType.REGULAR));
assertEquals(BreakpointStatus.BREAKPOINT_INVALID, breakpointManager.getBreakpointStatus(CommonTestObjects.BP_ADDRESS_456, BreakpointType.REGULAR));
}
use of com.google.security.zynamics.binnavi.disassembly.RelocatedAddress 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));
}
Aggregations