From 74138d21f55778a2d1fe1ce745ba2736ebbea57a Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Mon, 16 Apr 2012 16:56:17 -0400 Subject: [PATCH] Bug 361934 - Provide timeout for gdb commands Change-Id: Id51a138411e49f7157858379f8aa09a59a8e4f78 Reviewed-on: https://git.eclipse.org/r/5523 Reviewed-by: Mikhail Khodjaiants IP-Clean: Mikhail Khodjaiants Tested-by: Mikhail Khodjaiants --- .../icons/full/wizban/advtosettings_wiz.png | Bin 0 -> 8548 bytes dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml | 9 + .../dsf/gdb/internal/ui/GdbStatusHandler.java | 66 +++ .../cdt/dsf/gdb/internal/ui/GdbUIPlugin.java | 31 + .../dsf/gdb/internal/ui/IGdbUIConstants.java | 28 + .../cdt/dsf/gdb/internal/ui/Messages.java | 29 + .../dsf/gdb/internal/ui/Messages.properties | 14 + .../preferences/GdbDebugPreferencePage.java | 536 +++++++++++++++++- .../preferences/MessagesForPreferences.java | 13 + .../MessagesForPreferences.properties | 14 + dsf-gdb/org.eclipse.cdt.dsf.gdb/.options | 1 + .../cdt/dsf/gdb/IGdbDebugConstants.java | 8 +- .../dsf/gdb/IGdbDebugPreferenceConstants.java | 30 +- .../internal/GdbPreferenceInitializer.java | 2 + .../cdt/dsf/gdb/internal/Messages.java | 32 ++ .../cdt/dsf/gdb/internal/Messages.properties | 15 + .../service/command/CustomTimeoutsMap.java | 79 +++ .../dsf/gdb/service/command/GDBControl.java | 124 ++++ .../gdb/service/command/GDBControl_7_0.java | 2 + .../command/GdbCommandTimeoutManager.java | 443 +++++++++++++++ .../mi/service/command/AbstractMIControl.java | 45 ++ .../tests/dsf/gdb/framework/BaseTestCase.java | 17 +- .../cdt/tests/dsf/gdb/tests/AllTests.java | 1 + .../dsf/gdb/tests/CommandTimeoutTest.java | 143 +++++ .../tests_6_6/CommandTimeoutTest_6_6.java | 26 + .../dsf/gdb/tests/tests_6_6/Suite_6_6.java | 3 +- .../gdb/tests/tests_6_6/Suite_Remote_6_6.java | 3 +- .../tests_6_7/CommandTimeoutTest_6_7.java | 26 + .../dsf/gdb/tests/tests_6_7/Suite_6_7.java | 3 +- .../gdb/tests/tests_6_7/Suite_Remote_6_7.java | 3 +- .../tests_6_8/CommandTimeoutTest_6_8.java | 26 + .../dsf/gdb/tests/tests_6_8/Suite_6_8.java | 3 +- .../gdb/tests/tests_6_8/Suite_Remote_6_8.java | 3 +- .../tests_7_0/CommandTimeoutTest_7_0.java | 26 + .../dsf/gdb/tests/tests_7_0/Suite_7_0.java | 3 +- .../gdb/tests/tests_7_0/Suite_Remote_7_0.java | 3 +- .../tests_7_1/CommandTimeoutTest_7_1.java | 26 + .../dsf/gdb/tests/tests_7_1/Suite_7_1.java | 3 +- .../gdb/tests/tests_7_1/Suite_Remote_7_1.java | 3 +- .../tests_7_2/CommandTimeoutTest_7_2.java | 26 + .../dsf/gdb/tests/tests_7_2/Suite_7_2.java | 3 +- .../gdb/tests/tests_7_2/Suite_Remote_7_2.java | 3 +- .../tests_7_3/CommandTimeoutTest_7_3.java | 26 + .../dsf/gdb/tests/tests_7_3/Suite_7_3.java | 3 +- .../gdb/tests/tests_7_3/Suite_Remote_7_3.java | 3 +- .../tests_7_4/CommandTimeoutTest_7_4.java | 26 + .../dsf/gdb/tests/tests_7_4/Suite_7_4.java | 3 +- .../gdb/tests/tests_7_4/Suite_Remote_7_4.java | 1 + 48 files changed, 1905 insertions(+), 31 deletions(-) create mode 100755 dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/icons/full/wizban/advtosettings_wiz.png create mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbStatusHandler.java create mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/IGdbUIConstants.java create mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.java create mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.properties create mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.java create mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.properties create mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CustomTimeoutsMap.java create mode 100644 dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GdbCommandTimeoutManager.java create mode 100644 dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java create mode 100644 dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/CommandTimeoutTest_6_6.java create mode 100644 dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/CommandTimeoutTest_6_7.java create mode 100644 dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/CommandTimeoutTest_6_8.java create mode 100644 dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/CommandTimeoutTest_7_0.java create mode 100644 dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/CommandTimeoutTest_7_1.java create mode 100644 dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/CommandTimeoutTest_7_2.java create mode 100644 dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/CommandTimeoutTest_7_3.java create mode 100644 dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/CommandTimeoutTest_7_4.java diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/icons/full/wizban/advtosettings_wiz.png b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/icons/full/wizban/advtosettings_wiz.png new file mode 100755 index 0000000000000000000000000000000000000000..7229ca07fd35c5f8236ef2ddbb63c03fe67e29ab GIT binary patch literal 8548 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 ey%%Bq{{aA{5cZ6Xhu{AI0000 + + + + diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbStatusHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbStatusHandler.java new file mode 100644 index 00000000000..3bbd6396570 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbStatusHandler.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2011 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.dsf.gdb.internal.ui; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.debug.core.IStatusHandler; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public class GdbStatusHandler implements IStatusHandler { + + /* (non-Javadoc) + * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object) + */ + @Override + public Object handleStatus( final IStatus status, Object source ) throws CoreException { + Runnable runnable = null; + if ( status.getSeverity() == IStatus.ERROR ) { + runnable = new Runnable() { + + @Override + public void run() { + Shell parent = GdbUIPlugin.getActiveWorkbenchShell(); + if ( parent != null ) + MessageDialog.openError( parent, Messages.GdbStatusHandler_Error, status.getMessage() ); + } + }; + } + else if ( status.getSeverity() == IStatus.WARNING ) { + runnable = new Runnable() { + + @Override + public void run() { + Shell parent = GdbUIPlugin.getActiveWorkbenchShell(); + if ( parent != null ) + MessageDialog.openWarning( parent, Messages.GdbStatusHandler_Warning, status.getMessage() ); + } + }; + } + else if ( status.getSeverity() == IStatus.INFO ) { + runnable = new Runnable() { + + @Override + public void run() { + Shell parent = GdbUIPlugin.getActiveWorkbenchShell(); + if ( parent != null ) + MessageDialog.openInformation( parent, Messages.GdbStatusHandler_Information, status.getMessage() ); + } + }; + } + if ( runnable != null ) + Display.getDefault().asyncExec( runnable ); + return null; + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java index 2aedaeb95b0..3e9ed2919f2 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbUIPlugin.java @@ -22,6 +22,9 @@ import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; @@ -227,4 +230,32 @@ public class GdbUIPlugin extends AbstractUIPlugin { } } + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) + */ + @Override + protected void initializeImageRegistry( ImageRegistry reg ) { + super.initializeImageRegistry( reg ); + declareImages( reg ); + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + public static Image getImage( String key ) { + return getDefault().getImageRegistry().get( key ); + } + + private void declareImages( ImageRegistry reg ) { + reg.put( IGdbUIConstants.IMG_WIZBAN_ADVANCED_TIMEOUT_SETTINGS, + getImageDescriptor( "icons/full/wizban/advtosettings_wiz.png" ) ); //$NON-NLS-1$ + } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/IGdbUIConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/IGdbUIConstants.java new file mode 100644 index 00000000000..3a10e92f305 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/IGdbUIConstants.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2011 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.dsf.gdb.internal.ui; + +/** + * @noimplement This interface is not intended to be implemented by clients. + * + * @since 4.1 + */ +public interface IGdbUIConstants { + + /** + * Plug-in identifier (value "org.eclipse.cdt.dsf.gdb.ui"). + */ + public static final String PLUGIN_ID = GdbUIPlugin.PLUGIN_ID; + + /** image identifier. */ + public static final String IMG_WIZBAN_ADVANCED_TIMEOUT_SETTINGS = PLUGIN_ID + ".imageAdvancedTimeoutSettings"; //$NON-NLS-1$ +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.java new file mode 100644 index 00000000000..1b8f0f53bd2 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2011 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.dsf.gdb.internal.ui; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + public static String GdbStatusHandler_Error; + + public static String GdbStatusHandler_Information; + + public static String GdbStatusHandler_Warning; + static { + // initialize resource bundle + NLS.initializeMessages( Messages.class.getName(), Messages.class ); + } + + private Messages() { + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.properties new file mode 100644 index 00000000000..765b50e87aa --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/Messages.properties @@ -0,0 +1,14 @@ +####################################################################################### +# Copyright (c) 2012 Mentor Graphics 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 +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Mentor Graphics - Initial API and implementation +####################################################################################### + +GdbStatusHandler_Error=Error +GdbStatusHandler_Information=Information +GdbStatusHandler_Warning=Warning 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 7277956d3f1..e6d688d2b56 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 @@ -13,25 +13,62 @@ package org.eclipse.cdt.dsf.gdb.internal.ui.preferences; import java.io.File; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.eclipse.cdt.dsf.debug.internal.ui.preferences.IntegerWithBooleanFieldEditor; import org.eclipse.cdt.dsf.debug.internal.ui.preferences.StringWithBooleanFieldEditor; import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; -import org.eclipse.cdt.dsf.gdb.internal.ui.launching.LaunchUIMessages; +import org.eclipse.cdt.dsf.gdb.internal.ui.IGdbUIConstants; +import org.eclipse.cdt.dsf.gdb.service.command.CustomTimeoutsMap; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.fieldassist.ControlDecoration; +import org.eclipse.jface.fieldassist.FieldDecorationRegistry; import org.eclipse.jface.preference.BooleanFieldEditor; import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IntegerFieldEditor; import org.eclipse.jface.preference.StringFieldEditor; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.ICellEditorListener; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TextCellEditor; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.window.Window; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Rectangle; 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.Control; import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.PlatformUI; @@ -41,6 +78,7 @@ import org.eclipse.ui.PlatformUI; */ @SuppressWarnings("restriction") public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + /** * A vehicle in order to be able to register a selection listener with * a {@link BooleanFieldEditor}. @@ -58,20 +96,428 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements } } + class AdvancedTimeoutSettingsDialog extends TitleAreaDialog { + + class CommandTimeoutEntry { + + String fCommand; + Integer fTimeout; + + CommandTimeoutEntry( String command, Integer timeout ) { + fCommand = command; + fTimeout = timeout; + } + } + + class CellEditorListener implements ICellEditorListener { + + CellEditor fEditor; + + public CellEditorListener( CellEditor editor ) { + super(); + fEditor = editor; + } + + @Override + public void editorValueChanged( boolean oldValidState, boolean newValidState ) { + if ( newValidState ) { + setErrorMessage( null ); + } + else { + setErrorMessage( fEditor.getErrorMessage() ); + } + updateDialogButtons(); + } + + @Override + public void cancelEditor() { + } + + @Override + public void applyEditorValue() { + validate(); + updateDialogButtons(); + } + }; + + abstract class AbstractEditingSupport extends EditingSupport { + + public AbstractEditingSupport( ColumnViewer viewer ) { + super( viewer ); + } + + @Override + protected void setValue( Object element, Object value ) { + if ( element instanceof CommandTimeoutEntry && value instanceof String ) { + if ( processValue( (CommandTimeoutEntry)element, (String)value ) ) { + fViewer.refresh( element ); + validate(); + updateDialogButtons(); + } + } + } + + @Override + protected Object getValue( Object element ) { + if ( element instanceof CommandTimeoutEntry ) { + return doGetValue( (CommandTimeoutEntry)element ); + } + return null; + } + + @Override + protected CellEditor getCellEditor( Object element ) { + final CellEditor editor = new TextCellEditor( (Composite)getViewer().getControl() ); + editor.setValidator( getValidator() ); + editor.addListener( new CellEditorListener( editor ) ); + return editor; + } + + @Override + protected boolean canEdit( Object element ) { + return ( element instanceof CommandTimeoutEntry ); + } + + abstract boolean processValue( CommandTimeoutEntry entry, String value ); + + abstract Object doGetValue( CommandTimeoutEntry entry ); + + abstract ICellEditorValidator getValidator(); + }; + + private TableViewer fViewer; + private Button fAddButton; + private Button fDeleteButton; + + private List fEntries; + + final private ICellEditorValidator fCommandValidator = new ICellEditorValidator() { + + @Override + public String isValid( Object value ) { + if ( value instanceof String && ((String)value).trim().length() == 0 ) { + return MessagesForPreferences.GdbDebugPreferencePage_Command_field_can_not_be_empty; + } + return null; + } + }; + + final private ICellEditorValidator fTimeoutValidator = new ICellEditorValidator() { + + @Override + public String isValid( Object value ) { + if ( value instanceof String ) { + try { + int intValue = Integer.decode( (String)value ).intValue(); + if ( intValue < 0 ) + return MessagesForPreferences.GdbDebugPreferencePage_Timeout_value_can_not_be_negative; + } + catch( NumberFormatException e ) { + return MessagesForPreferences.GdbDebugPreferencePage_Invalid_timeout_value; + } + } + return null; + } + }; + + AdvancedTimeoutSettingsDialog( Shell parentShell, Set> entries ) { + super( parentShell ); + setShellStyle(getShellStyle() | SWT.RESIZE); + fEntries = new LinkedList(); + for ( Map.Entry entry : entries ) { + fEntries.add( new CommandTimeoutEntry( entry.getKey(), entry.getValue() ) ); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + @Override + protected Control createDialogArea( Composite parent ) { + getShell().setText( MessagesForPreferences.GdbDebugPreferencePage_Advanced_Timeout_Settings ); + setTitle( MessagesForPreferences.GdbDebugPreferencePage_Advanced_timeout_dialog_title ); + setTitleImage( GdbUIPlugin.getImage( IGdbUIConstants.IMG_WIZBAN_ADVANCED_TIMEOUT_SETTINGS ) ); + setMessage( MessagesForPreferences.GdbDebugPreferencePage_Advanced_timeout_dialog_message ); + + Composite control = (Composite)super.createDialogArea( parent ); + Composite comp = new Composite( control, SWT.NONE ); + GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true ); + GridLayout layout = new GridLayout( 2, false ); + layout.marginLeft = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth(); + comp.setLayout( layout ); + comp.setLayoutData( gd ); + + fViewer = new TableViewer( comp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER ); + final Table table = fViewer.getTable(); + gd = new GridData( SWT.FILL, SWT.FILL, true, true ); + gd.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth(); + table.setLayoutData( gd ); + + ControlDecoration decoration = new ControlDecoration( table, SWT.TOP | SWT.LEFT, control ); + decoration.setImage( + FieldDecorationRegistry.getDefault().getFieldDecoration( + FieldDecorationRegistry.DEC_INFORMATION ).getImage() ); + decoration.setDescriptionText( + MessagesForPreferences.GdbDebugPreferencePage_Advanced_timeout_settings_dialog_tooltip ); + fViewer.addDoubleClickListener( new IDoubleClickListener() { + @Override + public void doubleClick( DoubleClickEvent event ) { + okPressed(); + } + } ); + + fViewer.addSelectionChangedListener( new ISelectionChangedListener() { + + @Override + public void selectionChanged( SelectionChangedEvent event ) { + updateDialogButtons(); + } + } ); + + Composite btnComp = new Composite( comp, SWT.NONE ); + btnComp.setLayout( new GridLayout() ); + btnComp.setLayoutData( new GridData( SWT.RIGHT, SWT.TOP, false, false ) ); + + fAddButton = new Button( btnComp, SWT.PUSH ); + fAddButton.setText( MessagesForPreferences.GdbDebugPreferencePage_Add_button ); + fAddButton.setFont( JFaceResources.getDialogFont() ); + setButtonLayoutData( fAddButton ); + fAddButton.addSelectionListener( new SelectionAdapter() { + + @Override + public void widgetSelected( SelectionEvent e ) { + addNewEntry(); + } + } ); + + fDeleteButton = new Button( btnComp, SWT.PUSH ); + fDeleteButton.setText( MessagesForPreferences.GdbDebugPreferencePage_Delete_button ); + fDeleteButton.setFont( JFaceResources.getDialogFont() ); + setButtonLayoutData( fDeleteButton ); + fDeleteButton.addSelectionListener( new SelectionAdapter() { + + @Override + public void widgetSelected( SelectionEvent e ) { + deleteEntries(); + } + } ); + + table.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) ); + table.setHeaderVisible( true ); + table.setLinesVisible( true ); + + TableViewerColumn commandColumn = new TableViewerColumn( fViewer, SWT.LEFT ); + commandColumn.getColumn().setText( MessagesForPreferences.GdbDebugPreferencePage_Command_column_name ); + commandColumn.setLabelProvider( createCommandLabelProvider() ); + commandColumn.setEditingSupport( createCommandEditingSupport( fViewer ) ); + + TableViewerColumn timeoutColumn = new TableViewerColumn( fViewer, SWT.LEFT ); + timeoutColumn.getColumn().setText( MessagesForPreferences.GdbDebugPreferencePage_Timeout_column_name ); + timeoutColumn.setLabelProvider( createTimeoutLabelProvider() ); + timeoutColumn.setEditingSupport( createTimeoutEditingSupport( fViewer ) ); + + fViewer.setContentProvider( createCustomTimeoutsContentProvider() ); + + table.addControlListener( new ControlAdapter() { + + @Override + public void controlResized( ControlEvent e ) { + Rectangle area = table.getClientArea(); + if ( area.width > 0 ) { + TableColumn[] cols = table.getColumns(); + cols[0].setWidth( area.width * 50 / 100 ); + cols[1].setWidth( area.width * 50 / 100 ); + table.removeControlListener( this ); + } + } + } ); + + fViewer.setInput( fEntries ); + + updateDialogButtons(); + + return control; + } + + void updateDialogButtons() { + if ( fViewer != null && fDeleteButton != null ) { + fDeleteButton.setEnabled( !fViewer.getSelection().isEmpty() ); + } + Button okButton = getButton( IDialogConstants.OK_ID ); + if ( okButton != null ) + okButton.setEnabled( getErrorMessage() == null ); + } + + void addNewEntry() { + CommandTimeoutEntry newEntry = new CommandTimeoutEntry( "", Integer.valueOf( 0 ) ); //$NON-NLS-1$ + fEntries.add( newEntry ); + fViewer.refresh(); + fViewer.setSelection( new StructuredSelection( newEntry ) ); + validateEntry( newEntry ); + updateDialogButtons(); + fViewer.editElement( newEntry, 0 ); + } + + void deleteEntries() { + IStructuredSelection sel = (IStructuredSelection)fViewer.getSelection(); + if ( !sel.isEmpty() ) + fEntries.removeAll( sel.toList() ); + fViewer.refresh(); + validate(); + updateDialogButtons(); + } + + CustomTimeoutsMap getResult() { + CustomTimeoutsMap map = new CustomTimeoutsMap(); + for ( CommandTimeoutEntry entry : fEntries ) { + map.put( entry.fCommand, entry.fTimeout ); + } + return map; + } + + void validate() { + for ( CommandTimeoutEntry entry : fEntries ) { + validateEntry( entry ); + } + } + + void validateEntry( CommandTimeoutEntry entry ) { + String errorMessage = fCommandValidator.isValid( entry.fCommand ); + setErrorMessage( ( errorMessage != null ) ? + errorMessage : fTimeoutValidator.isValid( entry.fTimeout.toString() ) ); + } + + IStructuredContentProvider createCustomTimeoutsContentProvider() { + return new IStructuredContentProvider() { + + @Override + public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) { + } + + @Override + public void dispose() { + } + + @Override + public Object[] getElements( Object inputElement ) { + if ( inputElement instanceof List ) { + @SuppressWarnings( "unchecked" ) + List list = (List)inputElement; + return list.toArray( new Object[list.size()] ); + } + return null; + } + }; + } + + ColumnLabelProvider createCommandLabelProvider() { + return new ColumnLabelProvider() { + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object) + */ + @Override + public String getText( Object element ) { + if ( element instanceof CommandTimeoutEntry ) { + return ((CommandTimeoutEntry)element).fCommand; + } + return super.getText( element ); + } + }; + } + + ColumnLabelProvider createTimeoutLabelProvider() { + return new ColumnLabelProvider() { + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object) + */ + @Override + public String getText( Object element ) { + if ( element instanceof CommandTimeoutEntry ) { + return ((CommandTimeoutEntry)element).fTimeout.toString(); + } + return super.getText( element ); + } + }; + } + + EditingSupport createCommandEditingSupport( ColumnViewer viewer ) { + return new AbstractEditingSupport( viewer ) { + + @Override + boolean processValue( CommandTimeoutEntry entry, String value ) { + entry.fCommand = value; + return true; + } + + @Override + Object doGetValue( CommandTimeoutEntry entry ) { + return entry.fCommand; + } + + @Override + ICellEditorValidator getValidator() { + return fCommandValidator; + } + }; + } + + EditingSupport createTimeoutEditingSupport( ColumnViewer viewer ) { + return new AbstractEditingSupport( viewer ) { + + @Override + boolean processValue( CommandTimeoutEntry entry, String value ) { + try { + entry.fTimeout = Integer.decode( value ); + return true; + } + catch( NumberFormatException e ) { + // Shouldn't happen, validator takes care of this case. + } + return false; + } + + @Override + Object doGetValue( CommandTimeoutEntry entry ) { + return entry.fTimeout.toString(); + } + + @Override + ICellEditorValidator getValidator() { + return fTimeoutValidator; + } + }; + } + } + + private IntegerWithBooleanFieldEditor fCommandTimeoutField; + private Button fTimeoutAdvancedButton; + + private CustomTimeoutsMap fCustomTimeouts; + public GdbDebugPreferencePage() { super(FLAT); IPreferenceStore store= GdbUIPlugin.getDefault().getPreferenceStore(); setPreferenceStore(store); setDescription(MessagesForPreferences.GdbDebugPreferencePage_description); + fCustomTimeouts = new CustomTimeoutsMap(); } @Override public void init(IWorkbench workbench) { } + @Override + protected void initialize() { + super.initialize(); + initializeCustomTimeouts(); + } + @Override public void createControl(Composite parent) { super.createControl(parent); + updateTimeoutButtons(); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), GdbUIPlugin.PLUGIN_ID + ".dsfgdb_preference_page"); //$NON-NLS-1$ } @@ -91,44 +537,46 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements final StringFieldEditor stringFieldEditorCommand = new StringFieldEditor( IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, - LaunchUIMessages.getString("GDBDebuggerPage.gdb_debugger"), //$NON-NLS-1$ + "GDB debugger:", //$NON-NLS-1$ group1); stringFieldEditorCommand.fillIntoGrid(group1, 2); addField(stringFieldEditorCommand); Button browsebutton = new Button(group1, SWT.PUSH); - browsebutton.setText(LaunchUIMessages.getString("GDBDebuggerPage.gdb_browse")); //$NON-NLS-1$ + browsebutton.setText("&Browse..."); //$NON-NLS-1$ browsebutton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - handleBrowseButtonSelected(LaunchUIMessages.getString("GDBDebuggerPage.gdb_browse_dlg_title"), //$NON-NLS-1$ + handleBrowseButtonSelected("GDB Debugger", //$NON-NLS-1$ stringFieldEditorCommand); } }); + setButtonLayoutData( browsebutton ); final StringFieldEditor stringFieldEditorGdbInit = new StringFieldEditor( IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT, - LaunchUIMessages.getString("GDBDebuggerPage.gdb_command_file"), //$NON-NLS-1$ + "GDB command file:", //$NON-NLS-1$ group1); stringFieldEditorGdbInit.fillIntoGrid(group1, 2); addField(stringFieldEditorGdbInit); browsebutton = new Button(group1, SWT.PUSH); - browsebutton.setText(LaunchUIMessages.getString("GDBDebuggerPage.gdb_browse")); //$NON-NLS-1$ + browsebutton.setText("&Browse..."); //$NON-NLS-1$ browsebutton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - handleBrowseButtonSelected(LaunchUIMessages.getString("GDBDebuggerPage.gdb_cmdfile_dlg_title"), //$NON-NLS-1$ + handleBrowseButtonSelected("GDB Command File", //$NON-NLS-1$ stringFieldEditorGdbInit); } }); + setButtonLayoutData( browsebutton ); final StringWithBooleanFieldEditor enableStopAtMain = new StringWithBooleanFieldEditor( IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN, IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL, - LaunchUIMessages.getString("CDebuggerTab.Stop_at_main_on_startup"), //$NON-NLS-1$ + "Stop on startup at:", //$NON-NLS-1$ group1); - enableStopAtMain.fillIntoGrid(group1, 2); + enableStopAtMain.fillIntoGrid(group1, 3); addField(enableStopAtMain); // final StringFieldEditor stopAtMainSymbol = new StringFieldEditor( @@ -145,9 +593,29 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements // } // }); + fCommandTimeoutField = new IntegerWithBooleanFieldEditor( + IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, + IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, + MessagesForPreferences.GdbDebugPreferencePage_Command_timeout, + group1); + fCommandTimeoutField.setValidRange(0, Integer.MAX_VALUE); + fCommandTimeoutField.fillIntoGrid(group1, 2); + addField(fCommandTimeoutField); + + fTimeoutAdvancedButton = new Button(group1, SWT.PUSH); + fTimeoutAdvancedButton.setText(MessagesForPreferences.GdbDebugPreferencePage_Advanced_button); + fTimeoutAdvancedButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleAdvancedButtonSelected( + "GDB Debugger"); //$NON-NLS-1$ + } + }); + setButtonLayoutData( fTimeoutAdvancedButton ); + final ListenableBooleanFieldEditor enableNonStop= new ListenableBooleanFieldEditor( IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP, - LaunchUIMessages.getString("GDBDebuggerPage.nonstop_mode"), //$NON-NLS-1$ + "Non-stop mode (Note: Requires non-stop GDB)", //$NON-NLS-1$ SWT.NONE, group1); enableNonStop.fillIntoGrid(group1, 3); addField(enableNonStop); @@ -286,8 +754,56 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements stringFieldEditor.setStringValue(res); } + private void handleAdvancedButtonSelected(String dialogTitle) { + AdvancedTimeoutSettingsDialog dialog = + new AdvancedTimeoutSettingsDialog( getShell(), fCustomTimeouts.entrySet() ); + if ( dialog.open() == Window.OK ) { + fCustomTimeouts = dialog.getResult(); + } + } + @Override protected void adjustGridLayout() { // do nothing } + + @Override + public void propertyChange( PropertyChangeEvent event ) { + if ( event.getSource().equals( fCommandTimeoutField ) && event.getNewValue() instanceof Boolean ) { + fTimeoutAdvancedButton.setEnabled( ((Boolean)event.getNewValue()).booleanValue() ); + } + super.propertyChange( event ); + } + + @Override + protected void performDefaults() { + IPreferenceStore store = getPreferenceStore(); + if ( store != null ) { + String memento = store.getDefaultString( IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS ); + fCustomTimeouts.initializeFromMemento( memento ); + } + super.performDefaults(); + updateTimeoutButtons(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk() + */ + @Override + public boolean performOk() { + getPreferenceStore().setValue( IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS, fCustomTimeouts.getMemento() ); + return super.performOk(); + } + + private void updateTimeoutButtons() { + fTimeoutAdvancedButton.setEnabled( fCommandTimeoutField.getBooleanValue() ); + } + + private void initializeCustomTimeouts() { + IPreferenceStore store = getPreferenceStore(); + if ( store != null ) { + String memento = store.getString( IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS ); + fCustomTimeouts.initializeFromMemento( memento ); + } + } } 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 43f30999338..752701a87b2 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 @@ -17,6 +17,12 @@ import org.eclipse.osgi.util.NLS; * Preference strings. */ class MessagesForPreferences extends NLS { + public static String GdbDebugPreferencePage_Add_button; + public static String GdbDebugPreferencePage_Advanced_button; + public static String GdbDebugPreferencePage_Advanced_timeout_dialog_message; + public static String GdbDebugPreferencePage_Advanced_timeout_dialog_title; + public static String GdbDebugPreferencePage_Advanced_timeout_settings_dialog_tooltip; + public static String GdbDebugPreferencePage_Advanced_Timeout_Settings; public static String GdbDebugPreferencePage_description; public static String GdbDebugPreferencePage_traces_label; public static String GdbDebugPreferencePage_enableTraces_label; @@ -24,6 +30,9 @@ class MessagesForPreferences extends NLS { public static String GdbDebugPreferencePage_maxGdbTraces_label; public static String GdbDebugPreferencePage_termination_label; public static String GdbDebugPreferencePage_autoTerminateGdb_label; + public static String GdbDebugPreferencePage_Command_column_name; + public static String GdbDebugPreferencePage_Command_field_can_not_be_empty; + public static String GdbDebugPreferencePage_Command_timeout; public static String GdbDebugPreferencePage_hover_label; public static String GdbDebugPreferencePage_useInspectorHover_label; /** @since 2.2 */ @@ -36,6 +45,10 @@ class MessagesForPreferences extends NLS { public static String GdbDebugPreferencePage_initialChildCountLimitForCollections_label; /** @since 2.2 */ public static String GdbDebugPreferencePage_defaults_label; + public static String GdbDebugPreferencePage_Delete_button; + public static String GdbDebugPreferencePage_Invalid_timeout_value; + public static String GdbDebugPreferencePage_Timeout_column_name; + public static String GdbDebugPreferencePage_Timeout_value_can_not_be_negative; static { // initialize resource bundle NLS.initializeMessages(MessagesForPreferences.class.getName(), MessagesForPreferences.class); 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 849a567443a..954149f1345 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 @@ -10,6 +10,7 @@ # Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) ############################################################################### +GdbDebugPreferencePage_Add_button=Add GdbDebugPreferencePage_description=General settings for GDB Debugging GdbDebugPreferencePage_traces_label=Traces @@ -17,6 +18,9 @@ GdbDebugPreferencePage_enableTraces_label=Enable GDB traces GdbDebugPreferencePage_maxGdbTraces_label=Limit GDB traces output (number of characters): GdbDebugPreferencePage_termination_label=Termination GdbDebugPreferencePage_autoTerminateGdb_label=Terminate GDB when last process exits +GdbDebugPreferencePage_Command_column_name=GDB/MI Command +GdbDebugPreferencePage_Command_field_can_not_be_empty='Command' field can not be empty +GdbDebugPreferencePage_Command_timeout=Command timeout (ms): GdbDebugPreferencePage_hover_label=Debug Text Hover GdbDebugPreferencePage_useInspectorHover_label=Use enhanced debug hover @@ -27,3 +31,13 @@ GdbDebugPreferencePage_enablePrettyPrinting_label2=(requires python-enabled GDB) GdbDebugPreferencePage_initialChildCountLimitForCollections_label=For collections, initially limit child count to GdbDebugPreferencePage_defaults_label=Debug Configurations Defaults +GdbDebugPreferencePage_Delete_button=Delete +GdbDebugPreferencePage_Invalid_timeout_value=Invalid timeout value +GdbDebugPreferencePage_Timeout_column_name=Timeout(ms) +GdbDebugPreferencePage_Timeout_value_can_not_be_negative=Timeout value can not be negative + +GdbDebugPreferencePage_Advanced_button=&Advanced... +GdbDebugPreferencePage_Advanced_timeout_dialog_message=Specify commands and corresponding timeout values. +GdbDebugPreferencePage_Advanced_timeout_dialog_title=Add/delete/modify custom timeouts for GDB/MI commands +GdbDebugPreferencePage_Advanced_timeout_settings_dialog_tooltip=Specify commands and corresponding timeout values, use zero for "no timeout".\nMI commands must start with hyphen ('-'). For example, '-target-select'.\nThe default value will be used for all commands that are not mentioned here. +GdbDebugPreferencePage_Advanced_Timeout_Settings=Advanced Timeout Settings diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/.options b/dsf-gdb/org.eclipse.cdt.dsf.gdb/.options index 28eeb8b6aa9..b9256aedc6e 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/.options +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/.options @@ -1 +1,2 @@ org.eclipse.cdt.dsf.gdb/debug = false +org.eclipse.cdt.dsf.gdb/debug/timeouts = false diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java index f50d84f1021..a56582932cf 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java @@ -16,7 +16,6 @@ import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; - /** * @noimplement This interface is not intended to be implemented by clients. * @since 4.0 @@ -25,6 +24,12 @@ public interface IGdbDebugConstants { public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$ + /** + * Status code for which a UI handler is registered. + * @since 4.1 + */ + public static final int STATUS_HANDLER_CODE = 20001; + /** * Attribute key to be added to the IProcess associated with an IMIContainerDMContext. * The value should be the groupId as returned by {@link IMIContainerDMContext#getGroupId()} @@ -54,6 +59,5 @@ public interface IGdbDebugConstants { */ public static final String GDB_PROCESS_CREATION_VALUE = PREFIX + "gdbProcess"; //$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 acc62431fc4..8a77e886b18 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 @@ -19,6 +19,11 @@ import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; * @since 2.0 */ public interface IGdbDebugPreferenceConstants { + + /** + * Help prefixes. + */ + public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$ /** * Boolean preference whether to enable GDB traces. Default is true. @@ -87,8 +92,27 @@ public interface IGdbDebugPreferenceConstants { public static final String PREF_DEFAULT_NON_STOP = "defaultNonStop"; //$NON-NLS-1$ /** - * Help prefixes. - */ - public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$ + * The value is an boolean specifying whether the timeout is used for GDB commands. + * @since 4.1 + */ + public static final String PREF_COMMAND_TIMEOUT = PREFIX + "commandTimeout"; //$NON-NLS-1$ + + /** + * The value is an integer specifying the timeout value (milliseconds) for GDB commands. + * @since 4.1 + */ + public static final String PREF_COMMAND_TIMEOUT_VALUE = PREFIX + "commandTimeoutValue"; //$NON-NLS-1$ + + /** + * The value is a string specifying the list of GDB/MI commands with custom timeout values. + * @since 4.1 + */ + public static final String PREF_COMMAND_CUSTOM_TIMEOUTS = PREFIX + "commandCustomTimeouts"; //$NON-NLS-1$ + + /** + * Default default value for PREF_COMMAND_TIMEOUT; + * @since 4.1 + */ + public static final int COMMAND_TIMEOUT_VALUE_DEFAULT = 10000; } 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 e9403f12ba9..92d0a08d776 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 @@ -38,5 +38,7 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer { node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT); node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP, IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT); + node.putBoolean(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, false); + node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT); } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.java new file mode 100644 index 00000000000..ee19d3c3678 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2011 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.dsf.gdb.internal; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + + public static String CustomTimeoutsMap_Error_initializing_custom_timeouts; + + public static String CustomTimeoutsMap_Invalid_custom_timeout_data; + + public static String CustomTimeoutsMap_Invalid_custom_timeout_value; + + public static String GDBControl_Session_is_terminated; + static { + // initialize resource bundle + NLS.initializeMessages( Messages.class.getName(), Messages.class ); + } + + private Messages() { + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.properties new file mode 100644 index 00000000000..9a4e8c3dbbe --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/Messages.properties @@ -0,0 +1,15 @@ +####################################################################################### +# Copyright (c) 2011 Mentor Graphics 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 +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Mentor Graphics - Initial API and implementation +####################################################################################### + +CustomTimeoutsMap_Error_initializing_custom_timeouts=Error initializing custom timeouts +CustomTimeoutsMap_Invalid_custom_timeout_data=Invalid custom timeout data. +CustomTimeoutsMap_Invalid_custom_timeout_value=Invalid custom timeout value for '%s'. +GDBControl_Session_is_terminated=Session is terminated.\nReason: %s diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CustomTimeoutsMap.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CustomTimeoutsMap.java new file mode 100644 index 00000000000..503ec1a48c1 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CustomTimeoutsMap.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2011 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.dsf.gdb.service.command; + +import java.util.HashMap; +import java.util.Map; +import java.util.StringTokenizer; + +import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.gdb.internal.Messages; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; + +/** + * @since 4.1 + */ +public class CustomTimeoutsMap extends HashMap { + + public CustomTimeoutsMap() { + super(); + } + + public CustomTimeoutsMap( CustomTimeoutsMap map ) { + super( map ); + } + + private static final long serialVersionUID = -8281280275781904870L; + + public String getMemento() { + StringBuilder sb = new StringBuilder(); + for ( Map.Entry entry : entrySet() ) { + sb.append( entry.getKey() ); + sb.append( ',' ); + sb.append( entry.getValue().intValue() ); + sb.append( ';' ); + } + return sb.toString(); + } + + public void initializeFromMemento( String memento ) { + clear(); + StringTokenizer st = new StringTokenizer( memento, ";" ); //$NON-NLS-1$ + MultiStatus ms = new MultiStatus( GdbPlugin.PLUGIN_ID, 0, Messages.CustomTimeoutsMap_Error_initializing_custom_timeouts, null ); + while( st.hasMoreTokens() ) { + String token = st.nextToken(); + String[] tokenParts = token.split( "," ); //$NON-NLS-1$ + if ( tokenParts.length == 2 && tokenParts[0].length() > 0 && tokenParts[1].length() > 0 ) { + try { + put( tokenParts[0], Integer.valueOf( tokenParts[1] ) ); + } + catch( NumberFormatException e ) { + ms.add( new Status( + IStatus.ERROR, + GdbPlugin.PLUGIN_ID, + String.format( Messages.CustomTimeoutsMap_Invalid_custom_timeout_value, tokenParts[0] ) ) ); + } + } + else { + ms.add( new Status( + IStatus.ERROR, + GdbPlugin.PLUGIN_ID, + Messages.CustomTimeoutsMap_Invalid_custom_timeout_data ) ); + } + } + if ( !ms.isOK() ) { + GdbPlugin.getDefault().getLog().log( ms ); + } + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java index dd4b956a7b5..dbd6dc9cac3 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java @@ -30,6 +30,7 @@ import java.util.Properties; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor; import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DsfRunnable; @@ -43,10 +44,14 @@ import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; +import org.eclipse.cdt.dsf.debug.service.command.ICommandToken; +import org.eclipse.cdt.dsf.gdb.IGdbDebugConstants; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.gdb.internal.Messages; import org.eclipse.cdt.dsf.gdb.launching.FinalLaunchSequence; import org.eclipse.cdt.dsf.gdb.service.IGDBBackend; import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses; +import org.eclipse.cdt.dsf.gdb.service.command.GdbCommandTimeoutManager.ICommandTimeoutListener; import org.eclipse.cdt.dsf.mi.service.IMIBackend; import org.eclipse.cdt.dsf.mi.service.IMIBackend.BackendStateChangedEvent; import org.eclipse.cdt.dsf.mi.service.IMIBackend2; @@ -69,8 +74,10 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.IStatusHandler; import org.osgi.framework.BundleContext; /** @@ -82,6 +89,8 @@ import org.osgi.framework.BundleContext; */ public class GDBControl extends AbstractMIControl implements IGDBControl { + private static final int STATUS_CODE_COMMAND_TIMED_OUT = 20100; + /** * Event indicating that the back end process has started. */ @@ -104,6 +113,20 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { } } + private class TimeoutListener implements ICommandTimeoutListener { + + @Override + public void commandTimedOut(final ICommandToken token) { + getExecutor().execute(new DsfRunnable() { + + @Override + public void run() { + GDBControl.this.commandTimedOut(token); + } + }); + } + } + private GDBControlDMContext fControlDmc; private IGDBBackend fMIBackend; @@ -112,6 +135,10 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { private IEventProcessor fCLICommandProcessor; private AbstractCLIProcess fCLIProcess; + private GdbCommandTimeoutManager fCommandTimeoutManager; + + private ICommandTimeoutListener fTimeoutListener = new TimeoutListener(); + /** * GDBControl is only used for GDB earlier that 7.0. Although -list-features * is available in 6.8, it does not report anything we care about, so @@ -120,6 +147,14 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { private final List fFeatures = new ArrayList(); private Sequence fInitializationSequence; + + /** + * Indicator to distinguish whether this service is initialized. + * fInitializationSequence can not be used for this + * purpose because there is a period of time when the service is already + * initializing but the initialization sequence has not created yet. + */ + private boolean fInitialized = false; private boolean fTerminated; @@ -308,6 +343,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { @Override protected void handleCompleted() { fInitializationSequence = null; + fInitialized = true; if (!isCanceled()) { // Only set the status if the user has not cancelled the operation already. rm.setStatus(getStatus()); @@ -440,6 +476,33 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { } } + /** + * @since 4.1 + */ + protected class CommandTimeoutStep extends InitializationShutdownStep { + CommandTimeoutStep( Direction direction ) { + super( direction ); + } + + @Override + public void initialize( final RequestMonitor requestMonitor ) { + fCommandTimeoutManager = createCommandTimeoutManager( GDBControl.this ); + if (fCommandTimeoutManager != null) { + fCommandTimeoutManager.addCommandTimeoutListener(fTimeoutListener); + } + requestMonitor.done(); + } + + @Override + protected void shutdown( RequestMonitor requestMonitor ) { + if ( fCommandTimeoutManager != null ) { + fCommandTimeoutManager.removeCommandTimeoutListener(fTimeoutListener); + fCommandTimeoutManager.dispose(); + } + requestMonitor.done(); + } + } + protected class RegisterStep extends InitializationShutdownStep { RegisterStep(Direction direction) { super(direction); } @Override @@ -493,6 +556,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { final Sequence.Step[] initializeSteps = new Sequence.Step[] { new CommandMonitoringStep(InitializationShutdownStep.Direction.INITIALIZING), new CommandProcessorsStep(InitializationShutdownStep.Direction.INITIALIZING), + new CommandTimeoutStep(InitializationShutdownStep.Direction.INITIALIZING), new RegisterStep(InitializationShutdownStep.Direction.INITIALIZING), }; @@ -507,6 +571,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { protected Sequence getShutdownSequence(RequestMonitor requestMonitor) { final Sequence.Step[] shutdownSteps = new Sequence.Step[] { new RegisterStep(InitializationShutdownStep.Direction.SHUTTING_DOWN), + new CommandTimeoutStep(InitializationShutdownStep.Direction.SHUTTING_DOWN), new CommandProcessorsStep(InitializationShutdownStep.Direction.SHUTTING_DOWN), new CommandMonitoringStep(InitializationShutdownStep.Direction.SHUTTING_DOWN), }; @@ -536,4 +601,63 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { fFeatures.clear(); fFeatures.addAll(features); } + + /** + * @since 4.1 + */ + protected GdbCommandTimeoutManager createCommandTimeoutManager(ICommandControl commandControl) { + GdbCommandTimeoutManager manager = new GdbCommandTimeoutManager(commandControl); + manager.initialize(); + return manager; + } + + /** + * @since 4.1 + */ + @ConfinedToDsfExecutor("this.getExecutor()") + protected void commandTimedOut(ICommandToken token) { + String commandText = token.getCommand().toString(); + if (commandText.endsWith("\n")) //$NON-NLS-1$ + commandText = commandText.substring(0, commandText.length() - 1); + final String errorMessage = String.format("Command '%s' is timed out", commandText); //$NON-NLS-1$ + commandFailed(token, STATUS_CODE_COMMAND_TIMED_OUT, errorMessage); + + // If the timeout occurs while the launch sequence is running + // the error will be reported by the launcher's error reporting mechanism. + // We need to show the error message only when the session is initialized. + if (isInitialized()) { + // The session is terminated if a command is timed out. + terminate(new RequestMonitor(getExecutor(), null) { + + @Override + protected void handleErrorOrWarning() { + GdbPlugin.getDefault().getLog().log(getStatus()); + super.handleErrorOrWarning(); + }; + } ); + + IStatus status = new Status( + IStatus.ERROR, + GdbPlugin.PLUGIN_ID, + IGdbDebugConstants.STATUS_HANDLER_CODE, + String.format( Messages.GDBControl_Session_is_terminated, errorMessage ), + null); + IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(status); + if (statusHandler != null) { + try { + statusHandler.handleStatus(status, null); + } + catch(CoreException e) { + GdbPlugin.getDefault().getLog().log(e.getStatus()); + } + } + } + } + + /** + * @since 4.1 + */ + protected boolean isInitialized() { + return fInitialized; + } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java index 3a780424602..55f4aa15860 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java @@ -147,6 +147,7 @@ public class GDBControl_7_0 extends GDBControl { final Sequence.Step[] initializeSteps = new Sequence.Step[] { new GDBControl.CommandMonitoringStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING), new GDBControl.CommandProcessorsStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING), + new CommandTimeoutStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING), new ListFeaturesStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING), new GDBControl.RegisterStep(GDBControl.InitializationShutdownStep.Direction.INITIALIZING), }; @@ -161,6 +162,7 @@ public class GDBControl_7_0 extends GDBControl { final Sequence.Step[] shutdownSteps = new Sequence.Step[] { new GDBControl.RegisterStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN), new ListFeaturesStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN), + new CommandTimeoutStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN), new GDBControl.CommandProcessorsStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN), new GDBControl.CommandMonitoringStep(GDBControl.InitializationShutdownStep.Direction.SHUTTING_DOWN), }; diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GdbCommandTimeoutManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GdbCommandTimeoutManager.java new file mode 100644 index 00000000000..133865c1a95 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GdbCommandTimeoutManager.java @@ -0,0 +1,443 @@ +/******************************************************************************* + * Copyright (c) 2011 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.dsf.gdb.service.command; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; + +import org.eclipse.cdt.dsf.debug.service.command.ICommand; +import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; +import org.eclipse.cdt.dsf.debug.service.command.ICommandListener; +import org.eclipse.cdt.dsf.debug.service.command.ICommandResult; +import org.eclipse.cdt.dsf.debug.service.command.ICommandToken; +import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; +import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.mi.service.command.AbstractMIControl; +import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand; +import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; +import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; +import org.eclipse.core.runtime.preferences.InstanceScope; + +/** + * The command timeout manager registers itself as a command listener and monitors + * the command execution time. The goal of this implementation is to gracefully + * handle disruptions in the communication between Eclipse and GDB. + * + * The algorithm used by this class is based on the assumption that the command + * execution in GDB is sequential even though DSF can send up to 3 commands at + * a time to GDB (see {@link AbstractMIControl}). + * + * @since 4.1 + */ +public class GdbCommandTimeoutManager implements ICommandListener, IPreferenceChangeListener { + + public interface ICommandTimeoutListener { + + void commandTimedOut( ICommandToken token ); + } + + public final static boolean DEBUG = "true".equals( Platform.getDebugOption( "org.eclipse.cdt.dsf.gdb/debug/timeouts" ) ); //$NON-NLS-1$//$NON-NLS-2$ + + private class QueueEntry { + private long fTimestamp; + private ICommandToken fCommandToken; + + private QueueEntry( long timestamp, ICommandToken commandToken ) { + super(); + fTimestamp = timestamp; + fCommandToken = commandToken; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals( Object obj ) { + if ( obj instanceof QueueEntry ) { + return fCommandToken.equals( ((QueueEntry)obj).fCommandToken ); + } + return false; + } + } + + private enum TimerThreadState { + INITIALIZING, + RUNNING, + HALTED, + SHUTDOWN + } + + private class TimerThread extends Thread { + + private BlockingQueue fQueue; + private int fWaitTimeout = IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT; + private TimerThreadState fState = TimerThreadState.INITIALIZING; + + TimerThread( BlockingQueue queue, int timeout ) { + super(); + setName( "GDB Command Timer Thread" ); //$NON-NLS-1$ + fQueue = queue; + setWaitTimout( timeout ); + } + + /* (non-Javadoc) + * @see java.lang.Thread#run() + */ + @Override + public void run() { + setTimerThreadState( ( getWaitTimeout() > 0 ) ? + TimerThreadState.RUNNING : TimerThreadState.HALTED ); + doRun(); + } + + private void doRun() { + while ( getTimerThreadState() != TimerThreadState.SHUTDOWN ) { + if ( getTimerThreadState() == TimerThreadState.HALTED ) { + halted(); + } + else { + running(); + } + } + } + + private void halted() { + fQueue.clear(); + try { + synchronized( TimerThread.this ) { + wait(); + } + } + catch( InterruptedException e ) { + } + } + + private void running() { + try { + while( getTimerThreadState() == TimerThreadState.RUNNING ) { + // Use the minimum of all timeout values > 0 as the wait timeout. + long timeout = getWaitTimeout(); + QueueEntry entry = fQueue.peek(); + if ( entry != null ) { + // Calculate the time elapsed since the execution of this command started + // and compare it with the command's timeout value. + // If the elapsed time is greater or equal than the timeout value the command + // is marked as timed out. Otherwise, schedule the next check when the timeout + // expires. + long commandTimeout = getTimeoutForCommand( entry.fCommandToken.getCommand() ); + + if ( DEBUG ) { + String commandText = entry.fCommandToken.getCommand().toString(); + if ( commandText.endsWith( "\n" ) ) //$NON-NLS-1$ + commandText = commandText.substring( 0, commandText.length() - 1 ); + printDebugMessage( String.format( "Processing command '%s', command timeout is %d", //$NON-NLS-1$ + commandText, Long.valueOf( commandTimeout ) ) ); + } + + long currentTime = System.currentTimeMillis(); + long elapsedTime = currentTime - entry.fTimestamp; + if ( commandTimeout <= elapsedTime ) { + processTimedOutCommand( entry.fCommandToken ); + fQueue.remove( entry ); + // Reset the timestamp of the next command in the queue because + // regardless how long the command has been in the queue GDB will + // start executing it only when the execution of the previous command + // is completed. + QueueEntry nextEntry = fQueue.peek(); + if ( nextEntry != null ) { + setTimeStamp( currentTime, nextEntry ); + } + } + else { + // Adjust the wait timeout because the time remaining for + // the current command to expire may be less than the current wait timeout. + timeout = Math.min( timeout, commandTimeout - elapsedTime ); + + if ( DEBUG ) { + String commandText = entry.fCommandToken.getCommand().toString(); + if ( commandText.endsWith( "\n" ) ) //$NON-NLS-1$ + commandText = commandText.substring( 0, commandText.length() - 1 ); + printDebugMessage( String.format( "Setting timeout %d for command '%s'", Long.valueOf( timeout ), commandText ) ); //$NON-NLS-1$ + } + } + } + synchronized( TimerThread.this ) { + wait( timeout ); + } + } + } + catch( InterruptedException e ) { + } + } + + private void shutdown() { + setTimerThreadState( TimerThreadState.SHUTDOWN ); + } + + private synchronized void setWaitTimout( int waitTimeout ) { + fWaitTimeout = waitTimeout; + if ( DEBUG ) + printDebugMessage( String.format( "Wait timeout is set to %d", Integer.valueOf( fWaitTimeout ) ) ); //$NON-NLS-1$ + } + + private synchronized int getWaitTimeout() { + return fWaitTimeout; + } + + private synchronized void setTimerThreadState( TimerThreadState state ) { + fState = state; + interrupt(); + } + + private synchronized TimerThreadState getTimerThreadState() { + return fState; + } + } + + private static final String TIMEOUT_TRACE_IDENTIFIER = "[TMO]"; //$NON-NLS-1$ + + private ICommandControl fCommandControl; + private boolean fTimeoutEnabled = false; + private int fTimeout = 0; + private TimerThread fTimerThread; + private BlockingQueue fCommandQueue = new LinkedBlockingQueue(); + private CustomTimeoutsMap fCustomTimeouts = new CustomTimeoutsMap(); + + private ListenerList fListeners; + + public GdbCommandTimeoutManager( ICommandControl commandControl ) { + fCommandControl = commandControl; + fListeners = new ListenerList(); + } + + public void initialize() { + IEclipsePreferences node = InstanceScope.INSTANCE.getNode( GdbPlugin.PLUGIN_ID ); + + fTimeoutEnabled = Platform.getPreferencesService().getBoolean( + GdbPlugin.PLUGIN_ID, + IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, + false, + null ); + + fTimeout = Platform.getPreferencesService().getInt( + GdbPlugin.PLUGIN_ID, + IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, + IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT, + null ); + + fCustomTimeouts.initializeFromMemento( Platform.getPreferencesService().getString( + GdbPlugin.PLUGIN_ID, + IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS, + "", //$NON-NLS-1$ + null ) ); + + node.addPreferenceChangeListener( this ); + + fCommandControl.addCommandListener( this ); + + fTimerThread = new TimerThread( fCommandQueue, calculateWaitTimeout() ); + fTimerThread.start(); + } + + public void dispose() { + fTimerThread.shutdown(); + fListeners.clear(); + InstanceScope.INSTANCE.getNode( GdbPlugin.PLUGIN_ID ).removePreferenceChangeListener( this ); + fCommandControl.removeCommandListener( this ); + fCommandQueue.clear(); + fCustomTimeouts.clear(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.dsf.debug.service.command.ICommandListener#commandQueued(org.eclipse.cdt.dsf.debug.service.command.ICommandToken) + */ + @Override + public void commandQueued( ICommandToken token ) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.dsf.debug.service.command.ICommandListener#commandSent(org.eclipse.cdt.dsf.debug.service.command.ICommandToken) + */ + @Override + public void commandSent( ICommandToken token ) { + if ( !isTimeoutEnabled() ) + return; + int commandTimeout = getTimeoutForCommand( token.getCommand() ); + if ( DEBUG ) { + String commandText = token.getCommand().toString(); + if ( commandText.endsWith( "\n" ) ) //$NON-NLS-1$ + commandText = commandText.substring( 0, commandText.length() - 1 ); + printDebugMessage( String.format( "Command '%s' sent, timeout = %d", commandText, Integer.valueOf( commandTimeout ) ) ); //$NON-NLS-1$ + } + if ( commandTimeout == 0 ) + // Skip commands with no timeout + return; + try { + fCommandQueue.put( new QueueEntry( System.currentTimeMillis(), token ) ); + } + catch( InterruptedException e ) { + // ignore + } + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.dsf.debug.service.command.ICommandListener#commandRemoved(org.eclipse.cdt.dsf.debug.service.command.ICommandToken) + */ + @Override + public void commandRemoved( ICommandToken token ) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.dsf.debug.service.command.ICommandListener#commandDone(org.eclipse.cdt.dsf.debug.service.command.ICommandToken, org.eclipse.cdt.dsf.debug.service.command.ICommandResult) + */ + @Override + public void commandDone( ICommandToken token, ICommandResult result ) { + if ( !isTimeoutEnabled() ) + return; + fCommandQueue.remove( new QueueEntry( 0, token ) ); + if ( DEBUG ) { + String commandText = token.getCommand().toString(); + if ( commandText.endsWith( "\n" ) ) //$NON-NLS-1$ + commandText = commandText.substring( 0, commandText.length() - 1 ); + printDebugMessage( String.format( "Command '%s' is done", commandText ) ); //$NON-NLS-1$ + } + // Reset the timestamp of the next command in the queue because + // regardless how long it has been in the queue GDB will start + // executing it only when the execution of the previous command + // is completed. + QueueEntry nextEntry = fCommandQueue.peek(); + if ( nextEntry != null ) { + setTimeStamp( System.currentTimeMillis(), nextEntry ); + } + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent) + */ + @Override + public void preferenceChange( PreferenceChangeEvent event ) { + String property = event.getKey(); + if ( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT.equals( property ) ) { + // The new value is null when the timeout support is disabled. + if ( event.getNewValue() == null || !event.getNewValue().equals( event.getOldValue() ) ) { + fTimeoutEnabled = ( event.getNewValue() != null ) ? + Boolean.parseBoolean( event.getNewValue().toString() ) : Boolean.FALSE; + updateWaitTimeout(); + fTimerThread.setTimerThreadState( ( fTimerThread.getWaitTimeout() > 0 ) ? + TimerThreadState.RUNNING : TimerThreadState.HALTED ); + } + } + else if ( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE.equals( property ) ) { + if ( event.getNewValue() == null || !event.getNewValue().equals( event.getOldValue() ) ) { + try { + fTimeout = ( event.getNewValue() != null ) ? + Integer.parseInt( event.getNewValue().toString() ) : + IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT; + updateWaitTimeout(); + fTimerThread.setTimerThreadState( ( fTimerThread.getWaitTimeout() > 0 ) ? + TimerThreadState.RUNNING : TimerThreadState.HALTED ); + } + catch( NumberFormatException e ) { + GdbPlugin.getDefault().getLog().log( new Status( IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invlaid timeout value" ) ); //$NON-NLS-1$ + } + } + } + else if ( IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS.equals( property ) ) { + if ( event.getNewValue() instanceof String ) { + fCustomTimeouts.initializeFromMemento( (String)event.getNewValue() ); + } + else if ( event.getNewValue() == null ) { + fCustomTimeouts.clear(); + } + updateWaitTimeout(); + fTimerThread.setTimerThreadState( ( fTimerThread.getWaitTimeout() > 0 ) ? + TimerThreadState.RUNNING : TimerThreadState.HALTED ); + } + } + + protected int getTimeoutForCommand( ICommand command ) { + if ( !(command instanceof MICommand) ) + return 0; + @SuppressWarnings( "unchecked" ) + Integer timeout = fCustomTimeouts.get( ((MICommand)command).getOperation() ); + return ( timeout != null ) ? timeout.intValue() : fTimeout; + } + + protected void processTimedOutCommand( ICommandToken token ) { + if ( DEBUG ) { + String commandText = token.getCommand().toString(); + if ( commandText.endsWith( "\n" ) ) //$NON-NLS-1$ + commandText = commandText.substring( 0, commandText.length() - 1 ); + printDebugMessage( String.format( "Command '%s' is timed out", commandText ) ); //$NON-NLS-1$ + } + for ( Object l : fListeners.getListeners() ) { + ((ICommandTimeoutListener)l).commandTimedOut( token ); + } + } + + public void addCommandTimeoutListener( ICommandTimeoutListener listener ) { + fListeners.add( listener ); + } + + public void removeCommandTimeoutListener( ICommandTimeoutListener listener ) { + fListeners.remove( listener ); + } + + private void updateWaitTimeout() { + fTimerThread.setWaitTimout( calculateWaitTimeout() ); + } + + private boolean isTimeoutEnabled() { + return fTimeoutEnabled; + } + + private void printDebugMessage( String message ) { + System.out.println( String.format( "%s %s %s", GdbPlugin.getDebugTime(), TIMEOUT_TRACE_IDENTIFIER, message ) ); //$NON-NLS-1$ + } + + private int calculateWaitTimeout() { + int waitTimeout = 0; + if ( isTimeoutEnabled() ) { + waitTimeout = fTimeout; + int minCustomTimeout = Integer.MAX_VALUE; + for ( Integer t : fCustomTimeouts.values() ) { + if ( t.intValue() > 0 ) { + minCustomTimeout = Math.min( minCustomTimeout, t.intValue() ); + } + } + if ( minCustomTimeout > 0 ) { + waitTimeout = ( waitTimeout == 0 ) ? + minCustomTimeout : Math.min( waitTimeout, minCustomTimeout ); + } + } + return waitTimeout; + } + + private void setTimeStamp( long currentTime, QueueEntry nextEntry ) { + if ( nextEntry != null ) { + nextEntry.fTimestamp = currentTime; + + if ( DEBUG ) { + String commandText = nextEntry.fCommandToken.getCommand().toString(); + if ( commandText.endsWith( "\n" ) ) //$NON-NLS-1$ + commandText = commandText.substring( 0, commandText.length() - 1 ); + printDebugMessage( String.format( "Setting the timestamp for command '%s' to %d", commandText, Long.valueOf( currentTime ) ) ); //$NON-NLS-1$ + } + } + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java index eb2e702a877..6277fbb97ad 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java @@ -29,6 +29,7 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.RejectedExecutionException; +import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DsfRunnable; import org.eclipse.cdt.dsf.datamodel.DMContexts; @@ -874,6 +875,7 @@ public abstract class AbstractMIControl extends AbstractDsfService } void processMIOutput(String line) { + MIParser.RecordType recordType = fMiParser.getRecordType(line); if (recordType == MIParser.RecordType.ResultRecord) { @@ -885,6 +887,7 @@ public abstract class AbstractMIControl extends AbstractDsfService * some form of asynchronous notification. Or perhaps general IO. */ int id = rr.getToken(); + final CommandHandle commandHandle = fRxCommands.remove(id); if (commandHandle != null) { @@ -1098,4 +1101,46 @@ public abstract class AbstractMIControl extends AbstractDsfService fCurrentStackLevel = -1; } + /** + * @since 4.1 + */ + @ConfinedToDsfExecutor("this.getExecutor()") + protected void commandFailed(ICommandToken token, int statusCode, String errorMessage) { + if ( !(token instanceof CommandHandle && token.getCommand() instanceof MICommand) ) + return; + final CommandHandle commandHandle = (CommandHandle)token; + Integer tokenId = commandHandle.getTokenId(); + + // If the timeout value is too small a command can be timed out but still processed by RxThread. + // To avoid processing it twice we need to remove it from the command list. + CommandHandle h = fRxCommands.remove(tokenId); + if (h == null) + // Command has already been processed by RxThread. + return; + + MIConst value = new MIConst(); + value.setCString(errorMessage); + MIResult result = new MIResult(); + result.setVariable("msg"); //$NON-NLS-1$ + result.setMIValue(value); + MIResultRecord resultRecord = new MIResultRecord(); + resultRecord.setToken(tokenId.intValue()); + resultRecord.setResultClass(MIResultRecord.ERROR); + resultRecord.setMIResults(new MIResult[] { result }); + MIOutput miOutput = new MIOutput(resultRecord, new MIOOBRecord[0]); + + final MIInfo info = commandHandle.getCommand().getResult(miOutput); + DataRequestMonitor rm = commandHandle.getRequestMonitor(); + + if ( rm != null ) { + rm.setData(info); + rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, statusCode, errorMessage, null)); + rm.done(); + + /* + * Now tell the generic listeners about it. + */ + processCommandDone(commandHandle, info); + } + } } diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java index 797e4882983..7d20fe9db2c 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java @@ -91,6 +91,10 @@ public class BaseTestCase { launchAttributes.put(key, value); } + public static void removeLaunchAttribute(String key) { + launchAttributes.remove(key); + } + public static void setGlobalLaunchAttribute(String key, Object value) { globalLaunchAttributes.put(key, value); } @@ -206,7 +210,8 @@ public class BaseTestCase { .equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE); // First check if we should launch gdbserver in the case of a remote session - launchGdbServer(); + if (reallyLaunchGDBServer()) + launchGdbServer(); ILaunchManager launchMgr = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType lcType = launchMgr.getLaunchConfigurationType("org.eclipse.cdt.tests.dsf.gdb.TestLaunch"); @@ -332,4 +337,14 @@ public class BaseTestCase { BaseTestCase.setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb." + version + (isWindows ? ".exe" : "")); BaseTestCase.setLaunchAttribute(ATTR_DEBUG_SERVER_NAME, "gdbserver." + version + (isWindows ? ".exe" : "")); } + + /** + * In some tests we need to start a gdbserver session without starting gdbserver. + * This method allows super classes of this class control the launch of gdbserver. + * + * @return whether gdbserver should be started + */ + protected boolean reallyLaunchGDBServer() { + return true; + } } diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllTests.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllTests.java index 6f0319c88cf..5b00c8877b2 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllTests.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllTests.java @@ -38,6 +38,7 @@ import org.junit.runners.Suite; LaunchConfigurationAndRestartTest.class, OperationsWhileTargetIsRunningTest.class, PostMortemCoreTest.class, + CommandTimeoutTest.class, Suite_Sessionless_Tests.class, /* Add your suite class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java new file mode 100644 index 00000000000..065d6924c15 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java @@ -0,0 +1,143 @@ +/******************************************************************************* + * Copyright (c) 2012 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.tests.dsf.gdb.tests; + +import junit.framework.Assert; + +import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; +import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; +import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.debug.core.DebugException; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class CommandTimeoutTest extends BaseTestCase { + + private static boolean fgTimeoutEnabled = false; + private static int fgTimeout = IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT; + + @BeforeClass + public static void beforeClassMethod() { + // Save the original values of the timeout-related preferences + fgTimeoutEnabled = Platform.getPreferencesService().getBoolean( + GdbPlugin.PLUGIN_ID, + IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, + false, + null ); + fgTimeout = Platform.getPreferencesService().getInt( + GdbPlugin.PLUGIN_ID, + IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, + IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT, + null ); + } + + @Before + @Override + public void baseBeforeMethod() throws Exception { + } + + @After + @Override + public void baseAfterMethod() throws Exception { + // Restore the timeout preferences + IEclipsePreferences node = InstanceScope.INSTANCE.getNode( GdbPlugin.PLUGIN_ID ); + node.putBoolean( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, fgTimeoutEnabled ); + node.putInt( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, fgTimeout ); + } + + @Override + protected boolean reallyLaunchGDBServer() { + return false; + } + + /** + * Enables the timeout support and sets the timeout value to minimal - 1. + * Launch is expected to timeout on the first gdb command. + */ + @Test + public void firstCommandTimedOut() { + IEclipsePreferences node = InstanceScope.INSTANCE.getNode( GdbPlugin.PLUGIN_ID ); + node.putBoolean( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, true ); + node.putInt( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, 1 ); + + try { + performLaunchAndTerminate(); + Assert.fail( "Launch is expected to fail" ); + } + catch( Exception e ) { + processException( e ); + } + } + + /** + * Tries to connect to gdbserver without starting it. + * Launch is expected to timeout on "target-remote" command. + */ + @Test + public void remoteConnectionTimedOut() { + if ( !isRemoteSession() ) + return; + + IEclipsePreferences node = InstanceScope.INSTANCE.getNode( GdbPlugin.PLUGIN_ID ); + node.putBoolean( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, true ); + node.putInt( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, 1000 ); + + try { + performLaunchAndTerminate(); + Assert.fail( "Launch is expected to fail" ); + } + catch( Exception e ) { + processException( e ); + } + } + + private void performLaunchAndTerminate() throws Exception { + super.baseBeforeMethod(); + super.baseAfterMethod(); + } + + /** + * Checks whether the given exception is an instance of {@link CoreException} + * with the status code 20100 which indicates that a gdb command has been timed out. + */ + private void processException( Exception e ) { + if ( e instanceof DebugException ) { + Throwable t = getExceptionCause( e ); + Assert.assertTrue( + "Unexpected exception", + t instanceof CoreException && ((CoreException)t).getStatus().getCode() == 20100 ); + } + else { + Assert.fail( "Unexpected exception type" ); + } + } + + private Throwable getExceptionCause(Throwable e) { + Throwable current = e; + while ( current instanceof CoreException ) { + Throwable t = ((CoreException)current).getCause(); + if ( t == null ) + break; + current = t; + } + return current; + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/CommandTimeoutTest_6_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/CommandTimeoutTest_6_6.java new file mode 100644 index 00000000000..2f087862af3 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/CommandTimeoutTest_6_6.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2012 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_6; + +import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; +import org.eclipse.cdt.tests.dsf.gdb.tests.CommandTimeoutTest; +import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class CommandTimeoutTest_6_6 extends CommandTimeoutTest { + @BeforeClass + public static void beforeClassMethod_6_6() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_6_6); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java index 987092d6b6b..f83b1204c91 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java @@ -38,7 +38,8 @@ import org.junit.runners.Suite; LaunchConfigurationAndRestartTest_6_6.class, OperationsWhileTargetIsRunningTest_6_6.class, PostMortemCoreTest_6_6.class, - Suite_Sessionless_Tests.class + Suite_Sessionless_Tests.class, + CommandTimeoutTest_6_6.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_Remote_6_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_Remote_6_6.java index 19d259a4ff0..648d1c45677 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_Remote_6_6.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_Remote_6_6.java @@ -37,7 +37,8 @@ import org.junit.runners.Suite; MIDisassemblyTest_6_6.class, GDBProcessesTest_6_6.class, OperationsWhileTargetIsRunningTest_6_6.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_6_6.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/CommandTimeoutTest_6_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/CommandTimeoutTest_6_7.java new file mode 100644 index 00000000000..1ab85b63073 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/CommandTimeoutTest_6_7.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2012 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_7; + +import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; +import org.eclipse.cdt.tests.dsf.gdb.tests.CommandTimeoutTest; +import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class CommandTimeoutTest_6_7 extends CommandTimeoutTest { + @BeforeClass + public static void beforeClassMethod_6_7() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_6_7); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java index 3a58408147a..5b3bde605a5 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java @@ -38,7 +38,8 @@ import org.junit.runners.Suite; LaunchConfigurationAndRestartTest_6_7.class, OperationsWhileTargetIsRunningTest_6_7.class, PostMortemCoreTest_6_7.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_6_7.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_Remote_6_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_Remote_6_7.java index 504ca779574..9e5a278a1fe 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_Remote_6_7.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_Remote_6_7.java @@ -37,7 +37,8 @@ import org.junit.runners.Suite; MIDisassemblyTest_6_7.class, GDBProcessesTest_6_7.class, OperationsWhileTargetIsRunningTest_6_7.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_6_7.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/CommandTimeoutTest_6_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/CommandTimeoutTest_6_8.java new file mode 100644 index 00000000000..f8e57790df0 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/CommandTimeoutTest_6_8.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2012 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_8; + +import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; +import org.eclipse.cdt.tests.dsf.gdb.tests.CommandTimeoutTest; +import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class CommandTimeoutTest_6_8 extends CommandTimeoutTest { + @BeforeClass + public static void beforeClassMethod_6_8() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_6_8); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java index 6b2b75c984a..61f22592880 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java @@ -38,7 +38,8 @@ import org.junit.runners.Suite; LaunchConfigurationAndRestartTest_6_8.class, OperationsWhileTargetIsRunningTest_6_8.class, PostMortemCoreTest_6_8.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_6_8.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_Remote_6_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_Remote_6_8.java index 286ad3e06dc..b059d858228 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_Remote_6_8.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_Remote_6_8.java @@ -37,7 +37,8 @@ import org.junit.runners.Suite; MIDisassemblyTest_6_8.class, GDBProcessesTest_6_8.class, OperationsWhileTargetIsRunningTest_6_8.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_6_8.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/CommandTimeoutTest_7_0.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/CommandTimeoutTest_7_0.java new file mode 100644 index 00000000000..eb8c7759e0a --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/CommandTimeoutTest_7_0.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2012 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0; + +import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; +import org.eclipse.cdt.tests.dsf.gdb.tests.CommandTimeoutTest; +import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class CommandTimeoutTest_7_0 extends CommandTimeoutTest { + @BeforeClass + public static void beforeClassMethod_7_0() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_0); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java index 176b45b84f4..68d0e6843f1 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java @@ -40,7 +40,8 @@ import org.junit.runners.Suite; OperationsWhileTargetIsRunningTest_7_0.class, OperationsWhileTargetIsRunningNonStopTest_7_0.class, PostMortemCoreTest_7_0.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_7_0.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_Remote_7_0.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_Remote_7_0.java index 3869ccee90d..d267a011a74 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_Remote_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_Remote_7_0.java @@ -40,7 +40,8 @@ import org.junit.runners.Suite; GDBProcessesTest_7_0.class, OperationsWhileTargetIsRunningTest_7_0.class, OperationsWhileTargetIsRunningNonStopTest_7_0.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_7_0.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/CommandTimeoutTest_7_1.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/CommandTimeoutTest_7_1.java new file mode 100644 index 00000000000..b3de8a12d57 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/CommandTimeoutTest_7_1.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2012 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1; + +import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; +import org.eclipse.cdt.tests.dsf.gdb.tests.CommandTimeoutTest; +import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class CommandTimeoutTest_7_1 extends CommandTimeoutTest { + @BeforeClass + public static void beforeClassMethod_7_1() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_1); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java index c8717d34335..75b9b161c61 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java @@ -40,7 +40,8 @@ import org.junit.runners.Suite; OperationsWhileTargetIsRunningTest_7_1.class, OperationsWhileTargetIsRunningNonStopTest_7_1.class, PostMortemCoreTest_7_1.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_7_1.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_Remote_7_1.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_Remote_7_1.java index ac73aa23356..980446d4e95 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_Remote_7_1.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_Remote_7_1.java @@ -40,7 +40,8 @@ import org.junit.runners.Suite; GDBProcessesTest_7_1.class, OperationsWhileTargetIsRunningTest_7_1.class, OperationsWhileTargetIsRunningNonStopTest_7_1.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_7_1.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/CommandTimeoutTest_7_2.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/CommandTimeoutTest_7_2.java new file mode 100644 index 00000000000..6a88bcc8eea --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/CommandTimeoutTest_7_2.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2012 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2; + +import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; +import org.eclipse.cdt.tests.dsf.gdb.tests.CommandTimeoutTest; +import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class CommandTimeoutTest_7_2 extends CommandTimeoutTest { + @BeforeClass + public static void beforeClassMethod_7_2() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_2); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java index 45deeaa2853..800fe29a252 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java @@ -40,7 +40,8 @@ import org.junit.runners.Suite; OperationsWhileTargetIsRunningTest_7_2.class, OperationsWhileTargetIsRunningNonStopTest_7_2.class, PostMortemCoreTest_7_2.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_7_2.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_Remote_7_2.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_Remote_7_2.java index 48269bfc10b..32f2a1e7b89 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_Remote_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_Remote_7_2.java @@ -40,7 +40,8 @@ import org.junit.runners.Suite; GDBProcessesTest_7_2.class, OperationsWhileTargetIsRunningTest_7_2.class, OperationsWhileTargetIsRunningNonStopTest_7_2.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_7_2.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/CommandTimeoutTest_7_3.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/CommandTimeoutTest_7_3.java new file mode 100644 index 00000000000..624916380dc --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/CommandTimeoutTest_7_3.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2012 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3; + +import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; +import org.eclipse.cdt.tests.dsf.gdb.tests.CommandTimeoutTest; +import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class CommandTimeoutTest_7_3 extends CommandTimeoutTest { + @BeforeClass + public static void beforeClassMethod_7_3() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_3); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_7_3.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_7_3.java index 66843ec2753..65e39402046 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_7_3.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_7_3.java @@ -40,7 +40,8 @@ import org.junit.runners.Suite; OperationsWhileTargetIsRunningTest_7_3.class, OperationsWhileTargetIsRunningNonStopTest_7_3.class, PostMortemCoreTest_7_3.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_7_3.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_Remote_7_3.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_Remote_7_3.java index 5baac54dcf3..63e9e39e29a 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_Remote_7_3.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_Remote_7_3.java @@ -40,7 +40,8 @@ import org.junit.runners.Suite; GDBProcessesTest_7_3.class, OperationsWhileTargetIsRunningTest_7_3.class, OperationsWhileTargetIsRunningNonStopTest_7_3.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_7_3.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/CommandTimeoutTest_7_4.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/CommandTimeoutTest_7_4.java new file mode 100644 index 00000000000..3974aa66159 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/CommandTimeoutTest_7_4.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2012 Mentor Graphics 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Mentor Graphics - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4; + +import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; +import org.eclipse.cdt.tests.dsf.gdb.tests.CommandTimeoutTest; +import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class CommandTimeoutTest_7_4 extends CommandTimeoutTest { + @BeforeClass + public static void beforeClassMethod_7_4() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_7_4.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_7_4.java index 7f84cf16bb1..d2c7ea43ec1 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_7_4.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_7_4.java @@ -40,7 +40,8 @@ import org.junit.runners.Suite; OperationsWhileTargetIsRunningTest_7_4.class, OperationsWhileTargetIsRunningNonStopTest_7_4.class, PostMortemCoreTest_7_4.class, - Suite_Sessionless_Tests.class + CommandTimeoutTest_7_4.class, + Suite_Sessionless_Tests.class, /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_Remote_7_4.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_Remote_7_4.java index ce61ef09780..f76a836d040 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_Remote_7_4.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_Remote_7_4.java @@ -40,6 +40,7 @@ import org.junit.runners.Suite; GDBProcessesTest_7_4.class, OperationsWhileTargetIsRunningTest_7_4.class, OperationsWhileTargetIsRunningNonStopTest_7_4.class, + CommandTimeoutTest_7_4.class, Suite_Sessionless_Tests.class /* Add your test class here */ })