Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 234468 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java (-1 / +11 lines)
Lines 174-179 Link Here
174
				});
174
				});
175
    }
175
    }
176
176
177
	/**
178
	 * @since 2.0
179
	 */
177
	@Override
180
	@Override
178
	public void canResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
181
	public void canResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
179
		if (fGdb.getSessionType() == SessionType.CORE) {
182
		if (fGdb.getSessionType() == SessionType.CORE) {
Lines 184-189 Link Here
184
		super.canResume(context, rm);
187
		super.canResume(context, rm);
185
	}
188
	}
186
189
190
	
191
	/**
192
	 * @since 2.0
193
	 */
187
	@Override
194
	@Override
188
	public void canSuspend(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
195
	public void canSuspend(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
189
		if (fGdb.getSessionType() == SessionType.CORE) {
196
		if (fGdb.getSessionType() == SessionType.CORE) {
Lines 193-199 Link Here
193
		}
200
		}
194
		super.canSuspend(context, rm);
201
		super.canSuspend(context, rm);
195
	}
202
	}
196
203
	
204
	/**
205
	 * @since 2.0
206
	 */
197
	@Override
207
	@Override
198
	public void canStep(final IExecutionDMContext context, StepType stepType, final DataRequestMonitor<Boolean> rm) {
208
	public void canStep(final IExecutionDMContext context, StepType stepType, final DataRequestMonitor<Boolean> rm) {
199
		if (fGdb.getSessionType() == SessionType.CORE) {
209
		if (fGdb.getSessionType() == SessionType.CORE) {
(-)src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java (+9 lines)
Lines 189-194 Link Here
189
		}
189
		}
190
	}
190
	}
191
	
191
	
192
    /**
193
	 * @since 2.0
194
	 */
192
    @Override
195
    @Override
193
	public void canResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
196
	public void canResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
194
    	if (fGdb.getSessionType() == SessionType.CORE) {
197
    	if (fGdb.getSessionType() == SessionType.CORE) {
Lines 199-204 Link Here
199
    	super.canResume(context, rm);
202
    	super.canResume(context, rm);
200
    }
203
    }
201
    
204
    
205
    /**
206
	 * @since 2.0
207
	 */
202
    @Override
208
    @Override
203
	public void canSuspend(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
209
	public void canSuspend(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
204
    	if (fGdb.getSessionType() == SessionType.CORE) {
210
    	if (fGdb.getSessionType() == SessionType.CORE) {
Lines 209-214 Link Here
209
    	super.canSuspend(context, rm);
215
    	super.canSuspend(context, rm);
210
    }
216
    }
211
217
218
    /**
219
	 * @since 2.0
220
	 */
212
    @Override
221
    @Override
213
	public void canStep(final IExecutionDMContext context, StepType stepType, final DataRequestMonitor<Boolean> rm) {
222
	public void canStep(final IExecutionDMContext context, StepType stepType, final DataRequestMonitor<Boolean> rm) {
214
    	if (fGdb.getSessionType() == SessionType.CORE) {
223
    	if (fGdb.getSessionType() == SessionType.CORE) {
(-)src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java (+14 lines)
Lines 29-34 Link Here
29
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
29
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
30
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
30
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
31
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
31
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
32
import org.eclipse.cdt.dsf.gdb.IGdbDebugConstants;
32
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
33
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
33
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
34
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
34
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
35
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
Lines 37-42 Link Here
37
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
38
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
38
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
39
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
39
import org.eclipse.cdt.dsf.mi.service.IMIBackend.BackendStateChangedEvent;
40
import org.eclipse.cdt.dsf.mi.service.IMIBackend.BackendStateChangedEvent;
41
import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerExitedDMEvent;
40
import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerStartedDMEvent;
42
import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerStartedDMEvent;
41
import org.eclipse.cdt.dsf.mi.service.command.AbstractCLIProcess;
43
import org.eclipse.cdt.dsf.mi.service.command.AbstractCLIProcess;
42
import org.eclipse.cdt.dsf.mi.service.command.AbstractMIControl;
44
import org.eclipse.cdt.dsf.mi.service.command.AbstractMIControl;
Lines 59-64 Link Here
59
import org.eclipse.cdt.utils.pty.PTY;
61
import org.eclipse.cdt.utils.pty.PTY;
60
import org.eclipse.core.runtime.CoreException;
62
import org.eclipse.core.runtime.CoreException;
61
import org.eclipse.core.runtime.IStatus;
63
import org.eclipse.core.runtime.IStatus;
64
import org.eclipse.core.runtime.Platform;
62
import org.eclipse.core.runtime.Status;
65
import org.eclipse.core.runtime.Status;
63
import org.eclipse.debug.core.DebugException;
66
import org.eclipse.debug.core.DebugException;
64
import org.eclipse.debug.core.ILaunchConfiguration;
67
import org.eclipse.debug.core.ILaunchConfiguration;
Lines 404-409 Link Here
404
        }
407
        }
405
    }
408
    }
406
    
409
    
410
    /** @since 2.0 */
411
    @DsfServiceEventHandler 
412
    public void eventDispatched(ContainerExitedDMEvent e) {
413
    	if (Platform.getPreferencesService().getBoolean("org.eclipse.cdt.dsf.gdb.ui",  //$NON-NLS-1$
414
    													IGdbDebugConstants.PREF_AUTO_TERMINATE_GDB,
415
    													true, null)) {
416
    		// If the inferior finishes, let's terminate GDB
417
    		terminate(new RequestMonitor(getExecutor(), null));
418
    	}
419
    }
420
    
407
    public static class InitializationShutdownStep extends Sequence.Step {
421
    public static class InitializationShutdownStep extends Sequence.Step {
408
        public enum Direction { INITIALIZING, SHUTTING_DOWN }
422
        public enum Direction { INITIALIZING, SHUTTING_DOWN }
409
        
423
        
(-)src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java (+18 lines)
Lines 30-41 Link Here
30
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
30
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
31
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
31
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
32
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
32
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
33
import org.eclipse.cdt.dsf.gdb.IGdbDebugConstants;
33
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
34
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
34
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
35
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
35
import org.eclipse.cdt.dsf.gdb.service.GDBRunControl_7_0;
36
import org.eclipse.cdt.dsf.gdb.service.GDBRunControl_7_0;
36
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
37
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
37
import org.eclipse.cdt.dsf.gdb.service.IReverseRunControl;
38
import org.eclipse.cdt.dsf.gdb.service.IReverseRunControl;
38
import org.eclipse.cdt.dsf.gdb.service.SessionType;
39
import org.eclipse.cdt.dsf.gdb.service.SessionType;
40
import org.eclipse.cdt.dsf.gdb.service.GDBProcesses_7_0.ContainerExitedDMEvent;
39
import org.eclipse.cdt.dsf.mi.service.IMIBackend;
41
import org.eclipse.cdt.dsf.mi.service.IMIBackend;
40
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
42
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
41
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
43
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
Lines 61-66 Link Here
61
import org.eclipse.cdt.utils.pty.PTY;
63
import org.eclipse.cdt.utils.pty.PTY;
62
import org.eclipse.core.runtime.CoreException;
64
import org.eclipse.core.runtime.CoreException;
63
import org.eclipse.core.runtime.IStatus;
65
import org.eclipse.core.runtime.IStatus;
66
import org.eclipse.core.runtime.Platform;
64
import org.eclipse.core.runtime.Status;
67
import org.eclipse.core.runtime.Status;
65
import org.eclipse.debug.core.DebugException;
68
import org.eclipse.debug.core.DebugException;
66
import org.eclipse.debug.core.ILaunchConfiguration;
69
import org.eclipse.debug.core.ILaunchConfiguration;
Lines 542-547 Link Here
542
        }
545
        }
543
    }
546
    }
544
 
547
 
548
    /** @since 2.0 */
549
    @DsfServiceEventHandler 
550
    public void eventDispatched(ContainerExitedDMEvent e) {
551
    	if (Platform.getPreferencesService().getBoolean("org.eclipse.cdt.dsf.gdb.ui",  //$NON-NLS-1$
552
    													IGdbDebugConstants.PREF_AUTO_TERMINATE_GDB,
553
    													true, null)) {
554
    		if (!isConnected() && !fMIBackend.getIsAttachSession()) {
555
    			// If the last process we are debugging finishes, let's terminate GDB
556
    			// but not for an attach session, since we could request to attach
557
    			// to another process
558
    			terminate(new RequestMonitor(getExecutor(), null));
559
    		}
560
    	}
561
    }
562
    
545
    public static class InitializationShutdownStep extends Sequence.Step {
563
    public static class InitializationShutdownStep extends Sequence.Step {
546
        public enum Direction { INITIALIZING, SHUTTING_DOWN }
564
        public enum Direction { INITIALIZING, SHUTTING_DOWN }
547
        
565
        
(-)src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java (+40 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 Ericsson and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     Ericsson - initial implementation
10
 *******************************************************************************/
11
package org.eclipse.cdt.dsf.gdb;
12
13
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
14
15
16
17
/**
18
 * @noimplement This interface is not intended to be implemented by clients.
19
 * @since 2.0
20
 */
21
public interface IGdbDebugConstants {
22
	
23
	/**
24
	 * Boolean preference whether to enable GDB traces. Default is <code>true</code>. 
25
	 */
26
	public static final String PREF_TRACES_ENABLE = "tracesEnable"; //$NON-NLS-1$
27
28
	/**
29
	 * Boolean preference whether to automatically terminate GDB when the inferior exists. Default is <code>true</code>. 
30
	 */
31
	public static final String PREF_AUTO_TERMINATE_GDB = "autoTerminateGdb"; //$NON-NLS-1$
32
	
33
    /**
34
     * Help prefixes.
35
     */
36
    public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
37
    
38
    public static final String PREFERENCE_PAGE= PREFIX + "preference_page_context"; //$NON-NLS-1$
39
}
40
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java (+2 lines)
Lines 21-26 Link Here
21
	public static String GdbDebugPreferencePage_description;
21
	public static String GdbDebugPreferencePage_description;
22
	public static String GdbDebugPreferencePage_traces_label;
22
	public static String GdbDebugPreferencePage_traces_label;
23
	public static String GdbDebugPreferencePage_enableTraces_label;
23
	public static String GdbDebugPreferencePage_enableTraces_label;
24
	public static String GdbDebugPreferencePage_termination_label;
25
	public static String GdbDebugPreferencePage_autoTerminateGdb_label;
24
26
25
	static {
27
	static {
26
		// initialize resource bundle
28
		// initialize resource bundle
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java (-11 / +28 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
11
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
12
12
13
import org.eclipse.cdt.dsf.gdb.IGdbDebugConstants;
13
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
14
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
14
import org.eclipse.jface.preference.BooleanFieldEditor;
15
import org.eclipse.jface.preference.BooleanFieldEditor;
15
import org.eclipse.jface.preference.FieldEditorPreferencePage;
16
import org.eclipse.jface.preference.FieldEditorPreferencePage;
Lines 41-47 Link Here
41
	@Override
42
	@Override
42
	public void createControl(Composite parent) {
43
	public void createControl(Composite parent) {
43
		super.createControl(parent);
44
		super.createControl(parent);
44
		PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IGdbDebugPreferenceConstants.PREFERENCE_PAGE);
45
		PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IGdbDebugConstants.PREFERENCE_PAGE);
45
	}
46
	}
46
47
47
	@Override
48
	@Override
Lines 51-72 Link Here
51
		layout.marginWidth= 0;
52
		layout.marginWidth= 0;
52
		parent.setLayout(layout);
53
		parent.setLayout(layout);
53
		
54
		
54
		Group tracesGroup= new Group(parent, SWT.NONE);
55
		Group group= new Group(parent, SWT.NONE);
55
		tracesGroup.setText(MessagesForPreferences.GdbDebugPreferencePage_traces_label);
56
		group.setText(MessagesForPreferences.GdbDebugPreferencePage_traces_label);
56
		GridLayout groupLayout= new GridLayout(3, false);
57
		GridLayout groupLayout= new GridLayout(3, false);
57
		tracesGroup.setLayout(groupLayout);
58
		group.setLayout(groupLayout);
58
		tracesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
59
		group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
59
60
60
		BooleanFieldEditor traces= new BooleanFieldEditor(
61
		BooleanFieldEditor boolField= new BooleanFieldEditor(
61
				IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE,
62
				IGdbDebugConstants.PREF_TRACES_ENABLE,
62
				MessagesForPreferences.GdbDebugPreferencePage_enableTraces_label,
63
				MessagesForPreferences.GdbDebugPreferencePage_enableTraces_label,
63
				tracesGroup);
64
				group);
64
65
65
		traces.fillIntoGrid(tracesGroup, 3);
66
		boolField.fillIntoGrid(group, 3);
66
		addField(traces);
67
		addField(boolField);
68
		// need to set layout again
69
		group.setLayout(groupLayout);
70
		
71
		group= new Group(parent, SWT.NONE);
72
		group.setText(MessagesForPreferences.GdbDebugPreferencePage_termination_label);
73
		groupLayout= new GridLayout(3, false);
74
		group.setLayout(groupLayout);
75
		group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
76
77
		boolField= new BooleanFieldEditor(
78
				IGdbDebugConstants.PREF_AUTO_TERMINATE_GDB,
79
				MessagesForPreferences.GdbDebugPreferencePage_autoTerminateGdb_label,
80
				group);
67
81
82
		boolField.fillIntoGrid(group, 3);
83
		addField(boolField);
68
		// need to set layout again
84
		// need to set layout again
69
		tracesGroup.setLayout(groupLayout);
85
		group.setLayout(groupLayout);
86
70
	}
87
	}
71
88
72
	@Override
89
	@Override
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/messages.properties (+4 lines)
Lines 10-14 Link Here
10
###############################################################################
10
###############################################################################
11
11
12
GdbDebugPreferencePage_description=General settings for GDB Debugging
12
GdbDebugPreferencePage_description=General settings for GDB Debugging
13
13
GdbDebugPreferencePage_traces_label=Traces
14
GdbDebugPreferencePage_traces_label=Traces
14
GdbDebugPreferencePage_enableTraces_label=Enable GDB traces
15
GdbDebugPreferencePage_enableTraces_label=Enable GDB traces
16
17
GdbDebugPreferencePage_termination_label=Termination
18
GdbDebugPreferencePage_autoTerminateGdb_label=Automatically terminate GDB when inferior exits
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/IGdbDebugPreferenceConstants.java (+2 lines)
Lines 16-22 Link Here
16
/**
16
/**
17
 * @noimplement This interface is not intended to be implemented by clients.
17
 * @noimplement This interface is not intended to be implemented by clients.
18
 * @since 2.0
18
 * @since 2.0
19
 * @deprecated Has been replaced with org.eclipse.cdt.dsf.gdb.IGdbDebugConstants
19
 */
20
 */
21
@Deprecated
20
public interface IGdbDebugPreferenceConstants {
22
public interface IGdbDebugPreferenceConstants {
21
23
22
	/**
24
	/**
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbPreferenceInitializer.java (-1 / +3 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
11
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
12
12
13
import org.eclipse.cdt.dsf.gdb.IGdbDebugConstants;
13
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
14
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
14
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
15
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
15
import org.eclipse.jface.preference.IPreferenceStore;
16
import org.eclipse.jface.preference.IPreferenceStore;
Lines 21-26 Link Here
21
	@Override
22
	@Override
22
	public void initializeDefaultPreferences() {
23
	public void initializeDefaultPreferences() {
23
		IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
24
		IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
24
		store.setDefault(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE, true);
25
		store.setDefault(IGdbDebugConstants.PREF_TRACES_ENABLE, true);
26
		store.setDefault(IGdbDebugConstants.PREF_AUTO_TERMINATE_GDB, true);
25
	}
27
	}
26
}
28
}
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/tracing/TracingConsoleManager.java (-3 / +3 lines)
Lines 10-17 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.dsf.gdb.internal.ui.tracing;
11
package org.eclipse.cdt.dsf.gdb.internal.ui.tracing;
12
12
13
import org.eclipse.cdt.dsf.gdb.IGdbDebugConstants;
13
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
14
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
14
import org.eclipse.cdt.dsf.gdb.internal.ui.preferences.IGdbDebugPreferenceConstants;
15
import org.eclipse.cdt.dsf.gdb.launching.ITracedLaunch;
15
import org.eclipse.cdt.dsf.gdb.launching.ITracedLaunch;
16
import org.eclipse.debug.core.DebugPlugin;
16
import org.eclipse.debug.core.DebugPlugin;
17
import org.eclipse.debug.core.ILaunch;
17
import org.eclipse.debug.core.ILaunch;
Lines 43-49 Link Here
43
		GdbUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
43
		GdbUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
44
		
44
		
45
		IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
45
		IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
46
		fTracingEnabled = store.getBoolean(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE);
46
		fTracingEnabled = store.getBoolean(IGdbDebugConstants.PREF_TRACES_ENABLE);
47
		
47
		
48
		if (fTracingEnabled) {
48
		if (fTracingEnabled) {
49
			toggleTracing(true);
49
			toggleTracing(true);
Lines 104-110 Link Here
104
	}
104
	}
105
	
105
	
106
	public void propertyChange(PropertyChangeEvent event) {
106
	public void propertyChange(PropertyChangeEvent event) {
107
		if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE)) {
107
		if (event.getProperty().equals(IGdbDebugConstants.PREF_TRACES_ENABLE)) {
108
			fTracingEnabled = (Boolean)event.getNewValue();
108
			fTracingEnabled = (Boolean)event.getNewValue();
109
			toggleTracing(fTracingEnabled);
109
			toggleTracing(fTracingEnabled);
110
		}
110
		}

Return to bug 234468