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/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.IGdbDebugPreferenceConstants;
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
    													IGdbDebugPreferenceConstants.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 (+29 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.IGdbDebugPreferenceConstants;
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;
41
import org.eclipse.cdt.dsf.gdb.service.GDBProcesses_7_0.ContainerStartedDMEvent;
39
import org.eclipse.cdt.dsf.mi.service.IMIBackend;
42
import org.eclipse.cdt.dsf.mi.service.IMIBackend;
40
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
43
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
41
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
44
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
Lines 61-66 Link Here
61
import org.eclipse.cdt.utils.pty.PTY;
64
import org.eclipse.cdt.utils.pty.PTY;
62
import org.eclipse.core.runtime.CoreException;
65
import org.eclipse.core.runtime.CoreException;
63
import org.eclipse.core.runtime.IStatus;
66
import org.eclipse.core.runtime.IStatus;
67
import org.eclipse.core.runtime.Platform;
64
import org.eclipse.core.runtime.Status;
68
import org.eclipse.core.runtime.Status;
65
import org.eclipse.debug.core.DebugException;
69
import org.eclipse.debug.core.DebugException;
66
import org.eclipse.debug.core.ILaunchConfiguration;
70
import org.eclipse.debug.core.ILaunchConfiguration;
Lines 542-547 Link Here
542
        }
546
        }
543
    }
547
    }
544
 
548
 
549
    /** @since 2.0 */
550
    @DsfServiceEventHandler 
551
    public void eventDispatched(ContainerStartedDMEvent e) {
552
    	setConnected(true);
553
    }
554
555
    /** @since 2.0 */
556
    @DsfServiceEventHandler 
557
    public void eventDispatched(ContainerExitedDMEvent e) {
558
    	setConnected(false);
559
    	
560
    	if (Platform.getPreferencesService().getBoolean("org.eclipse.cdt.dsf.gdb.ui",  //$NON-NLS-1$
561
    													IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB,
562
    													true, null)) {
563
    		if (!isConnected() && 
564
    				!(fMIBackend.getIsAttachSession() && 
565
    				  fMIBackend.getSessionType() == SessionType.REMOTE)) {
566
    			// If the last process we are debugging finishes, let's terminate GDB
567
    			// but not for a remote attach session, since we could request to attach
568
    			// to another process
569
    			terminate(new RequestMonitor(getExecutor(), null));
570
    		}
571
    	}
572
    }
573
    
545
    public static class InitializationShutdownStep extends Sequence.Step {
574
    public static class InitializationShutdownStep extends Sequence.Step {
546
        public enum Direction { INITIALIZING, SHUTTING_DOWN }
575
        public enum Direction { INITIALIZING, SHUTTING_DOWN }
547
        
576
        
(-)src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java (-6 lines)
Lines 850-858 Link Here
850
    @DsfServiceEventHandler
850
    @DsfServiceEventHandler
851
    public void eventDispatched(IStartedDMEvent e) {
851
    public void eventDispatched(IStartedDMEvent e) {
852
    	if (e instanceof ContainerStartedDMEvent) {
852
    	if (e instanceof ContainerStartedDMEvent) {
853
			// This will increment the connect count
854
			fCommandControl.setConnected(true);
855
856
    		fContainerCommandCache.reset();
853
    		fContainerCommandCache.reset();
857
    	} else {
854
    	} else {
858
    		fThreadCommandCache.reset();
855
    		fThreadCommandCache.reset();
Lines 863-871 Link Here
863
    @DsfServiceEventHandler
860
    @DsfServiceEventHandler
864
    public void eventDispatched(IExitedDMEvent e) {
861
    public void eventDispatched(IExitedDMEvent e) {
865
    	if (e instanceof ContainerExitedDMEvent) {
862
    	if (e instanceof ContainerExitedDMEvent) {
866
			// This will decrement the connect count
867
			fCommandControl.setConnected(false);
868
869
    		fContainerCommandCache.reset();
863
    		fContainerCommandCache.reset();
870
    	} else {
864
    	} else {
871
    		fThreadCommandCache.reset();
865
    		fThreadCommandCache.reset();
(-)src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.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 IGdbDebugPreferenceConstants {
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/tracing/TracingConsoleManager.java (-1 / +1 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.IGdbDebugPreferenceConstants;
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;
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbPreferenceInitializer.java (+2 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.IGdbDebugPreferenceConstants;
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 22-26 Link Here
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(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE, true);
26
		store.setDefault(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
25
	}
27
	}
26
}
28
}
(-)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.IGdbDebugPreferenceConstants
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/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/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=Terminate GDB when last process exits
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java (-9 / +26 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.IGdbDebugPreferenceConstants;
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 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
				IGdbDebugPreferenceConstants.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
				IGdbDebugPreferenceConstants.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

Return to bug 234468