Search in sources :

Example 1 with CGotoDialog

use of com.google.security.zynamics.binnavi.Gui.Debug.Goto.CGotoDialog in project binnavi by google.

the class CMemoryFunctions method gotoOffset.

/**
 * Shows the Goto Offset dialog and sets the caret of a hex control to the entered offset.
 *
 * @param parent Parent window used for dialogs.
 * @param view Hex view to focus after the Goto operation.
 * @param model Model that contains the memory viewer where the offset is changed.
 */
public static void gotoOffset(final JFrame parent, final CMemoryViewer view, final CDebugPerspectiveModel model) {
    final IDebugger debugger = model.getCurrentSelectedDebugger();
    if (debugger == null) {
        return;
    }
    final TargetProcessThread activeThread = debugger.getProcessManager().getActiveThread();
    final Memory memory = debugger.getProcessManager().getMemory();
    final CDefaultMemoryExpressionBinding binding = new CDefaultMemoryExpressionBinding(activeThread, memory);
    final CGotoDialog dlg = new CGotoDialog(parent, model.getCurrentSelectedDebugger().getProcessManager().getMemoryMap(), binding, model.getGotoAddress());
    dlg.setVisible(true);
    final IAddress value = dlg.getValue();
    if (value != null) {
        model.setGotoAddress(value);
        model.setActiveMemoryAddress(value, true);
        view.requestFocusInWindow();
    }
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) Memory(com.google.security.zynamics.zylib.general.memmanager.Memory) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) CGotoDialog(com.google.security.zynamics.binnavi.Gui.Debug.Goto.CGotoDialog) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress)

Aggregations

CGotoDialog (com.google.security.zynamics.binnavi.Gui.Debug.Goto.CGotoDialog)1 IDebugger (com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)1 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)1 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)1 Memory (com.google.security.zynamics.zylib.general.memmanager.Memory)1