Search in sources :

Example 6 with ThreadCreatedReply

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

the class CDebuggerSynchronizerTest method testModuleLifecycle.

/**
   * This test makes sure that the memory module lifecycle (Module Loaded -> Module Unloaded) is
   * working and that the process manager of the debugger is updated correctly.
   *
   * @throws DebugExceptionWrapper
   */
@Test
public void testModuleLifecycle() throws DebugExceptionWrapper {
    assertTrue(mockDebugger.getProcessManager().getModules().isEmpty());
    mockDebugger.connect();
    mockDebugger.getProcessManager().getThreads().clear();
    debuggerSynchronizer.receivedEvent(new ThreadCreatedReply(0, 0, 1000, ThreadState.RUNNING));
    final MemoryModule module = new MemoryModule("hannes.dll", "C:\\hannes.dll", new RelocatedAddress(new CAddress(0x1000000)), 1000);
    debuggerSynchronizer.receivedEvent(new ModuleLoadedReply(0, 0, module, new TargetProcessThread(1000, ThreadState.RUNNING)));
    mockDebugger.getProcessManager().setTargetInformation(new TargetInformation(5, Lists.newArrayList(new RegisterDescription("eax", 4, true), new RegisterDescription("ebx", 4, false)), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 12, 0, new ArrayList<DebuggerException>(), false, false, false)));
    assertTrue(mockDebugger.getProcessManager().getModules().size() == 1);
    assertTrue(mockDebugger.getProcessManager().getModules().get(0) == module);
    debuggerSynchronizer.receivedEvent(new ModuleUnloadedReply(0, 0, module));
    assertTrue(mockDebugger.getProcessManager().getModules().isEmpty());
}
Also used : ModuleUnloadedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ModuleUnloadedReply) TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) RegisterDescription(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterDescription) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) DebuggerException(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException) TargetInformation(com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation) DebuggerOptions(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions) ThreadCreatedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ThreadCreatedReply) ModuleLoadedReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ModuleLoadedReply) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Aggregations

ThreadCreatedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ThreadCreatedReply)6 Test (org.junit.Test)5 ThreadClosedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ThreadClosedReply)3 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)3 RelocatedAddress (com.google.security.zynamics.binnavi.disassembly.RelocatedAddress)3 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)3 ModuleLoadedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ModuleLoadedReply)2 ModuleUnloadedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ModuleUnloadedReply)2 ResumeThreadReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ResumeThreadReply)2 SearchReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply)2 SelectFileReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.SelectFileReply)2 SetRegisterReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.SetRegisterReply)2 SingleStepReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.SingleStepReply)2 StepBreakpointHitReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointHitReply)2 StepBreakpointSetReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointSetReply)2 StepBreakpointsRemovedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.StepBreakpointsRemovedReply)2 SuspendThreadReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.SuspendThreadReply)2 TargetInformationReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply)2 TerminateReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.TerminateReply)2 ValidateMemoryReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ValidateMemoryReply)2