Search in sources :

Example 31 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 32 with TargetProcessThread

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

the class CStackViewSynchronizer method updateGui.

/**
   * Updates the GUI depending on the current state of the target process.
   */
private void updateGui() {
    final IDebugger activeDebugger = m_debugPerspectiveModel.getCurrentSelectedDebugger();
    final TargetProcessThread activeThread = activeDebugger == null ? null : activeDebugger.getProcessManager().getActiveThread();
    if (activeThread == null) {
        m_stackView.setDefinitionStatus(DefinitionStatus.UNDEFINED);
        m_stackView.setEnabled(false);
    } else {
        m_stackView.setDefinitionStatus(DefinitionStatus.DEFINED);
        m_stackView.setEnabled(true);
        m_stackView.gotoOffset(getStackPointer(activeThread));
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Example 33 with TargetProcessThread

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

the class CStackViewSynchronizer method synchronizeDebuggers.

/**
   * Makes sure that listeners are added at the right debuggers.
   *
   * @param oldDebugger The previously active debugger.
   * @param newDebugger The newly active debugger.
   */
private void synchronizeDebuggers(final IDebugger oldDebugger, final IDebugger newDebugger) {
    if (oldDebugger != null) {
        oldDebugger.getProcessManager().removeListener(m_processListener);
        final TargetProcessThread activeThread = oldDebugger.getProcessManager().getActiveThread();
        synchronizeThread(activeThread, null);
    }
    if (newDebugger != null) {
        newDebugger.getProcessManager().addListener(m_processListener);
        final TargetProcessThread activeThread = newDebugger.getProcessManager().getActiveThread();
        synchronizeThread(null, activeThread);
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)

Example 34 with TargetProcessThread

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

the class CStepIntoAction method actionPerformed.

@Override
public void actionPerformed(final ActionEvent event) {
    final IDebugger debugger = m_debugger.getCurrentSelectedDebugger();
    final TargetProcessThread activeThread = debugger == null ? null : debugger.getProcessManager().getActiveThread();
    if ((debugger != null) && (activeThread != null)) {
        CDebuggerFunctions.stepInto(m_parent, debugger);
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Example 35 with TargetProcessThread

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

the class CDebuggerToolbar method updateGui.

/**
   * Updates the GUI according to the currently available information about the target process.
   */
public void updateGui() {
    // Note: There is a reason for why we have to update the toolbar
    // from the outside. The toolbar can not update itself because
    // the toolbar state depends on the state of the TID box in the
    // debug panel.
    final IDebugger debugger = m_debugger.getCurrentSelectedDebugger();
    final TargetProcessThread activeThread = debugger == null ? null : debugger.getProcessManager().getActiveThread();
    final boolean connected = (debugger != null) && debugger.isConnected();
    final boolean suspended = connected && (activeThread != null);
    m_startAction.setEnabled(!connected);
    final boolean haltBeforeCommunicating = (debugger != null) && connected && (debugger.getProcessManager().getTargetInformation() != null) && debugger.getProcessManager().getTargetInformation().getDebuggerOptions().mustHaltBeforeCommunicating();
    m_detachAction.setEnabled(connected && (!haltBeforeCommunicating || suspended));
    m_terminateAction.setEnabled(connected);
    m_stepIntoAction.setEnabled(connected && suspended);
    m_stepIntoAction.setEnabled(connected && suspended);
    m_stepOverAction.setEnabled(connected && suspended);
    m_stepBlockAction.setEnabled(connected && suspended);
    m_stepEndAction.setEnabled(connected && suspended);
    m_resumeAction.setEnabled(connected && suspended);
    m_haltAction.setEnabled(connected && !suspended);
    final boolean tracing = (debugger != null) && m_debugger.getTraceLogger(debugger).hasEchoBreakpoints();
    m_startTraceAction.setEnabled(connected && (!haltBeforeCommunicating || suspended));
    m_stopTraceAction.setEnabled(connected && tracing && (!haltBeforeCommunicating || suspended));
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

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