Search in sources :

Example 31 with DebuggerOptions

use of com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions in project binnavi by google.

the class CDebuggerFunctions method showDebuggerOptionsDialogAlways.

/**
   * Shows the debugger options dialog.
   *
   * @param parent Parent window of the dialog.
   * @param target Provides the debugger target.
   * @param debugger The debugger whose options are shown in the dialog.
   */
public static void showDebuggerOptionsDialogAlways(final JFrame parent, final DebugTargetSettings target, final IDebugger debugger) {
    Preconditions.checkNotNull(parent, "IE01559: Parent argument can not be null");
    Preconditions.checkNotNull(target, "IE01560: Target argument can not be null");
    Preconditions.checkNotNull(debugger, "IE01561: Debugger argument can not be null");
    final TargetInformation targetInformation = debugger.getProcessManager().getTargetInformation();
    if (targetInformation == null) {
        CMessageBox.showInformation(parent, "Debugger information can not be shown before the debugger is active.");
        return;
    }
    DebuggerOptions options = targetInformation.getDebuggerOptions();
    if (options == null) {
        CMessageBox.showInformation(parent, "Debugger information can not be shown before the debugger is active.");
        return;
    }
    if (!debugger.isConnected()) {
        CMessageBox.showInformation(parent, "Debugger information can not be shown since the debugger is not currently connected.");
        return;
    }
    try {
        options.setExceptions(new ArrayList<DebuggerException>(mergeExceptionsSettings(target, options.getExceptions(), debugger.getId())));
    } catch (final CouldntLoadDataException exception) {
        CUtilityFunctions.logException(exception);
        final String message = "Exception settings could not be loaded.";
        final String description = CUtilityFunctions.createDescription(String.format("BinNavi could not load the exception settings from the database."), new String[] { "Communication error while contacting the database" }, new String[] { "BinNavi is unable to show the debugger options dialog until the problem is resolved." + " The default debugger options will be used during this session." });
        NaviErrorDialog.show(parent, message, description, exception);
    }
    final DebuggerEventSettings eventSettings = readDebuggerEventSettings(parent, debugger, target);
    final COptionsDialog dlg = new COptionsDialog(parent, options, eventSettings);
    dlg.setVisible(true);
    options = dlg.getDebuggerOptions();
    try {
        writeDebuggerExceptionSettings(options, target, debugger.getId());
        writeDebuggerEventSettings(debugger, target, dlg.getDebuggerEventSettings());
    } catch (final CouldntSaveDataException exception) {
        CUtilityFunctions.logException(exception);
        CUtilityFunctions.logException(exception);
        final String message = "Exception settings could not be written.";
        final String description = CUtilityFunctions.createDescription(String.format("BinNavi could not write the debugger options to the database."), new String[] { "Communication error while contacting the database" }, new String[] { "BinNavi is unable to store the debugger options in the database.", "Nevertheless, the debugger options will be sent to the debugger." });
        NaviErrorDialog.show(parent, message, description, exception);
    }
    sendExceptionSettings(parent, debugger, options.getExceptions());
    sendDebuggerEventSettings(parent, debugger, target);
}
Also used : DebuggerEventSettings(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerEventSettings) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) DebuggerException(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException) CouldntLoadDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException) TargetInformation(com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation) DebuggerOptions(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions) COptionsDialog(com.google.security.zynamics.binnavi.Gui.Debug.OptionsDialog.COptionsDialog)

Aggregations

DebuggerOptions (com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions)31 Test (org.junit.Test)29 TargetInformation (com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation)28 RegisterDescription (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterDescription)26 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)20 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)20 ArrayList (java.util.ArrayList)19 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)18 TargetInformationReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply)18 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)18 MemoryMap (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap)16 MemorySection (com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection)16 MemoryMapReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.MemoryMapReply)15 DebuggerException (com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException)13 MemoryModule (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)10 RelocatedAddress (com.google.security.zynamics.binnavi.disassembly.RelocatedAddress)10 DetachReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.DetachReply)5 ModuleLoadedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ModuleLoadedReply)4 ModuleUnloadedReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.ModuleUnloadedReply)4 FilledList (com.google.security.zynamics.zylib.types.lists.FilledList)4