Search in sources :

Example 91 with TargetProcessThread

use of com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread 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

TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)91 Test (org.junit.Test)50 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)27 RelocatedAddress (com.google.security.zynamics.binnavi.disassembly.RelocatedAddress)22 TargetInformation (com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation)21 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)20 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)20 DebuggerOptions (com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions)20 MemoryMap (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap)19 MemorySection (com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection)18 RegisterDescription (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterDescription)17 IDebugger (com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)16 TargetInformationReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply)15 ArrayList (java.util.ArrayList)15 MemoryMapReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.MemoryMapReply)14 RegisterValue (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValue)14 MemoryModule (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)12 ProcessManager (com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager)12 MaybeNullException (com.google.security.zynamics.binnavi.Exceptions.MaybeNullException)10 ThreadRegisters (com.google.security.zynamics.binnavi.debug.models.targetinformation.ThreadRegisters)9