use of com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues in project binnavi by google.
the class CDebuggerSynchronizerTest method testStepBreakpointLifecycle.
/**
* This test is used to determine whether the step breakpoint lifecycle (Set Step BP -> Hit Step
* BP -> Remove Step BP) works correctly.
*
* @throws DebugExceptionWrapper Thrown if something goes wrong.
*/
@SuppressWarnings("unchecked")
@Test
public void testStepBreakpointLifecycle() throws DebugExceptionWrapper {
mockDebugger.connect();
final TargetProcessThread thread = new TargetProcessThread(0, ThreadState.RUNNING);
mockDebugger.getProcessManager().addThread(thread);
mockDebugger.getBreakpointManager().addBreakpoints(BreakpointType.STEP, CommonTestObjects.BP_ADDRESS_123_SET);
mockDebugger.getBreakpointManager().addBreakpoints(BreakpointType.STEP, CommonTestObjects.BP_ADDRESS_456_SET);
debuggerSynchronizer.receivedEvent(new StepBreakpointSetReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_123_RELOC, 0), new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_456_RELOC, 0))));
assertEquals(BreakpointStatus.BREAKPOINT_ACTIVE, mockDebugger.getBreakpointManager().getBreakpointStatus(CommonTestObjects.BP_ADDRESS_123, BreakpointType.STEP));
assertEquals(BreakpointStatus.BREAKPOINT_ACTIVE, mockDebugger.getBreakpointManager().getBreakpointStatus(CommonTestObjects.BP_ADDRESS_456, BreakpointType.STEP));
final RegisterValues registerValues = new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(0, Lists.newArrayList(new RegisterValue("esp", BigInteger.valueOf(0x123), new byte[0], true, false)))));
debuggerSynchronizer.receivedEvent(new StepBreakpointHitReply(0, 0, 0, registerValues));
listener.toString();
assertTrue(Iterables.isEmpty(mockDebugger.getBreakpointManager().getBreakpoints(BreakpointType.STEP)));
assertEquals(thread, mockDebugger.getProcessManager().getActiveThread());
assertEquals(0x123, thread.getCurrentAddress().getAddress().toLong());
}
use of com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues in project binnavi by google.
the class CRegisterValuesParserTest method test3.
@Test
public void test3() throws MessageParserException {
final RegisterValues information = RegisterValuesParser.parse("<Registers><Thread id=\"3607910890\"><Register name=\"R0\" value=\"0\" memory=\"\"/><Register name=\"R1\" value=\"96722c80\" memory=\"\"/><Register name=\"R2\" value=\"6000001f\" memory=\"\"/><Register name=\"R3\" value=\"ffffc800\" memory=\"\"/><Register name=\"R4\" value=\"2\" memory=\"\"/><Register name=\"R5\" value=\"96101c30\" memory=\"\"/><Register name=\"R6\" value=\"0\" memory=\"\"/><Register name=\"R7\" value=\"0\" memory=\"\"/><Register name=\"R8\" value=\"ffffc894\" memory=\"\"/><Register name=\"R9\" value=\"964c1e70\" memory=\"\"/><Register name=\"R10\" value=\"1\" memory=\"\"/><Register name=\"R11\" value=\"9661f2b4\" memory=\"\"/><Register name=\"R12\" value=\"88045644\" memory=\"\"/><Register name=\"R13(SP)\" value=\"3e02fdf4\" memory=\"\" sp=\"true\"/><Register name=\"R14(LR)\" value=\"88045644\" memory=\"\"/><Register name=\"R15(PC)\" value=\"88045644\" memory=\"\" pc=\"true\"/><Register name=\"R16(PSR)\" value=\"6000001f\" memory=\"\"/></Thread></Registers>".getBytes());
assertEquals(3607910890L, information.getThreads().get(0).getTid());
}
Aggregations