Search in sources :

Example 6 with TargetProcessThread

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

the class CMemorySectionPanelSynchronizer method updateGui.

/**
   * Updates the GUI of the synchronized memory section box depending on the current state of the
   * debug GUI perspective and the active debugger.
   */
private void updateGui() {
    final IDebugger activeDebugger = debugPerspectiveModel.getCurrentSelectedDebugger();
    final TargetProcessThread activeThread = activeDebugger == null ? null : activeDebugger.getProcessManager().getActiveThread();
    final boolean enable = (activeThread != null) && (activeDebugger != null) && activeDebugger.isConnected() && (activeDebugger.getProcessManager().getTargetInformation() != null) && activeDebugger.getProcessManager().getTargetInformation().getDebuggerOptions().canMemmap() && (memorySectionBox.getItemCount() != 0);
    new SwingInvoker() {

        @Override
        protected void operation() {
            memorySectionBox.setEnabled(enable);
        }
    }.invokeAndWait();
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) SwingInvoker(com.google.security.zynamics.zylib.gui.SwingInvoker) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Example 7 with TargetProcessThread

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

the class CRegisterViewSynchronizer method dispose.

/**
   * Cleans up allocated resources.
   */
public void dispose() {
    m_debugPerspectiveModel.removeListener(m_debugListener);
    final IDebugger activeDebugger = m_debugPerspectiveModel.getCurrentSelectedDebugger();
    final TargetProcessThread activeThread = activeDebugger == null ? null : activeDebugger.getProcessManager().getActiveThread();
    if (activeThread != null) {
        activeThread.removeListener(m_threadListener);
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Example 8 with TargetProcessThread

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

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

the class ModuleLoadedSynchronizer method setActiveThreadById.

/**
   * Sets the currently active thread in the process manager.
   *
   * @param threadId The thread id to be activated.
   */
private static void setActiveThreadById(final ProcessManager processManager, final long threadId) {
    try {
        final TargetProcessThread thread = processManager.getThread(threadId);
        processManager.setActiveThread(thread);
    } catch (final MaybeNullException exception) {
        CUtilityFunctions.logException(exception);
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) MaybeNullException(com.google.security.zynamics.binnavi.Exceptions.MaybeNullException)

Example 10 with TargetProcessThread

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

the class ProcessStartSynchronizer method handleSuccess.

@Override
protected void handleSuccess(final ProcessStartReply reply) {
    final TargetProcessThread thread = reply.getProcessStart().getThread();
    final MemoryModule module = reply.getProcessStart().getModule();
    getDebugger().getProcessManager().addThread(thread);
    getDebugger().getProcessManager().setActiveThread(thread);
    refreshRegisters();
    CRelocationNotifier.relocateModule(getDebugger(), module);
    getDebugger().getProcessManager().addModule(module);
    CBreakpointModuleSynchronizer.enableRegularBreakpoints(getDebugger(), module);
    try {
        getDebugger().resume();
    } catch (final DebugExceptionWrapper e) {
        NaviLogger.severe("Error: Could not resume debugger. Exception: %s", e);
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) DebugExceptionWrapper(com.google.security.zynamics.binnavi.debug.debugger.DebugExceptionWrapper) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)

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