Search in sources :

Example 6 with ProcessManager

use of com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager in project binnavi by google.

the class TargetInformationSynchronizer method handleSuccess.

@Override
protected void handleSuccess(final TargetInformationReply reply) {
    final IDebugger debugger = getDebugger();
    final ProcessManager processManager = getDebugger().getProcessManager();
    final TargetInformation info = reply.getTargetInformation();
    processManager.setTargetInformation(info);
    if (info.getDebuggerOptions().canMemmap()) {
        try {
            // As soon as we are attached to the target process, we
            // try to find out the memory structure of the target
            // process.
            debugger.getMemoryMap();
        } catch (final DebugExceptionWrapper e) {
            NaviLogger.severe("Error: Debugger could not get memory map. Exception %s", e);
            issueDebugException(e);
        }
    }
}
Also used : DebugExceptionWrapper(com.google.security.zynamics.binnavi.debug.debugger.DebugExceptionWrapper) TargetInformation(com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager)

Example 7 with ProcessManager

use of com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager in project binnavi by google.

the class ProcessTest method testGetMemory.

@Test
public void testGetMemory() {
    final MockProcessListener listener = new MockProcessListener();
    final ProcessManager manager = new ProcessManager();
    final Process process = new Process(manager);
    process.addListener(listener);
    final Memory m1 = process.getMemory();
    final Memory m2 = process.getMemory();
    assertEquals(m1, m2);
    process.removeListener(listener);
}
Also used : ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager) Test(org.junit.Test)

Example 8 with ProcessManager

use of com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager in project binnavi by google.

the class ProcessTest method testModules.

@Test
public void testModules() {
    final MockProcessListener listener = new MockProcessListener();
    final ProcessManager manager = new ProcessManager();
    manager.addModule(new MemoryModule("Hannes", "C:\\Hannes.dll", new RelocatedAddress(new CAddress(0x100)), 0x100));
    final Process process = new Process(manager);
    assertEquals(1, process.getModules().size());
    process.addListener(listener);
    final MemoryModule dll = new MemoryModule("Foobert.dll", "C:\\Foobert.dll", new RelocatedAddress(new CAddress(0x100)), 0x100);
    manager.addModule(dll);
    assertEquals("addedModule/Foobert.dll;", listener.events);
    assertEquals(2, process.getModules().size());
    manager.removeModule(dll);
    assertEquals("addedModule/Foobert.dll;removedModule/Foobert.dll;", listener.events);
    assertEquals(1, process.getModules().size());
    process.removeListener(listener);
}
Also used : RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 9 with ProcessManager

use of com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager in project binnavi by google.

the class ProcessTest method testThreads.

@Test
public void testThreads() {
    final MockProcessListener listener = new MockProcessListener();
    final ProcessManager manager = new ProcessManager();
    manager.addThread(new TargetProcessThread(0, ThreadState.RUNNING));
    final Process process = new Process(manager);
    process.addListener(listener);
    final Thread thread1 = process.getThreads().get(0);
    assertEquals(0, thread1.getThreadId());
    final TargetProcessThread thread = new TargetProcessThread(1, ThreadState.RUNNING);
    manager.addThread(thread);
    assertEquals("addedThread/1;", listener.events);
    assertEquals(2, process.getThreads().size());
    manager.removeThread(thread);
    assertEquals("addedThread/1;removedThread/1;", listener.events);
    assertEquals(1, process.getThreads().size());
    process.removeListener(listener);
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager) TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) Test(org.junit.Test)

Example 10 with ProcessManager

use of com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager in project binnavi by google.

the class ProcessTest method testGetTargetInformation.

@Test
public void testGetTargetInformation() {
    final MockProcessListener listener = new MockProcessListener();
    final ProcessManager manager = new ProcessManager();
    final Process process = new Process(manager);
    process.addListener(listener);
    assertNull(process.getTargetInformation());
    manager.setTargetInformation(new com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation(5, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 12, 0, new ArrayList<DebuggerException>(), false, false, false)));
    final TargetInformation t1 = process.getTargetInformation();
    final TargetInformation t2 = process.getTargetInformation();
    assertNotNull(t1);
    assertEquals(t1, t2);
    assertEquals("changedTargetInformation;", listener.events);
    assertEquals(5, process.getTargetInformation().getAddressSize());
    assertEquals(false, process.getTargetInformation().canTerminate());
    process.removeListener(listener);
}
Also used : FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) DebuggerException(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException) DebuggerOptions(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager) Test(org.junit.Test)

Aggregations

ProcessManager (com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager)21 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)12 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)7 MaybeNullException (com.google.security.zynamics.binnavi.Exceptions.MaybeNullException)6 Test (org.junit.Test)6 RelocatedAddress (com.google.security.zynamics.binnavi.disassembly.RelocatedAddress)5 MemoryModule (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)4 BreakpointManager (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager)3 DebuggerException (com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException)3 RegisterValue (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValue)3 ThreadRegisters (com.google.security.zynamics.binnavi.debug.models.targetinformation.ThreadRegisters)3 FilledList (com.google.security.zynamics.zylib.types.lists.FilledList)3 DebugExceptionWrapper (com.google.security.zynamics.binnavi.debug.debugger.DebugExceptionWrapper)2 IDebugger (com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)2 MemoryMap (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap)2 DebuggerOptions (com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions)2 RegisterValues (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues)2 ArrayList (java.util.ArrayList)2 Breakpoint (com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint)1 MemorySection (com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection)1