diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java index 5d33d1621e6..41625aee268 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/CDebuggerTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 QNX Software Systems and others. + * Copyright (c) 2008, 2011 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,7 @@ * Ken Ryall (Nokia) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=118894 * IBM Corporation * Ericsson + * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.internal.ui.launching; @@ -23,6 +24,7 @@ import org.eclipse.cdt.debug.ui.ICDebuggerPage; import org.eclipse.cdt.debug.ui.ICDebuggerPageExtension; import org.eclipse.cdt.debug.ui.ICDebuggerPageExtension.IContentChangeListener; import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages; import org.eclipse.cdt.dsf.gdb.service.SessionType; @@ -30,6 +32,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.ui.ILaunchConfigurationTab; +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.swt.SWT; import org.eclipse.swt.accessibility.AccessibleAdapter; import org.eclipse.swt.accessibility.AccessibleEvent; @@ -103,8 +106,8 @@ public class CDebuggerTab extends CLaunchConfigurationTab { ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDefaultDebugConfiguration(); if (dc == null) { - CDebugCorePlugin.getDefault().getPluginPreferences().setDefault(ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE, - LOCAL_DEBUGGER_ID); + CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( + ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE, LOCAL_DEBUGGER_ID); } } @@ -124,7 +127,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab { setControl(fContainer); GdbUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(), ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_DEBBUGER_TAB); - int numberOfColumns = (fAttachMode) ? 2 : 1; + int numberOfColumns = fAttachMode ? 2 : 1; GridLayout layout = new GridLayout(numberOfColumns, false); fContents.setLayout(layout); GridData gd = new GridData(GridData.BEGINNING, GridData.CENTER, true, false); @@ -190,8 +193,9 @@ public class CDebuggerTab extends CLaunchConfigurationTab { } if (!fAttachMode && !fCoreMode) { + IPreferenceStore preferences = GdbUIPlugin.getDefault().getPreferenceStore(); config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, - ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT); + preferences.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN)); } } @@ -354,10 +358,11 @@ public class CDebuggerTab extends CLaunchConfigurationTab { protected void initializeCommonControls(ILaunchConfiguration config) { try { if (!fAttachMode && !fCoreMode) { + IPreferenceStore preferences = GdbUIPlugin.getDefault().getPreferenceStore(); fStopInMain.setSelection(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, - ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT)); + preferences.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN))); fStopInMainSymbol.setText(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, - ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT)); + preferences.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL))); fStopInMainSymbol.setEnabled(fStopInMain.getSelection()); } else if (fAttachMode) { // In attach mode, figure out if we are doing a remote connect based on diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java index 863758553b2..9b256bdc9a1 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 QNX Software Systems and others. + * Copyright (c) 2008, 2011 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * Contributors: * QNX Software Systems - Initial API and implementation * Ericsson - Modified for DSF + * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.internal.ui.launching; @@ -69,12 +70,12 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer { public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { IPreferenceStore preferenceStore = GdbUIPlugin.getDefault().getPreferenceStore(); - String defaultGdbCommand = preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND); - String defaultGdbInit = preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT); - configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, defaultGdbCommand); - configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, defaultGdbInit); + configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, + preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND)); + configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, + preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT)); configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, - IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT); + preferenceStore.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP)); configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT); configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND, @@ -119,12 +120,12 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer { public void initializeFrom(ILaunchConfiguration configuration) { setInitializing(true); IPreferenceStore preferenceStore = GdbUIPlugin.getDefault().getPreferenceStore(); - String defaultGdbCommand = preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND); - String defaultGdbInit = preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT); - String gdbCommand = getStringAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, defaultGdbCommand); - String gdbInit = getStringAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, defaultGdbInit); + String gdbCommand = getStringAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, + preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND)); + String gdbInit = getStringAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, + preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT)); boolean nonStopMode = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, - IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT); + preferenceStore.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP)); boolean reverseEnabled = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT); boolean updateThreadsOnSuspend = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND, diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java index bc90ad759e6..85a289061dd 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java @@ -8,11 +8,13 @@ * Contributors: * Ericsson - initial API and implementation * Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) + * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.internal.ui.preferences; import java.io.File; +import org.eclipse.cdt.dsf.debug.internal.ui.preferences.StringWithBooleanFieldEditor; import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; import org.eclipse.cdt.dsf.gdb.internal.ui.launching.LaunchUIMessages; @@ -37,6 +39,7 @@ import org.eclipse.ui.PlatformUI; /** * A preference page for settings that are currently only supported in GDB. */ +@SuppressWarnings("restriction") public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { /** * A vehicle in order to be able to register a selection listener with @@ -79,20 +82,20 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements layout.marginWidth= 0; parent.setLayout(layout); - Group group = new Group(parent, SWT.NONE); - group.setText(MessagesForPreferences.GdbDebugPreferencePage_defaults_label); + final Group group1 = new Group(parent, SWT.NONE); + group1.setText(MessagesForPreferences.GdbDebugPreferencePage_defaults_label); GridLayout groupLayout = new GridLayout(3, false); - group.setLayout(groupLayout); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + group1.setLayout(groupLayout); + group1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final StringFieldEditor stringFieldEditorCommand = new StringFieldEditor( IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, LaunchUIMessages.getString("GDBDebuggerPage.gdb_debugger"), //$NON-NLS-1$ - group); + group1); - stringFieldEditorCommand.fillIntoGrid(group, 2); + stringFieldEditorCommand.fillIntoGrid(group1, 2); addField(stringFieldEditorCommand); - Button browsebutton = new Button(group, SWT.PUSH); + Button browsebutton = new Button(group1, SWT.PUSH); browsebutton.setText(LaunchUIMessages.getString("GDBDebuggerPage.gdb_browse")); //$NON-NLS-1$ browsebutton.addSelectionListener(new SelectionAdapter() { @Override @@ -105,11 +108,11 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements final StringFieldEditor stringFieldEditorGdbInit = new StringFieldEditor( IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT, LaunchUIMessages.getString("GDBDebuggerPage.gdb_command_file"), //$NON-NLS-1$ - group); + group1); - stringFieldEditorGdbInit.fillIntoGrid(group, 2); + stringFieldEditorGdbInit.fillIntoGrid(group1, 2); addField(stringFieldEditorGdbInit); - browsebutton = new Button(group, SWT.PUSH); + browsebutton = new Button(group1, SWT.PUSH); browsebutton.setText(LaunchUIMessages.getString("GDBDebuggerPage.gdb_browse")); //$NON-NLS-1$ browsebutton.addSelectionListener(new SelectionAdapter() { @Override @@ -119,46 +122,74 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements } }); - group.setLayout(groupLayout); + final StringWithBooleanFieldEditor enableStopAtMain = new StringWithBooleanFieldEditor( + IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN, + IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL, + LaunchUIMessages.getString("CDebuggerTab.Stop_at_main_on_startup"), //$NON-NLS-1$ + group1); + enableStopAtMain.fillIntoGrid(group1, 2); + addField(enableStopAtMain); - group= new Group(parent, SWT.NONE); - group.setText(MessagesForPreferences.GdbDebugPreferencePage_traces_label); +// final StringFieldEditor stopAtMainSymbol = new StringFieldEditor( +// IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL, +// "", group1); //$NON-NLS-1$ +// stopAtMainSymbol.fillIntoGrid(group1, 2); +// addField(stopAtMainSymbol); +// +// enableStopAtMain.getChangeControl(group1).addSelectionListener(new SelectionAdapter() { +// @Override +// public void widgetSelected(SelectionEvent e) { +// boolean enabled = enableStopAtMain.getBooleanValue(); +// stopAtMainSymbol.setEnabled(enabled, group1); +// } +// }); + + final ListenableBooleanFieldEditor enableNonStop= new ListenableBooleanFieldEditor( + IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP, + LaunchUIMessages.getString("GDBDebuggerPage.nonstop_mode"), //$NON-NLS-1$ + SWT.NONE, group1); + enableNonStop.fillIntoGrid(group1, 3); + addField(enableNonStop); + + group1.setLayout(groupLayout); + + final Group group2= new Group(parent, SWT.NONE); + group2.setText(MessagesForPreferences.GdbDebugPreferencePage_traces_label); groupLayout= new GridLayout(3, false); - group.setLayout(groupLayout); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + group2.setLayout(groupLayout); + group2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final ListenableBooleanFieldEditor enableGdbTracesField = new ListenableBooleanFieldEditor( IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE, MessagesForPreferences.GdbDebugPreferencePage_enableTraces_label, - SWT.NONE, group); + SWT.NONE, group2); - enableGdbTracesField.fillIntoGrid(group, 3); + enableGdbTracesField.fillIntoGrid(group2, 3); addField(enableGdbTracesField); final IntegerFieldEditor maxCharactersField = new IntegerFieldEditor( IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES, MessagesForPreferences.GdbDebugPreferencePage_maxGdbTraces_label, - group); + group2); // Instead of using Integer.MAX_VALUE which is some obscure number, // using 2 billion is nice and readable. maxCharactersField.setValidRange(10000, 2000000000); - maxCharactersField.fillIntoGrid(group, 3); + maxCharactersField.fillIntoGrid(group2, 3); addField(maxCharactersField); - final Group finalGroup = group; - enableGdbTracesField.getChangeControl(group).addSelectionListener(new SelectionAdapter() { + enableGdbTracesField.getChangeControl(group2).addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean enabled = enableGdbTracesField.getBooleanValue(); - maxCharactersField.setEnabled(enabled, finalGroup); + maxCharactersField.setEnabled(enabled, group2); } }); // Need to set layout again. - group.setLayout(groupLayout); + group2.setLayout(groupLayout); - group= new Group(parent, SWT.NONE); + Group group= new Group(parent, SWT.NONE); group.setText(MessagesForPreferences.GdbDebugPreferencePage_termination_label); groupLayout= new GridLayout(3, false); group.setLayout(groupLayout); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbPreferenceInitializer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbPreferenceInitializer.java index 15e30b25c17..72fd2e2a3f5 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbPreferenceInitializer.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbPreferenceInitializer.java @@ -8,9 +8,11 @@ * Contributors: * Ericsson - initial API and implementation * Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) + * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.internal.ui.preferences; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; @@ -32,5 +34,8 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer { store.setDefault(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, 100); store.setDefault(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); store.setDefault(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT, IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); + store.setDefault(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT); + store.setDefault(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); + store.setDefault(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP, IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT); } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java index a94ef50db71..acc62431fc4 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java @@ -8,13 +8,12 @@ * Contributors: * Ericsson - initial implementation * Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) + * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.dsf.gdb; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; - - /** * @noimplement This interface is not intended to be implemented by clients. * @since 2.0 @@ -69,6 +68,24 @@ public interface IGdbDebugPreferenceConstants { */ public static final String PREF_DEFAULT_GDB_INIT = "defaultGdbInit"; //$NON-NLS-1$ + /** + * The value is a boolean specifying the default for whether to stop at main(). + * @since 4.0 + */ + public static final String PREF_DEFAULT_STOP_AT_MAIN = "defaultStopAtMain"; //$NON-NLS-1$ + + /** + * The value is a string specifying the default symbol to use for the main breakpoint. + * @since 4.0 + */ + public static final String PREF_DEFAULT_STOP_AT_MAIN_SYMBOL = "defaultStopAtMainSymbol"; //$NON-NLS-1$ + + /** + * The value is a boolean specifying the default for the non-stop debugger mode. + * @since 4.0 + */ + public static final String PREF_DEFAULT_NON_STOP = "defaultNonStop"; //$NON-NLS-1$ + /** * Help prefixes. */