diff options
author | Jonah Graham | 2018-02-01 19:12:10 +0000 |
---|---|---|
committer | Jonah Graham | 2018-02-06 14:08:39 +0000 |
commit | 65157ef4d52e91e31d3eac0369a39511a131ec3c (patch) | |
tree | e034b54c2ee9330d43eb7eae56779e7f0e7065e2 | |
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
25 files changed, 465 insertions, 42 deletions
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Messages.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Messages.java index 4ae9671d42a..8eb0f0c5826 100644 --- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Messages.java +++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Messages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2016 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2018 Wind River Systems, Inc. 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 @@ -75,6 +75,10 @@ public class Messages extends NLS { public static String RemoteRunLaunchDelegate_9; + public static String Remotetimeout_label; + + public static String Remotetimeout_tooltip; + static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/messages.properties b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/messages.properties index ef99467f809..afeabb7c540 100644 --- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/messages.properties +++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/messages.properties @@ -1,5 +1,5 @@ ################################################################################ -# Copyright (c) 2006, 2012 Wind River Systems, Inc. and others. +# Copyright (c) 2006, 2018 Wind River Systems, Inc. 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,6 +51,8 @@ Gdbserver_Settings_Tab_Name=Gdbserver Settings Gdbserver_name_textfield_label=Gdbserver path: Port_number_textfield_label=Port number: Gdbserver_options_textfield_label=Gdbserver options: +Remotetimeout_label=Remote timeout (seconds): +Remotetimeout_tooltip=Timeout for the remote target to respond. If unchecked, uses GDB default value. See GDB's help for "set remotetimeout num". RemoteCMainTab_Remote_Path_Browse_Button_Title=Select Remote C/C++ Application File RemoteCMainTab_Properties=Properties... RemoteCMainTab_Properties_title=Properties diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteDSFGDBDebuggerPage.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteDSFGDBDebuggerPage.java index 1ef41c059fe..e94605d8af7 100644 --- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteDSFGDBDebuggerPage.java +++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteDSFGDBDebuggerPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2016 PalmSource, Inc. and others. + * Copyright (c) 2006, 2018 PalmSource, Inc. 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,7 +14,9 @@ *******************************************************************************/ package org.eclipse.cdt.launch.remote.tabs; +import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.internal.ui.launching.GdbDebuggerPage; +import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils; import org.eclipse.cdt.internal.launch.remote.Messages; import org.eclipse.cdt.launch.remote.IRemoteConnectionConfigurationConstants; import org.eclipse.core.runtime.CoreException; @@ -23,8 +25,11 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.TabFolder; @@ -38,6 +43,10 @@ public class RemoteDSFGDBDebuggerPage extends GdbDebuggerPage{ protected Text fGDBServerPortNumberText; protected Text fGDBServerOptionsText; + + protected Button fRemoteTimeoutEnabledCheckbox; + + protected Text fRemoteTimeoutValueText; private boolean fIsInitializing = false; @@ -61,6 +70,10 @@ public class RemoteDSFGDBDebuggerPage extends GdbDebuggerPage{ IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT ); configuration.setAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_OPTIONS, IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_OPTIONS_DEFAULT ); + configuration.setAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, + LaunchUtils.getRemoteTimeoutEnabledDefault()); + configuration.setAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, + LaunchUtils.getRemoteTimeoutValueDefault()); } @Override @@ -71,6 +84,8 @@ public class RemoteDSFGDBDebuggerPage extends GdbDebuggerPage{ String gdbserverCommand = null; String gdbserverPortNumber = null; String gdbserverOptions = null; + boolean remoteTimeoutEnabled = false; + String remoteTimeoutValue = null; try { gdbserverCommand = configuration.getAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND, IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND_DEFAULT); @@ -89,9 +104,24 @@ public class RemoteDSFGDBDebuggerPage extends GdbDebuggerPage{ } catch( CoreException e ) { } + try { + remoteTimeoutEnabled = configuration.getAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, + LaunchUtils.getRemoteTimeoutEnabledDefault() ); + } + catch( CoreException e ) { + } + try { + remoteTimeoutValue = configuration.getAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, + LaunchUtils.getRemoteTimeoutValueDefault() ); + } + catch( CoreException e ) { + } fGDBServerCommandText.setText( gdbserverCommand ); fGDBServerPortNumberText.setText( gdbserverPortNumber ); fGDBServerOptionsText.setText( gdbserverOptions ); + fRemoteTimeoutEnabledCheckbox.setSelection( remoteTimeoutEnabled ); + fRemoteTimeoutValueText.setText( remoteTimeoutValue ); + remoteTimeoutEnabledChanged(); setInitializing(false); } @@ -107,6 +137,11 @@ public class RemoteDSFGDBDebuggerPage extends GdbDebuggerPage{ str = fGDBServerOptionsText.getText(); str.trim(); configuration.setAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_OPTIONS, str ); + boolean b = fRemoteTimeoutEnabledCheckbox.getSelection(); + configuration.setAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, b ); + str = fRemoteTimeoutValueText.getText(); + str.trim(); + configuration.setAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, str ); } protected void createGdbserverSettingsTab( TabFolder tabFolder ) { @@ -169,6 +204,35 @@ public class RemoteDSFGDBDebuggerPage extends GdbDebuggerPage{ updateLaunchConfigurationDialog(); } } ); + + fRemoteTimeoutEnabledCheckbox = new Button(subComp, SWT.CHECK); + fRemoteTimeoutEnabledCheckbox.setText(Messages.Remotetimeout_label); + fRemoteTimeoutEnabledCheckbox.setToolTipText(Messages.Remotetimeout_tooltip); + gd = new GridData(); + fRemoteTimeoutEnabledCheckbox.setLayoutData( gd ); + fRemoteTimeoutEnabledCheckbox.addSelectionListener( new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + remoteTimeoutEnabledChanged(); + updateLaunchConfigurationDialog(); + } + } ); + + fRemoteTimeoutValueText = new Text(subComp, SWT.SINGLE | SWT.BORDER); + data = new GridData(SWT.FILL, SWT.TOP, true, false); + fRemoteTimeoutValueText.setLayoutData(data); + fRemoteTimeoutValueText.setToolTipText(Messages.Remotetimeout_tooltip); + fRemoteTimeoutValueText.addModifyListener( new ModifyListener() { + + public void modifyText( ModifyEvent evt ) { + updateLaunchConfigurationDialog(); + } + } ); + remoteTimeoutEnabledChanged(); + } + + private void remoteTimeoutEnabledChanged() { + fRemoteTimeoutValueText.setEnabled(fRemoteTimeoutEnabledCheckbox.getSelection()); } /* (non-Javadoc) 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 ed1fc3cc6e4..589bc840058 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 1338f30ef46..bdaa915c295 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 689a6113e08..412a0b10614 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 0811c151cb3..ba458e39f28 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 6ddaee8ac7a..3338d9e0b76 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 df4925944a6..96039be187b 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 92d0937552d..c0a1a453823 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 ce8ccb5cf1a..937d9e876a9 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 6ba511cd6eb..39c025af6bb 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 2b1ecc9d64a..3d5bfd85472 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 7d52aef31de..f19cd224aca 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 f3ac821b8f4..b5f53611544 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 bf757f04281..ad4ff6533d3 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 de5e280be27..0478f261e25 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 00000000000..33ab94333e3 --- /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$ + } +} diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/StringWithBooleanFieldEditor.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/StringWithBooleanFieldEditor.java index cbdab3b1f59..c7d8816524b 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/StringWithBooleanFieldEditor.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/StringWithBooleanFieldEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2018 Wind River Systems, Inc. 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 @@ -48,7 +48,7 @@ public class StringWithBooleanFieldEditor extends DecoratingStringFieldEditor { super.doFillIntoGrid(parent, numColumns); } - private Button getCheckboxControl(Composite parent) { + public Button getCheckboxControl(Composite parent) { if (fCheckbox == null) { Composite inner= new Composite(parent, SWT.NULL); final GridLayout layout= new GridLayout(2, false); diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF index 21025fa547e..7c78c753870 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF @@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.variables, org.eclipse.ui.ide, 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.dsf.gdb.ui Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java index 58113a42d62..de750037630 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 QNX Software Systems and others. + * Copyright (c) 2007, 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 @@ -35,12 +35,14 @@ import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.gdb.internal.ui.launching.ICDTLaunchHelpContextIds; +import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Platform; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; import org.eclipse.debug.ui.StringVariableSelectionDialog; +import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.custom.StackLayout; @@ -82,6 +84,8 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { private Text connection; private String savedJtagDevice; protected Button fUpdateThreadlistOnSuspend; + private Button remoteTimeoutEnabled; + private Text remoteTimeoutValue; @Override public String getName() { @@ -102,13 +106,14 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { Composite comp = new Composite(sc, SWT.NONE); sc.setContent(comp); - GridLayout layout = new GridLayout(); + GridLayout layout = new GridLayout(2, false); comp.setLayout(layout); Group group = new Group(comp, SWT.NONE); layout = new GridLayout(); group.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; group.setLayoutData(gd); group.setText(Messages.getString("GDBJtagDebuggerTab.gdbSetupGroup_Text")); @@ -123,6 +128,10 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { updateLaunchConfigurationDialog(); } }); + gd = new GridData(); + gd.horizontalSpan = 2; + fUpdateThreadlistOnSuspend.setLayoutData(gd); + // This checkbox needs an explanation. Attach context help to it. PlatformUI.getWorkbench().getHelpSystem().setHelp(fUpdateThreadlistOnSuspend, "org.eclipse.cdt.dsf.gdb.ui.update_threadlist_button_context"); //$NON-NLS-1$ // Attach context help to this tab. @@ -192,13 +201,15 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { private void createRemoteControl(Composite parent) { Group group = new Group(parent, SWT.NONE); - GridLayout layout = new GridLayout(); + GridLayout layout = new GridLayout(2, false); group.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; group.setLayoutData(gd); group.setText(Messages.getString("GDBJtagDebuggerTab.remoteGroup_Text")); useRemote = new Button(group, SWT.CHECK); + useRemote.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create()); useRemote.setText(Messages.getString("GDBJtagDebuggerTab.useRemote_Text")); useRemote.addSelectionListener(new SelectionAdapter() { @Override @@ -207,11 +218,29 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { updateLaunchConfigurationDialog(); } }); + + + remoteTimeoutEnabled = new Button(group, SWT.CHECK); + remoteTimeoutEnabled.setText(Messages.getString("GDBJtagDebuggerTab.remoteTimeout")); + remoteTimeoutEnabled.setToolTipText(Messages.getString("GDBJtagDebuggerTab.remoteTimeoutTooltip")); + remoteTimeoutEnabled.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + remoteTimeoutChanged(); + updateLaunchConfigurationDialog(); + } + }); + remoteTimeoutValue = new Text(group, SWT.BORDER); + gd = new GridData(); + gd.widthHint = 125; + remoteTimeoutValue.setLayoutData(gd); + remoteTimeoutValue.setToolTipText(Messages.getString("GDBJtagDebuggerTab.remoteTimeoutTooltip")); Composite comp = new Composite(group, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; comp.setLayout(layout); + comp.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create()); Label label = new Label(comp, SWT.NONE); label.setText(Messages.getString("GDBJtagDebuggerTab.jtagDeviceLabel")); @@ -231,11 +260,12 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { scheduleUpdateJob(); // provides much better performance for Text listeners } }); - + remoteConnectionParameters = new Composite(group, SWT.NO_TRIM | SWT.NO_FOCUS); remoteConnectParmsLayout = new StackLayout(); remoteConnectionParameters.setLayout(remoteConnectParmsLayout); - + remoteConnectionParameters.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create()); + // // Create entry fields for TCP/IP connections // @@ -342,8 +372,14 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { } } + private void remoteTimeoutChanged() { + remoteTimeoutValue.setEnabled(remoteTimeoutEnabled.getSelection()); + } + private void useRemoteChanged() { boolean enabled = useRemote.getSelection(); + remoteTimeoutEnabled.setEnabled(enabled); + remoteTimeoutValue.setEnabled(remoteTimeoutEnabled.getSelection()); jtagDevice.setEnabled(enabled); ipAddress.setEnabled(enabled); portNumber.setEnabled(enabled); @@ -422,7 +458,14 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { boolean updateThreadsOnSuspend = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND, IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT); fUpdateThreadlistOnSuspend.setSelection(updateThreadsOnSuspend); - + remoteTimeoutEnabled.setSelection( + configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, + LaunchUtils.getRemoteTimeoutEnabledDefault())); + remoteTimeoutValue.setText( + configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, + LaunchUtils.getRemoteTimeoutValueDefault())); + + remoteTimeoutChanged(); useRemoteChanged(); } catch (CoreException e) { Activator.getDefault().getLog().log(e.getStatus()); @@ -472,7 +515,11 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { } } configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND, - fUpdateThreadlistOnSuspend.getSelection()); + fUpdateThreadlistOnSuspend.getSelection()); + configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, + remoteTimeoutEnabled.getSelection()); + configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, + remoteTimeoutValue.getText().trim()); } @Override diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/JtagUi.properties b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/JtagUi.properties index 72b7724cc1e..73b135ecdbd 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/JtagUi.properties +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/JtagUi.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2008-2010 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 @@ -66,3 +66,5 @@ GDBJtagDebuggerTab.ipAddressLabel=Host name or IP address: GDBJtagDebuggerTab.portNumberLabel=Port number: GDBJtagDebuggerTab.connectionLabel=GDB Connection String: GDBJtagDebuggerTab.update_thread_list_on_suspend=Force thread list update on suspend +GDBJtagDebuggerTab.remoteTimeout=Remote timeout (seconds): +GDBJtagDebuggerTab.remoteTimeoutTooltip=Timeout for the remote target to respond. If unchecked, uses GDB default value. See GDB's help for "set remotetimeout num". diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java index ac7ec788d2e..bb380e40c65 100644 --- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java +++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2013, 2015 Red Hat, Inc. + * Copyright (c) 2012, 2018 Red Hat, Inc. * 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 @@ -107,6 +107,10 @@ public class Messages extends NLS { public static String ContainerCommandLauncher_invalid_values; + public static String Gdbserver_Settings_Remotetimeout_label; + + public static String Gdbserver_Settings_Remotetimeout_tooltip; + static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerPage.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerPage.java index d1962bbd96c..2663eeacce6 100644 --- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerPage.java +++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010, 2015 PalmSource, Inc. and others. + * Copyright (c) 2006, 2018 PalmSource, Inc. 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,14 +15,19 @@ package org.eclipse.cdt.internal.docker.launcher; +import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.TabFolder; @@ -40,6 +45,10 @@ public class RemoteDebuggerPage extends GdbDebuggerPage { protected Text fGDBServerPortNumberText; + protected Button fRemoteTimeoutEnabledCheckbox; + + protected Text fRemoteTimeoutValueText; + @Override public String getName() { return Messages.Remote_GDB_Debugger_Options; @@ -52,6 +61,12 @@ public class RemoteDebuggerPage extends GdbDebuggerPage { ILaunchConstants.ATTR_GDBSERVER_COMMAND_DEFAULT); configuration.setAttribute(ILaunchConstants.ATTR_GDBSERVER_PORT, ILaunchConstants.ATTR_GDBSERVER_PORT_DEFAULT); + configuration.setAttribute( + IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, + LaunchUtils.getRemoteTimeoutEnabledDefault()); + configuration.setAttribute( + IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, + LaunchUtils.getRemoteTimeoutValueDefault()); } @Override @@ -59,6 +74,8 @@ public class RemoteDebuggerPage extends GdbDebuggerPage { super.initializeFrom(configuration); String gdbserverCommand = null; String gdbserverPortNumber = null; + boolean remoteTimeoutEnabled = false; + String remoteTimeoutValue = null; try { gdbserverCommand = configuration.getAttribute( ILaunchConstants.ATTR_GDBSERVER_COMMAND, @@ -71,8 +88,23 @@ public class RemoteDebuggerPage extends GdbDebuggerPage { ILaunchConstants.ATTR_GDBSERVER_PORT_DEFAULT); } catch (CoreException e) { } + try { + remoteTimeoutEnabled = configuration.getAttribute( + IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, + LaunchUtils.getRemoteTimeoutEnabledDefault()); + } catch (CoreException e) { + } + try { + remoteTimeoutValue = configuration.getAttribute( + IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, + LaunchUtils.getRemoteTimeoutValueDefault()); + } catch (CoreException e) { + } fGDBServerCommandText.setText(gdbserverCommand); fGDBServerPortNumberText.setText(gdbserverPortNumber); + fRemoteTimeoutEnabledCheckbox.setSelection(remoteTimeoutEnabled); + fRemoteTimeoutValueText.setText(remoteTimeoutValue); + remoteTimeoutEnabledChanged(); } @Override @@ -85,6 +117,15 @@ public class RemoteDebuggerPage extends GdbDebuggerPage { str = fGDBServerPortNumberText.getText(); str.trim(); configuration.setAttribute(ILaunchConstants.ATTR_GDBSERVER_PORT, str); + boolean b = fRemoteTimeoutEnabledCheckbox.getSelection(); + configuration.setAttribute( + IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, + b); + str = fRemoteTimeoutValueText.getText(); + str.trim(); + configuration.setAttribute( + IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, + str); } protected void createGdbserverSettingsTab(TabFolder tabFolder) { @@ -110,7 +151,7 @@ public class RemoteDebuggerPage extends GdbDebuggerPage { label.setLayoutData(gd); fGDBServerCommandText = new Text(subComp, SWT.SINGLE | SWT.BORDER); - GridData data = new GridData(); + GridData data = new GridData(SWT.FILL, SWT.TOP, true, false); fGDBServerCommandText.setLayoutData(data); fGDBServerCommandText.addModifyListener(new ModifyListener() { @@ -124,7 +165,7 @@ public class RemoteDebuggerPage extends GdbDebuggerPage { label.setLayoutData(gd); fGDBServerPortNumberText = new Text(subComp, SWT.SINGLE | SWT.BORDER); - data = new GridData(); + data = new GridData(SWT.FILL, SWT.TOP, true, false); fGDBServerPortNumberText.setLayoutData(data); fGDBServerPortNumberText.addModifyListener(new ModifyListener() { @@ -132,6 +173,41 @@ public class RemoteDebuggerPage extends GdbDebuggerPage { updateLaunchConfigurationDialog(); } }); + + fRemoteTimeoutEnabledCheckbox = new Button(subComp, SWT.CHECK); + fRemoteTimeoutEnabledCheckbox + .setText(Messages.Gdbserver_Settings_Remotetimeout_label); + fRemoteTimeoutEnabledCheckbox + .setToolTipText( + Messages.Gdbserver_Settings_Remotetimeout_tooltip); + gd = new GridData(); + fRemoteTimeoutEnabledCheckbox.setLayoutData(gd); + fRemoteTimeoutEnabledCheckbox + .addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + remoteTimeoutEnabledChanged(); + updateLaunchConfigurationDialog(); + } + }); + + fRemoteTimeoutValueText = new Text(subComp, SWT.SINGLE | SWT.BORDER); + data = new GridData(SWT.FILL, SWT.TOP, true, false); + fRemoteTimeoutValueText.setLayoutData(data); + fRemoteTimeoutValueText.setToolTipText( + Messages.Gdbserver_Settings_Remotetimeout_tooltip); + fRemoteTimeoutValueText.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent evt) { + updateLaunchConfigurationDialog(); + } + }); + remoteTimeoutEnabledChanged(); + } + + private void remoteTimeoutEnabledChanged() { + fRemoteTimeoutValueText + .setEnabled(fRemoteTimeoutEnabledCheckbox.getSelection()); } /* diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/messages.properties b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/messages.properties index a545210b63a..576419a814e 100644 --- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/messages.properties +++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/messages.properties @@ -1,5 +1,5 @@ #******************************************************************************* -# Copyright (c) 2015 Red Hat. +# Copyright (c) 2015, 2018 Red Hat. # 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 @@ -100,3 +100,5 @@ GDBDebuggerPage_tracepoint_mode_auto=Automatic StandardGDBDebuggerPage14=Use full file path to set breakpoints +Gdbserver_Settings_Remotetimeout_label=Remote timeout (seconds): +Gdbserver_Settings_Remotetimeout_tooltip=Timeout for the remote target to respond. If unchecked, uses GDB default value. See GDB's help for "set remotetimeout num". |