diff options
author | Jonah Graham | 2018-02-01 14:12:10 -0500 |
---|---|---|
committer | Jonah Graham | 2018-02-06 09:08:39 -0500 |
commit | 65157ef4d52e91e31d3eac0369a39511a131ec3c (patch) | |
tree | e034b54c2ee9330d43eb7eae56779e7f0e7065e2 /dsf-gdb | |
parent | 345f37874c118a78b3df00cf4d9a18f9875b56ab (diff) | |
download | org.eclipse.cdt-65157ef4d52e91e31d3eac0369a39511a131ec3c.tar.gz org.eclipse.cdt-65157ef4d52e91e31d3eac0369a39511a131ec3c.tar.xz org.eclipse.cdt-65157ef4d52e91e31d3eac0369a39511a131ec3c.zip |
Bug 530635: Add ability to do "set remotetimeout" via UI
Change-Id: Iaeaea1e8656d85cb854a5b27f5f212fa37a3159d
Diffstat (limited to 'dsf-gdb')
15 files changed, 245 insertions, 23 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/META-INF/MANIFEST.MF index ed1fc3cc6e..589bc84005 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/META-INF/MANIFEST.MF +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb.ui;singleton:=true -Bundle-Version: 2.6.0.qualifier +Bundle-Version: 2.6.1.qualifier Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, @@ -12,7 +12,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.cdt.dsf.ui, org.eclipse.debug.ui, org.eclipse.cdt.debug.core, - org.eclipse.cdt.dsf.gdb, + org.eclipse.cdt.dsf.gdb;bundle-version="[5.5.0,6.0.0)", org.eclipse.cdt.debug.ui, org.eclipse.cdt.core, org.eclipse.cdt.ui, diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbServerDebuggerPage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbServerDebuggerPage.java index 1338f30ef4..bdaa915c29 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbServerDebuggerPage.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbServerDebuggerPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 QNX Software Systems and others. + * Copyright (c) 2008, 2018 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 @@ -15,11 +15,16 @@ package org.eclipse.cdt.dsf.gdb.internal.ui.launching; import org.eclipse.cdt.debug.internal.ui.dialogfields.ComboDialogField; import org.eclipse.cdt.debug.internal.ui.dialogfields.DialogField; import org.eclipse.cdt.debug.internal.ui.dialogfields.IDialogFieldListener; +import org.eclipse.cdt.debug.internal.ui.dialogfields.LayoutUtil; +import org.eclipse.cdt.debug.internal.ui.dialogfields.SelectionButtonDialogField; +import org.eclipse.cdt.debug.internal.ui.dialogfields.StringDialogField; import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils; import org.eclipse.cdt.utils.ui.controls.ControlFactory; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.jface.layout.PixelConverter; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.layout.GridData; @@ -39,6 +44,10 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage { private ComboDialogField fConnectionField; + protected SelectionButtonDialogField fRemoteTimeoutEnabledField; + + protected StringDialogField fRemoteTimeoutValueField; + private String[] fConnections = new String[]{ CONNECTION_TCP, CONNECTION_SERIAL }; private TCPSettingsBlock fTCPBlock; @@ -56,6 +65,7 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage { fSerialBlock = new SerialPortSettingsBlock(); fTCPBlock.addObserver(this); fSerialBlock.addObserver(this); + createRemoteTimeoutFields(); } protected void createConnectionTab(TabFolder tabFolder) { @@ -65,15 +75,23 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage { ((GridLayout)comp1.getLayout()).makeColumnsEqualWidth = false; comp1.setFont(tabFolder.getFont()); tabItem.setControl(comp1); - Composite comp = ControlFactory.createCompositeEx(comp1, 2, GridData.FILL_BOTH); + Composite comp = ControlFactory.createCompositeEx(comp1, 3, GridData.FILL_BOTH); ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; comp.setFont(comp1.getFont()); - fConnectionField.doFillIntoGrid(comp, 2); + fConnectionField.doFillIntoGrid(comp, 3); ((GridData)fConnectionField.getComboControl(null).getLayoutData()).horizontalAlignment = GridData.BEGINNING; + fRemoteTimeoutEnabledField.doFillIntoGrid(comp, 1); + fRemoteTimeoutEnabledField.getSelectionButton(comp).setToolTipText(LaunchUIMessages.getString("GDBServerDebuggerPage.12")); //$NON-NLS-1$ + fRemoteTimeoutValueField.doFillIntoGrid(comp, 2); + ((GridData)fRemoteTimeoutValueField.getTextControl(null).getLayoutData()).horizontalAlignment = GridData.BEGINNING; + PixelConverter converter = new PixelConverter(comp); + LayoutUtil.setWidthHint(fRemoteTimeoutValueField.getTextControl(null), converter.convertWidthInCharsToPixels(10)); + fRemoteTimeoutValueField.getLabelControl(comp).setToolTipText(LaunchUIMessages.getString("GDBServerDebuggerPage.12")); //$NON-NLS-1$ + fRemoteTimeoutValueField.getTextControl(comp).setToolTipText(LaunchUIMessages.getString("GDBServerDebuggerPage.12")); //$NON-NLS-1$ fConnectionStack = ControlFactory.createCompositeEx(comp, 1, GridData.FILL_BOTH); StackLayout stackLayout = new StackLayout(); fConnectionStack.setLayout(stackLayout); - ((GridData)fConnectionStack.getLayoutData()).horizontalSpan = 2; + ((GridData)fConnectionStack.getLayoutData()).horizontalSpan = 3; fTCPBlock.createBlock(fConnectionStack); fSerialBlock.createBlock(fConnectionStack); } @@ -93,6 +111,27 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage { return field; } + private void createRemoteTimeoutFields() { + fRemoteTimeoutEnabledField = new SelectionButtonDialogField(SWT.CHECK); + fRemoteTimeoutEnabledField.setLabelText(LaunchUIMessages.getString("GDBServerDebuggerPage.11")); //$NON-NLS-1$ + fRemoteTimeoutEnabledField.setDialogFieldListener(new IDialogFieldListener() { + + @Override + public void dialogFieldChanged(DialogField f) { + updateLaunchConfigurationDialog(); + } + }); + fRemoteTimeoutValueField = new StringDialogField(); + fRemoteTimeoutValueField.setDialogFieldListener(new IDialogFieldListener() { + + @Override + public void dialogFieldChanged(DialogField f) { + updateLaunchConfigurationDialog(); + } + }); + fRemoteTimeoutEnabledField.attachDialogField(fRemoteTimeoutValueField); + } + protected void connectionTypeChanged() { connectionTypeChanged0(); updateLaunchConfigurationDialog(); @@ -131,8 +170,16 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage { return false; } } - return true; } + + if (fRemoteTimeoutEnabledField.isSelected()) { + if (fRemoteTimeoutValueField.getText().trim().isEmpty()) { + setErrorMessage(LaunchUIMessages.getString("GDBServerDebuggerPage.13")); //$NON-NLS-1$ + return false; + } + } + + return true; } return false; } @@ -150,10 +197,25 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage { fTCPBlock.initializeFrom(configuration); fSerialBlock.initializeFrom(configuration); fConnectionField.selectItem((isTcp) ? 0 : 1); + initializeRemoteTimeout(configuration); connectionTypeChanged0(); setInitializing(false); } + private void initializeRemoteTimeout(ILaunchConfiguration configuration) { + if (fRemoteTimeoutEnabledField != null && fRemoteTimeoutValueField != null) { + try { + fRemoteTimeoutEnabledField.setSelection(configuration.getAttribute( + IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, + LaunchUtils.getRemoteTimeoutEnabledDefault())); + fRemoteTimeoutValueField.setText( + configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, + LaunchUtils.getRemoteTimeoutValueDefault())); + } catch (CoreException e) { + } + } + } + @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { super.performApply(configuration); @@ -161,12 +223,20 @@ public class GdbServerDebuggerPage extends GdbDebuggerPage { configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, fConnectionField.getSelectionIndex() == 0); fTCPBlock.performApply(configuration); fSerialBlock.performApply(configuration); + if (fRemoteTimeoutEnabledField != null) + configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, fRemoteTimeoutEnabledField.isSelected()); + if (fRemoteTimeoutValueField != null) + configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, fRemoteTimeoutValueField.getText().trim()); } @Override public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { super.setDefaults(configuration); configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, true); + configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, + LaunchUtils.getRemoteTimeoutEnabledDefault()); + configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, + LaunchUtils.getRemoteTimeoutValueDefault()); fTCPBlock.setDefaults(configuration); fSerialBlock.setDefaults(configuration); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.properties index 689a6113e0..412a0b1061 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.properties +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2003, 2017 QNX Software Systems and others. +# Copyright (c) 2003, 2018 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 @@ -51,7 +51,6 @@ StandardGDBDebuggerPage.13=Verbose console mode StandardGDBDebuggerPage.14=Use full file path to set breakpoints GDBServerDebuggerPage.0=TCP GDBServerDebuggerPage.1=Serial -GDBServerDebuggerPage.10=Connection GDBServerDebuggerPage.2=Main GDBServerDebuggerPage.3=GDB debugger GDBServerDebuggerPage.4=&Browse... @@ -60,6 +59,10 @@ GDBServerDebuggerPage.6=GDB command file: GDBServerDebuggerPage.7=B&rowse... GDBServerDebuggerPage.8=GDB Command File GDBServerDebuggerPage.9=Type: +GDBServerDebuggerPage.10=Connection +GDBServerDebuggerPage.11=Remote timeout (seconds): +GDBServerDebuggerPage.12=Timeout for the remote target to respond. If unchecked, uses GDB default value. See GDB's help for "set remotetimeout num". +GDBServerDebuggerPage.13=The "Remote timeout (seconds)" field can not be empty. GDBSolibBlock.0=Load shared library symbols automatically GDBSolibBlock.1=Stop on shared library events GDBSolibBlock.2=Use shared library symbols for debugged applications 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 0811c151cb..ba458e39f2 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Ericsson and others. + * Copyright (c) 2009, 2018 Ericsson 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 @@ -621,6 +621,17 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements addField(externalConsoleField); } + final StringWithBooleanFieldEditor remoteTimeout = new StringWithBooleanFieldEditor( + IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_ENABLED, + IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_VALUE, + MessagesForPreferences.GdbDebugPreferencePage_remoteTimeout_label, + group1); + remoteTimeout.getCheckboxControl(group1).setToolTipText(MessagesForPreferences.GdbDebugPreferencePage_remoteTimeout_tooltip); + remoteTimeout.getTextControl(group1).setToolTipText(MessagesForPreferences.GdbDebugPreferencePage_remoteTimeout_tooltip); + remoteTimeout.fillIntoGrid(group1, 3); + addField(remoteTimeout); + + group1.setLayout(groupLayout); final Group group2= new Group(parent, SWT.NONE); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java index 6ddaee8ac7..3338d9e0b7 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Ericsson and others. + * Copyright (c) 2009, 2018 Ericsson 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 @@ -76,6 +76,8 @@ class MessagesForPreferences extends NLS { public static String GdbConsolePreferencePage_InvertColors; public static String GdbConsolePreferencePage_BufferLines; + public static String GdbDebugPreferencePage_remoteTimeout_label; + public static String GdbDebugPreferencePage_remoteTimeout_tooltip; static { // initialize resource bundle diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties index df4925944a..96039be187 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2009, 2017 Ericsson and others. +# Copyright (c) 2009, 2018 Ericsson 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 @@ -66,3 +66,6 @@ ReverseDebugPreferencePage_ProcessorTrace=Intel(R) Processor Trace GdbConsolePreferencePage_InvertColors = Invert console colors GdbConsolePreferencePage_BufferLines = Console buffer lines: + +GdbDebugPreferencePage_remoteTimeout_label=Remote timeout (seconds): +GdbDebugPreferencePage_remoteTimeout_tooltip=Default timeout for the remote target to respond. If unchecked, uses GDB default value. See GDB's help for "set remotetimeout num". diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF index 92d0937552..c0a1a45382 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true -Bundle-Version: 5.4.0.qualifier +Bundle-Version: 5.5.0.qualifier Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java index ce8ccb5cf1..937d9e876a 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Ericsson and others. + * Copyright (c) 2008, 2018 Ericsson 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 @@ -14,6 +14,7 @@ package org.eclipse.cdt.dsf.gdb; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils; public class IGDBLaunchConfigurationConstants { @@ -133,7 +134,24 @@ public class IGDBLaunchConfigurationConstants { * @since 4.2 */ public static final String ATTR_DEBUGGER_REMOTE_BINARY = GdbPlugin.PLUGIN_ID + ".REMOTE_BINARY"; //$NON-NLS-1$ - + + /** + * Enablement setting to set Remote Timeout in GDB to (set remotetimeout num). + * The value to use is in {@link #ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE} + * + * @since 5.5 + */ + public static final String ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED = GdbPlugin.PLUGIN_ID + ".REMOTE_TIMEOUT_ENABLED"; //$NON-NLS-1$ + + /** + * Setting to set Remote Timeout in GDB to (set remotetimeout num) if enabled + * with {@link #ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED} The value is a string and + * does not have to be a number (but it normally is). + * + * @since 5.5 + */ + public static final String ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE = GdbPlugin.PLUGIN_ID + ".REMOTE_TIMEOUT_VALUE"; //$NON-NLS-1$ + /** * Launch configuration attribute value. The key is ATTR_DEBUG_NAME. */ @@ -261,5 +279,18 @@ public class IGDBLaunchConfigurationConstants { */ // Bug 210366 public static final String DEBUGGER_ATTR_PROCESS_FACTORY_ID_DEFAULT = "org.eclipse.cdt.dsf.gdb.GdbProcessFactory"; //$NON-NLS-1$ - + + /** + * The default value of {@link #ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED}. To get the user set workspace default see + * {@link LaunchUtils#getRemoteTimeoutEnabledDefault()} + * @since 5.5 + */ + public static final boolean DEBUGGER_REMOTE_TIMEOUT_ENABLED_DEFAULT = false; + + /** + * The default value of {@link #ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE}. To get the user set workspace default see + * {@link LaunchUtils#getRemoteTimeoutValueDefault()} + * @since 5.5 + */ + public static final String DEBUGGER_REMOTE_TIMEOUT_VALUE_DEFAULT = ""; //$NON-NLS-1$ } 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 6ba511cd6e..39c025af6b 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2016 Ericsson and others. + * Copyright (c) 2009, 2018 Ericsson 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 @@ -204,4 +204,19 @@ public interface IGdbDebugPreferenceConstants { */ public static final int CONSOLE_BUFFERLINES_DEFAULT = 1000; + /** + * The value is a boolean specifying the default for whether to issue "set + * remotetimout" with the value being {@link #PREF_DEFAULT_REMOTE_TIMEOUT_VALUE} + * + * @since 5.5 + */ + public static final String PREF_DEFAULT_REMOTE_TIMEOUT_ENABLED = "defaultRemoteTimeoutEnabled"; //$NON-NLS-1$ + + /** + * The value, if enabled with {@link #PREF_DEFAULT_REMOTE_TIMEOUT_ENABLED}, the + * value for GDB "set remotetimout" + * + * @since 5.5 + */ + public static final String PREF_DEFAULT_REMOTE_TIMEOUT_VALUE = "defaultRemoteTimeoutValue"; //$NON-NLS-1$ } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java index 2b1ecc9d64..3d5bfd8547 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 Ericsson and others. + * Copyright (c) 2009, 2018 Ericsson 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 @@ -50,5 +50,7 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer { node.put(IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE, IGdbDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE); node.putBoolean(IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS, IGdbDebugPreferenceConstants.CONSOLE_INVERTED_COLORS_DEFAULT); node.putInt(IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES, IGdbDebugPreferenceConstants.CONSOLE_BUFFERLINES_DEFAULT); + node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_ENABLED, IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_TIMEOUT_ENABLED_DEFAULT); + node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_VALUE, IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_TIMEOUT_VALUE_DEFAULT); } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java index 7d52aef31d..f19cd224ac 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 Ericsson and others. + * Copyright (c) 2008, 2018 Ericsson 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 @@ -55,6 +55,7 @@ import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.ILaunch; @@ -114,6 +115,7 @@ public class FinalLaunchSequence extends ReflectionSequence { "stepSetAutoLoadSharedLibrarySymbols", //$NON-NLS-1$ "stepSetSharedLibraryPaths", //$NON-NLS-1$ "stepSetSourceSubstitutePath", //$NON-NLS-1$ + "stepSetRemoteTimeout", //$NON-NLS-1$ // -environment-directory with a lot of paths could // make setting breakpoint incredibly slow, which makes @@ -506,6 +508,39 @@ public class FinalLaunchSequence extends ReflectionSequence { } } + /** + * Before starting a remote connection, set the gdb remotetimeout to the user + * specified value. + * + * @since 5.5 + */ + @Execute + public void stepSetRemoteTimeout(RequestMonitor rm) { + if (fGDBBackend.getSessionType() == SessionType.REMOTE) { + boolean remoteTimeoutEnabled = CDebugUtils.getAttribute(fAttributes, + IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, + LaunchUtils.getRemoteTimeoutEnabledDefault()); + String remoteTimeoutValue = CDebugUtils.getAttribute(fAttributes, + IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, + LaunchUtils.getRemoteTimeoutValueDefault()); + if (remoteTimeoutEnabled && remoteTimeoutValue != null && !remoteTimeoutValue.isEmpty()) { + fCommandControl.queueCommand( + fCommandFactory.createMIGDBSetRemoteTimeout(fCommandControl.getContext(), remoteTimeoutValue), + new ImmediateDataRequestMonitor<MIInfo>(rm) { + @Override + protected void handleError() { + IStatus status = getStatus(); + MultiStatus ms = new MultiStatus(GdbPlugin.PLUGIN_ID, -1, new IStatus[] { status }, + LaunchMessages.getString("FinalLaunchSequence.2"), null); //$NON-NLS-1$ + rm.done(ms); + } + }); + return; + } + } + rm.done(); + } + private static final String INVALID = "invalid"; //$NON-NLS-1$ /** * If we are dealing with a remote-attach debugging session, connect to the target. diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchMessages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchMessages.properties index f3ac821b8f..b5f5361154 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchMessages.properties +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchMessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2008, 2012 QNX Software Systems and others. +# Copyright (c) 2008, 2018 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 @@ -139,6 +139,7 @@ CArgumentsTab.Arguments=Arguments CArgumentsTab.Variables=Variables... FinalLaunchSequence.0=Configuring GDB FinalLaunchSequence.1=Aborting configuring GDB +FinalLaunchSequence.2=Failed to set remote timeout in debugger. Please check Remote timeout settings in launch configuration or in Preferences -> C/C++ -> Debug -> GDB. GdbLaunchDelegate.0=Launching debugger session GdbLaunchDelegate.1=Debugging remote C/C++ application GdbLaunchDelegate.2=Post Mortem Debugging of C/C++ application diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java index bf757f0428..ad4ff6533d 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2016 Ericsson and others. + * Copyright (c) 2010, 2018 Ericsson 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 @@ -614,5 +614,25 @@ public class LaunchUtils { } return false; } + + /** + * Returns workspace-level default for the remote timeout enablement + * @since 5.5 + */ + public static boolean getRemoteTimeoutEnabledDefault() { + return Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID, + IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_ENABLED, + IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_TIMEOUT_ENABLED_DEFAULT, null); + } + + /** + * Returns workspace-level default for the remote timeout value + * @since 5.5 + */ + public static String getRemoteTimeoutValueDefault() { + return Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID, + IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_VALUE, + IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_TIMEOUT_VALUE_DEFAULT, null); + } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java index de5e280be2..0478f261e2 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 QNX Software Systems and others. + * Copyright (c) 2000, 2018 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 @@ -137,6 +137,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPrintObject; import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPrintSevenbitStrings; import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPythonPrintStack; import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetRecordFullStopAtLimit; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetRemoteTimeout; import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSchedulerLocking; import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSolibAbsolutePrefix; import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSolibSearchPath; @@ -834,7 +835,12 @@ public class CommandFactory { public ICommand<MIInfo> createMIGDBSetRecordFullStopAtLimit(ICommandControlDMContext ctx, boolean isSet) { return new MIGDBSetRecordFullStopAtLimit(ctx, isSet); } - + + /** @since 5.5 */ + public ICommand<MIInfo> createMIGDBSetRemoteTimeout(ICommandControlDMContext ctx, String remoteTimeout) { + return new MIGDBSetRemoteTimeout(ctx, remoteTimeout); + } + /** @since 4.1 */ public ICommand<MIInfo> createMIGDBSetSchedulerLocking(ICommandControlDMContext ctx, String mode) { return new MIGDBSetSchedulerLocking(ctx, mode); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRemoteTimeout.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRemoteTimeout.java new file mode 100644 index 0000000000..33ab94333e --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetRemoteTimeout.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2018 Kichwa Coders + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonah Graham (Kichwa Coders)- Initial API and implementation + */ +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; + +/** + * -gdb-set remotetimeout num + * @since 5.5 + */ +public class MIGDBSetRemoteTimeout extends MIGDBSet { + public MIGDBSetRemoteTimeout(ICommandControlDMContext ctx, String remoteTimeout) { + super(ctx, new String[] { "remotetimeout", remoteTimeout });//$NON-NLS-1$ + } +} |