1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Fix for PR 45533: MIException while creating MISession can leave an orphan gdb process.

This commit is contained in:
Mikhail Khodjaiants 2003-11-19 20:46:38 +00:00
parent 30d3f00aef
commit dc03462d49
5 changed files with 58 additions and 26 deletions

View file

@ -1,3 +1,10 @@
2003-11-19 Mikhail Khodjaiants
Fix for PR 45533: MIException while creating MISession can leave an orphan gdb process.
* src/org/eclipse/cdt/debug/mi/core/MIPlugin.java: initialization of preferences by default values.
* src/org/eclipse/cdt/debug/mi/core/MISession.java: removed the duplicate constant for the default
launch timeout value.
2003-11-13 Mikhail Khodjaiants 2003-11-13 Mikhail Khodjaiants
* src/org/eclipse/cdt/debug/mi/core/output/MIFrame.java * src/org/eclipse/cdt/debug/mi/core/output/MIFrame.java

View file

@ -378,7 +378,8 @@ public class MIPlugin extends Plugin {
* @see org.eclipse.core.runtime.Plugin#initializeDefaultPluginPrefrences() * @see org.eclipse.core.runtime.Plugin#initializeDefaultPluginPrefrences()
*/ */
protected void initializeDefaultPluginPreferences() { protected void initializeDefaultPluginPreferences() {
getPluginPreferences().setDefault(IMIConstants.PREF_REQUEST_TIMEOUT, MISession.REQUEST_TIMEOUT); getPluginPreferences().setDefault(IMIConstants.PREF_REQUEST_TIMEOUT, IMIConstants.DEF_REQUEST_TIMEOUT);
getPluginPreferences().setDefault(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, IMIConstants.DEF_REQUEST_LAUNCH_TIMEOUT);
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -44,11 +44,6 @@ public class MISession extends Observable {
*/ */
public final static int CORE = 2; public final static int CORE = 2;
/**
* Default wait() period for an answer after a query, 10 seconds.
*/
public static long REQUEST_TIMEOUT = 10000; // 10 * 1000 (~ 10 secs);
boolean terminated; boolean terminated;
// hold the type of the session(post-mortem, attach etc ..) // hold the type of the session(post-mortem, attach etc ..)

View file

@ -1,7 +1,13 @@
2003-11-19 Mikhail Khodjaiants
Fix for PR 45533: MIException while creating MISession can leave an orphan gdb process.
* src/org/eclipse/cdt/debug/mi/internal/ui/preferences/MIPreferencePage.java:
added a text field for the launch timeout.
2003-11-06 Alain Magloire 2003-11-06 Alain Magloire
Patch from Ashish Karkare(TimeSys) Patch from Ashish Karkare(TimeSys)
*src/org/eclipse/cdt/debug/mi/uui/internal/ui/GDBServerDebuggerPage.java *src/org/eclipse/cdt/debug/mi/internal/ui/GDBServerDebuggerPage.java
Add a new Combo that helps select a reasonable line speed, and storing Add a new Combo that helps select a reasonable line speed, and storing
the selected value as a configuration attribute. the selected value as a configuration attribute.

View file

@ -36,8 +36,11 @@ import org.eclipse.ui.help.WorkbenchHelp;
*/ */
public class MIPreferencePage extends PreferencePage implements IWorkbenchPreferencePage public class MIPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
{ {
// Timeout preference widgets // Debugger timeout preference widgets
IntegerFieldEditor fTimeoutText; IntegerFieldEditor fDebugTimeoutText;
// Launch timeout preference widgets
IntegerFieldEditor fLaunchTimeoutText;
/** /**
* Constructor for MIPreferencePage. * Constructor for MIPreferencePage.
@ -95,7 +98,8 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
*/ */
private void setValues() private void setValues()
{ {
fTimeoutText.setStringValue( new Integer( MIPlugin.getDefault().getPluginPreferences().getInt( IMIConstants.PREF_REQUEST_TIMEOUT ) ).toString() ); fDebugTimeoutText.setStringValue( new Integer( MIPlugin.getDefault().getPluginPreferences().getInt( IMIConstants.PREF_REQUEST_TIMEOUT ) ).toString() );
fLaunchTimeoutText.setStringValue( new Integer( MIPlugin.getDefault().getPluginPreferences().getInt( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT ) ).toString() );
} }
/** /**
@ -121,7 +125,8 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
private void setDefaultValues() private void setDefaultValues()
{ {
fTimeoutText.setStringValue( new Integer( IMIConstants.DEF_REQUEST_TIMEOUT ).toString() ); fDebugTimeoutText.setStringValue( new Integer( IMIConstants.DEF_REQUEST_TIMEOUT ).toString() );
fLaunchTimeoutText.setStringValue( new Integer( IMIConstants.DEF_REQUEST_LAUNCH_TIMEOUT ).toString() );
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -150,25 +155,25 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
data.horizontalSpan = 2; data.horizontalSpan = 2;
spacingComposite.setLayoutData( data ); spacingComposite.setLayoutData( data );
fTimeoutText = new IntegerFieldEditor( IMIConstants.PREF_REQUEST_TIMEOUT, "Debugger &timeout (ms):", spacingComposite ); fDebugTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_TIMEOUT, "&Debugger timeout (ms):", spacingComposite );
data = new GridData(); fDebugTimeoutText.setPropertyChangeListener(
data.widthHint = convertWidthInCharsToPixels( 10 );
fTimeoutText.getTextControl( spacingComposite ).setLayoutData( data );
fTimeoutText.setPreferenceStore( MIUIPlugin.getDefault().getPreferenceStore() );
fTimeoutText.setPreferencePage( this );
fTimeoutText.setValidateStrategy( StringFieldEditor.VALIDATE_ON_KEY_STROKE );
fTimeoutText.setValidRange( IMIConstants.MIN_REQUEST_TIMEOUT, IMIConstants.MAX_REQUEST_TIMEOUT );
String minValue = Integer.toString( IMIConstants.MIN_REQUEST_TIMEOUT );
String maxValue = Integer.toString( IMIConstants.MAX_REQUEST_TIMEOUT );
fTimeoutText.setErrorMessage( MessageFormat.format( "The valid value range is [{0},{1}].", new String[]{ minValue, maxValue } ) );
fTimeoutText.load();
fTimeoutText.setPropertyChangeListener(
new IPropertyChangeListener() new IPropertyChangeListener()
{ {
public void propertyChange( PropertyChangeEvent event ) public void propertyChange( PropertyChangeEvent event )
{ {
if ( event.getProperty().equals( FieldEditor.IS_VALID ) ) if ( event.getProperty().equals( FieldEditor.IS_VALID ) )
setValid( fTimeoutText.isValid() ); setValid( fDebugTimeoutText.isValid() );
}
} );
fLaunchTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, "&Launch &timeout (ms):", spacingComposite );
fLaunchTimeoutText.setPropertyChangeListener(
new IPropertyChangeListener()
{
public void propertyChange( PropertyChangeEvent event )
{
if ( event.getProperty().equals( FieldEditor.IS_VALID ) )
setValid( fLaunchTimeoutText.isValid() );
} }
} ); } );
} }
@ -179,6 +184,24 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
*/ */
private void storeValues() private void storeValues()
{ {
MIPlugin.getDefault().getPluginPreferences().setValue( IMIConstants.PREF_REQUEST_TIMEOUT, fTimeoutText.getIntValue() ); MIPlugin.getDefault().getPluginPreferences().setValue( IMIConstants.PREF_REQUEST_TIMEOUT, fDebugTimeoutText.getIntValue() );
MIPlugin.getDefault().getPluginPreferences().setValue( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, fLaunchTimeoutText.getIntValue() );
}
private IntegerFieldEditor createTimeoutField( String preference, String label, Composite parent )
{
IntegerFieldEditor toText = new IntegerFieldEditor( preference, label, parent );
GridData data = new GridData();
data.widthHint = convertWidthInCharsToPixels( 10 );
toText.getTextControl( parent ).setLayoutData( data );
toText.setPreferenceStore( MIUIPlugin.getDefault().getPreferenceStore() );
toText.setPreferencePage( this );
toText.setValidateStrategy( StringFieldEditor.VALIDATE_ON_KEY_STROKE );
toText.setValidRange( IMIConstants.MIN_REQUEST_TIMEOUT, IMIConstants.MAX_REQUEST_TIMEOUT );
String minValue = Integer.toString( IMIConstants.MIN_REQUEST_TIMEOUT );
String maxValue = Integer.toString( IMIConstants.MAX_REQUEST_TIMEOUT );
toText.setErrorMessage( MessageFormat.format( "The valid value range is [{0},{1}].", new String[]{ minValue, maxValue } ) );
toText.load();
return toText;
} }
} }