Search in sources :

Example 1 with ProcessManager

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

the class CDebugEventNotifier method stop.

/**
   * Stops the event notifier.
   */
public void stop() {
    m_debugger.removeListener(m_debuglistener);
    final ProcessManager processManager = m_debugger.getProcessManager();
    processManager.removeListener(m_processListener);
    for (final TargetProcessThread thread : processManager.getThreads()) {
        thread.removeListener(m_threadEventListener);
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager)

Example 2 with ProcessManager

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

the class CDebugEventNotifier method start.

/**
   * Starts the event notifier.
   */
public void start() {
    m_debugger.addListener(m_debuglistener);
    final ProcessManager processManager = m_debugger.getProcessManager();
    processManager.addListener(m_processListener);
    for (final TargetProcessThread thread : processManager.getThreads()) {
        thread.addListener(m_threadEventListener);
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager)

Example 3 with ProcessManager

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

the class HaltSynchronizer method handleSuccess.

@Override
protected void handleSuccess(final HaltReply reply) {
    final ProcessManager processManager = getDebugger().getProcessManager();
    try {
        final TargetProcessThread thread = processManager.getThread(reply.getTid());
        processManager.setActiveThread(thread);
    } catch (final MaybeNullException e) {
        NaviLogger.severe("Error: Process manager could not set active threads. Exception %s", e);
    // Apparently there is no thread with the specified TID.
    // This is not necessarily an error because the thread might have
    // been closed while this handler was active.
    // Nevertheless this should be logged.
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) MaybeNullException(com.google.security.zynamics.binnavi.Exceptions.MaybeNullException) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager)

Example 4 with ProcessManager

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

the class ModuleUnloadedSynchronizer method handleSuccess.

@Override
protected void handleSuccess(final ModuleUnloadedReply reply) {
    final ProcessManager processManager = getDebugger().getProcessManager();
    final MemoryModule replyModule = reply.getModule();
    final MemoryModule existingModule = processManager.getModule(replyModule.getBaseAddress());
    if (existingModule == null) {
        processManager.removeNonExistingModule(replyModule);
    } else {
        processManager.removeModule(existingModule);
        CBreakpointModuleSynchronizer.disableEchoBreakpoints(getDebugger(), existingModule);
        CBreakpointModuleSynchronizer.disableRegularBreakpoints(getDebugger(), existingModule);
    }
    if (needsResume()) {
        try {
            getDebugger().resume();
        } catch (final DebugExceptionWrapper e) {
            NaviLogger.severe("Error: Could not resume the debugger. Exception: %s", e);
        }
    }
}
Also used : DebugExceptionWrapper(com.google.security.zynamics.binnavi.debug.debugger.DebugExceptionWrapper) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)

Example 5 with ProcessManager

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

the class ReplySynchronizer method resetTargetProcess.

/**
   * Resets information about the target process.
   */
protected void resetTargetProcess() {
    final BreakpointManager manager = debugger.getBreakpointManager();
    final ProcessManager processManager = debugger.getProcessManager();
    debugger.setTerminated();
    manager.clearBreakpointsPassive(BreakpointType.ECHO);
    manager.clearBreakpointsPassive(BreakpointType.STEP);
    deactivateBreakpoints();
    processManager.getMemory().clear();
    processManager.setMemoryMap(new MemoryMap(new ArrayList<MemorySection>()));
    final Collection<TargetProcessThread> threads = processManager.getThreads();
    for (final TargetProcessThread thread : threads) {
        processManager.removeThread(thread);
    }
    for (final MemoryModule module : processManager.getModules()) {
        processManager.removeModule(module);
    }
    processManager.setAttached(false);
    processManager.setActiveThread(null);
}
Also used : MemoryMap(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap) TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) ArrayList(java.util.ArrayList) BreakpointManager(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)

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