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 338136 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java (+6 lines)
Lines 38-43 Link Here
38
	public static final String PREF_AUTO_TERMINATE_GDB = "autoTerminateGdb"; //$NON-NLS-1$
38
	public static final String PREF_AUTO_TERMINATE_GDB = "autoTerminateGdb"; //$NON-NLS-1$
39
39
40
	/**
40
	/**
41
	 * Boolean preference whether to show inferior processes in the debug view. Default is <code>true</code>. 
42
	 * @since 4.0
43
	 */
44
	public static final String PREF_SHOW_INFERIORS = "showInferiors"; //$NON-NLS-1$
45
46
	/**
41
	 * Boolean preference whether to use the advanced Inspect debug text hover. Default is <code>true</code>. 
47
	 * Boolean preference whether to use the advanced Inspect debug text hover. Default is <code>true</code>. 
42
	 * @since 3.0
48
	 * @since 3.0
43
	 */
49
	 */
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java (+16 lines)
Lines 177-182 Link Here
177
		group.setLayout(groupLayout);
177
		group.setLayout(groupLayout);
178
178
179
		group= new Group(parent, SWT.NONE);
179
		group= new Group(parent, SWT.NONE);
180
		group.setText(MessagesForPreferences.GdbDebugPreferencePage_display_label);
181
		groupLayout= new GridLayout(3, false);
182
		group.setLayout(groupLayout);
183
		group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
184
185
		boolField= new BooleanFieldEditor(
186
				IGdbDebugPreferenceConstants.PREF_SHOW_INFERIORS,
187
				MessagesForPreferences.GdbDebugPreferencePage_showInferiors_label,
188
				group);
189
190
		boolField.fillIntoGrid(group, 3);
191
		addField(boolField);
192
		// need to set layout again
193
		group.setLayout(groupLayout);
194
195
		group= new Group(parent, SWT.NONE);
180
		group.setText(MessagesForPreferences.GdbDebugPreferencePage_hover_label);
196
		group.setText(MessagesForPreferences.GdbDebugPreferencePage_hover_label);
181
		groupLayout= new GridLayout(3, false);
197
		groupLayout= new GridLayout(3, false);
182
		group.setLayout(groupLayout);
198
		group.setLayout(groupLayout);
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbPreferenceInitializer.java (+1 lines)
Lines 27-32 Link Here
27
		store.setDefault(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE, true);
27
		store.setDefault(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE, true);
28
		store.setDefault(IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES, 500000);
28
		store.setDefault(IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES, 500000);
29
		store.setDefault(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
29
		store.setDefault(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
30
		store.setDefault(IGdbDebugPreferenceConstants.PREF_SHOW_INFERIORS, true);
30
		store.setDefault(IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER, true);
31
		store.setDefault(IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER, true);
31
		store.setDefault(IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING, true);
32
		store.setDefault(IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING, true);
32
		store.setDefault(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, 100);
33
		store.setDefault(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, 100);
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java (+4 lines)
Lines 24-29 Link Here
24
	public static String GdbDebugPreferencePage_maxGdbTraces_label;
24
	public static String GdbDebugPreferencePage_maxGdbTraces_label;
25
	public static String GdbDebugPreferencePage_termination_label;
25
	public static String GdbDebugPreferencePage_termination_label;
26
	public static String GdbDebugPreferencePage_autoTerminateGdb_label;
26
	public static String GdbDebugPreferencePage_autoTerminateGdb_label;
27
	/** @since 2.2 */
28
	public static String GdbDebugPreferencePage_display_label;
29
	/** @since 2.2 */
30
	public static String GdbDebugPreferencePage_showInferiors_label;
27
	public static String GdbDebugPreferencePage_hover_label;
31
	public static String GdbDebugPreferencePage_hover_label;
28
	public static String GdbDebugPreferencePage_useInspectorHover_label;
32
	public static String GdbDebugPreferencePage_useInspectorHover_label;
29
	/** @since 2.2 */
33
	/** @since 2.2 */
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties (-1 / +2 lines)
Lines 17-23 Link Here
17
GdbDebugPreferencePage_maxGdbTraces_label=Limit GDB traces output (number of characters):
17
GdbDebugPreferencePage_maxGdbTraces_label=Limit GDB traces output (number of characters):
18
GdbDebugPreferencePage_termination_label=Termination
18
GdbDebugPreferencePage_termination_label=Termination
19
GdbDebugPreferencePage_autoTerminateGdb_label=Terminate GDB when last process exits
19
GdbDebugPreferencePage_autoTerminateGdb_label=Terminate GDB when last process exits
20
20
GdbDebugPreferencePage_display_label=Display
21
GdbDebugPreferencePage_showInferiors_label=Show inferiors in the debug view
21
GdbDebugPreferencePage_hover_label=Debug Text Hover
22
GdbDebugPreferencePage_hover_label=Debug Text Hover
22
GdbDebugPreferencePage_useInspectorHover_label=Use enhanced debug hover
23
GdbDebugPreferencePage_useInspectorHover_label=Use enhanced debug hover
23
24
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbStandardProcessVMNode.java (+200 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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 API and implementation
10
 *******************************************************************************/
11
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
12
13
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
14
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.StandardProcessVMNode;
15
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
16
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
17
import org.eclipse.cdt.dsf.gdb.launching.GDBProcess;
18
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMProvider;
19
import org.eclipse.cdt.dsf.ui.viewmodel.VMDelta;
20
import org.eclipse.debug.core.DebugEvent;
21
import org.eclipse.debug.core.ILaunch;
22
import org.eclipse.debug.core.model.IProcess;
23
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
24
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
25
import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate;
26
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
27
import org.eclipse.jface.preference.IPreferenceStore;
28
import org.eclipse.jface.util.IPropertyChangeListener;
29
import org.eclipse.jface.util.PropertyChangeEvent;
30
import org.eclipse.jface.viewers.TreePath;
31
32
/**
33
 * Layout node for the standard platform debug model IProcess object. This 
34
 * node requires that an ILaunch object be found as an ancestor of this node.  
35
 * It does not implement the label provider functionality, so the default 
36
 * adapters should be used to retrieve the label.  
37
 */
38
public class GdbStandardProcessVMNode extends StandardProcessVMNode {
39
    
40
	private Class<?> fProcessType = IProcess.class;
41
	
42
	private IPropertyChangeListener fPropertyListener = new IPropertyChangeListener() {
43
		public void propertyChange(PropertyChangeEvent event) {
44
			if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_SHOW_INFERIORS)) {
45
				showInferiors((Boolean)event.getNewValue());
46
				// khouzam, need to refresh the debug view...				
47
			}
48
		}
49
	};
50
	
51
    public GdbStandardProcessVMNode(AbstractVMProvider provider) {
52
        super(provider);
53
54
        IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
55
		showInferiors(store.getBoolean(IGdbDebugPreferenceConstants.PREF_SHOW_INFERIORS));
56
		store.addPropertyChangeListener(fPropertyListener);
57
    }
58
    
59
    @Override
60
    public String toString() {
61
        return "GdbStandardProcessVMNode";  //$NON-NLS-1$ 
62
    }
63
64
    @Override
65
    public void dispose() {
66
		GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyListener);
67
		super.dispose();
68
    }
69
    
70
    
71
    private void showInferiors(boolean show) {
72
		if (show) {
73
			fProcessType = IProcess.class;
74
		} else {
75
			fProcessType = GDBProcess.class;
76
		}    	
77
    }
78
	
79
    @Override
80
    public void update(IChildrenUpdate[] updates) {
81
        for (IChildrenUpdate update : updates) {
82
            ILaunch launch = findLaunch(update.getElementPath());
83
            if (launch == null) {
84
                // There is no launch in the parent of this node.  This means that the 
85
                // layout is misconfigured.  
86
                assert false; 
87
                update.done();
88
                continue;
89
            }
90
            
91
            /*
92
             * Assume that the process objects are stored within the launch, and 
93
             * retrieve them on dispatch thread.  
94
             */
95
            int count = 0;
96
            for (IProcess process : launch.getProcesses()) {
97
            	if (fProcessType.isAssignableFrom(process.getClass())) {
98
            		update.setChild(process, count++);
99
            	}
100
            }
101
            update.done();
102
        }
103
    }
104
    
105
    @Override
106
    public void update(final IChildrenCountUpdate[] updates) {
107
        for (IChildrenCountUpdate update : updates) {
108
            if (!checkUpdate(update)) continue;
109
            ILaunch launch = findLaunch(update.getElementPath());
110
            if (launch == null) {
111
                assert false;
112
                update.setChildCount(0);
113
                update.done();
114
                return;
115
            }
116
    
117
            int count = 0;
118
            for (IProcess process : launch.getProcesses()) {
119
            	if (fProcessType.isAssignableFrom(process.getClass())) {
120
            		count++;
121
            	}
122
            }
123
            update.setChildCount(count);
124
            update.done();
125
        }
126
    }
127
128
    // @see org.eclipse.cdt.dsf.ui.viewmodel.IViewModelLayoutNode#hasElements(org.eclipse.cdt.dsf.ui.viewmodel.IVMContext, org.eclipse.cdt.dsf.concurrent.DataRequestMonitor)
129
    @Override
130
    public void update(IHasChildrenUpdate[] updates) {
131
        for (IHasChildrenUpdate update : updates) {
132
            ILaunch launch = findLaunch(update.getElementPath());
133
            if (launch == null) {
134
                assert false;
135
                update.setHasChilren(false);
136
                update.done();
137
                return;
138
            }
139
    
140
            boolean hasChildren = false;
141
            for (IProcess process : launch.getProcesses()) {
142
            	if (fProcessType.isAssignableFrom(process.getClass())) {
143
            		hasChildren = true;
144
            		break;
145
            	}
146
            }
147
            
148
            update.setHasChilren(hasChildren);
149
            update.done();
150
        }
151
    }
152
153
    /**
154
     * Recursively searches the VMC for Launch VMC, and returns its ILaunch.  
155
     * Returns null if an ILaunch is not found.
156
     */
157
    private ILaunch findLaunch(TreePath path) {
158
        for (int i = path.getSegmentCount() - 1; i >= 0; i--) {
159
            if (path.getSegment(i) instanceof ILaunch) {
160
                return (ILaunch)path.getSegment(i);
161
            }
162
        }
163
        return null;
164
    }
165
    
166
    @Override
167
    public int getDeltaFlags(Object e) {
168
        int myFlags = 0;
169
        if (e instanceof DebugEvent) {
170
            DebugEvent de = (DebugEvent)e;
171
            if (fProcessType.isAssignableFrom(de.getSource().getClass()) && 
172
                 (de.getKind() == DebugEvent.CHANGE || 
173
                  de.getKind() == DebugEvent.CREATE || 
174
                  de.getKind() == DebugEvent.TERMINATE) )
175
            {
176
                myFlags = IModelDelta.STATE;
177
            }
178
        }
179
        return myFlags;
180
    }
181
    
182
    @Override
183
    public void buildDelta(Object e, VMDelta parent, int nodeOffset, RequestMonitor requestMonitor) {
184
        if (e instanceof DebugEvent && fProcessType.isAssignableFrom(((DebugEvent)e).getSource().getClass())) {
185
            DebugEvent de = (DebugEvent)e;
186
            if (de.getKind() == DebugEvent.CHANGE) {
187
                handleChange(de, parent);
188
            } else if (de.getKind() == DebugEvent.CREATE) {
189
                handleCreate(de, parent);
190
            } else if (de.getKind() == DebugEvent.TERMINATE) {
191
                handleTerminate(de, parent);
192
            }
193
            /*
194
             * No other node should need to process events related to process.
195
             * Therefore, just invoke the request monitor without calling super.buildDelta().
196
             */
197
        } 
198
        requestMonitor.done();
199
    }
200
}
(-)src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java (-2 / +1 lines)
Lines 25-31 Link Here
25
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractLaunchVMProvider;
25
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractLaunchVMProvider;
26
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.LaunchRootVMNode;
26
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.LaunchRootVMNode;
27
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.StackFramesVMNode;
27
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.StackFramesVMNode;
28
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.StandardProcessVMNode;
29
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
28
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
30
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITracingStartedDMEvent;
29
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITracingStartedDMEvent;
31
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITracingStoppedDMEvent;
30
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITracingStoppedDMEvent;
Lines 56-62 Link Here
56
55
57
        // Container node to contain all processes and threads
56
        // Container node to contain all processes and threads
58
        IVMNode containerNode = new ContainerVMNode(this, getSession());
57
        IVMNode containerNode = new ContainerVMNode(this, getSession());
59
        IVMNode processesNode = new StandardProcessVMNode(this);
58
        IVMNode processesNode = new GdbStandardProcessVMNode(this);
60
        addChildNodes(launchNode, new IVMNode[] { containerNode, processesNode});
59
        addChildNodes(launchNode, new IVMNode[] { containerNode, processesNode});
61
        
60
        
62
        IVMNode threadsNode = new ThreadVMNode(this, getSession());
61
        IVMNode threadsNode = new ThreadVMNode(this, getSession());

Return to bug 338136