Search in sources :

Example 21 with RelocatedAddress

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);
}
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) Test(org.junit.Test)

Example 22 with RelocatedAddress

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));
}
Also used : SingleStepReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SingleStepReply) TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 23 with RelocatedAddress

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));
}
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) Test(org.junit.Test)

Example 24 with RelocatedAddress

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));
}
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 25 with RelocatedAddress

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));
}
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)

Aggregations

RelocatedAddress (com.google.security.zynamics.binnavi.disassembly.RelocatedAddress)59 Test (org.junit.Test)32 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)25 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)22 BigInteger (java.math.BigInteger)20 MemoryModule (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)15 ArrayList (java.util.ArrayList)13 EchoBreakpointsRemovedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointsRemovedReply)12 EchoBreakpointSetReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointSetReply)10 DebuggerOptions (com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions)10 ThreadRegisters (com.google.security.zynamics.binnavi.debug.models.targetinformation.ThreadRegisters)10 BreakpointsRemovedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.BreakpointsRemovedReply)9 StepBreakpointSetReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointSetReply)9 RegisterDescription (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterDescription)9 RegisterValue (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValue)9 RegisterValues (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues)9 TargetInformation (com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation)9 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)8 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)8 TargetInformationReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply)7