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

Collapse All | Expand All

(-)src/org/eclipse/dd/gdb/internal/provisional/service/command/GDBControl.java (-9 / +13 lines)
Lines 30-35 Link Here
30
import org.eclipse.core.runtime.IPath;
30
import org.eclipse.core.runtime.IPath;
31
import org.eclipse.core.runtime.IProgressMonitor;
31
import org.eclipse.core.runtime.IProgressMonitor;
32
import org.eclipse.core.runtime.IStatus;
32
import org.eclipse.core.runtime.IStatus;
33
import org.eclipse.core.runtime.Path;
33
import org.eclipse.core.runtime.Status;
34
import org.eclipse.core.runtime.Status;
34
import org.eclipse.core.runtime.jobs.Job;
35
import org.eclipse.core.runtime.jobs.Job;
35
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
36
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
Lines 43-48 Link Here
43
import org.eclipse.dd.dsf.service.DsfSession;
44
import org.eclipse.dd.dsf.service.DsfSession;
44
import org.eclipse.dd.gdb.internal.GdbPlugin;
45
import org.eclipse.dd.gdb.internal.GdbPlugin;
45
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
46
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
47
import org.eclipse.dd.gdb.internal.provisional.launching.LaunchUtils;
46
import org.eclipse.dd.mi.service.command.AbstractCLIProcess;
48
import org.eclipse.dd.mi.service.command.AbstractCLIProcess;
47
import org.eclipse.dd.mi.service.command.AbstractMIControl;
49
import org.eclipse.dd.mi.service.command.AbstractMIControl;
48
import org.eclipse.dd.mi.service.command.CLIEventProcessor;
50
import org.eclipse.dd.mi.service.command.CLIEventProcessor;
Lines 59-64 Link Here
59
import org.eclipse.dd.mi.service.command.output.MIBreakInsertInfo;
61
import org.eclipse.dd.mi.service.command.output.MIBreakInsertInfo;
60
import org.eclipse.dd.mi.service.command.output.MIInfo;
62
import org.eclipse.dd.mi.service.command.output.MIInfo;
61
import org.eclipse.debug.core.DebugException;
63
import org.eclipse.debug.core.DebugException;
64
import org.eclipse.debug.core.ILaunchConfiguration;
62
import org.osgi.framework.BundleContext;
65
import org.osgi.framework.BundleContext;
63
66
64
/**
67
/**
Lines 117-131 Link Here
117
        fControlDmc = new GDBControlDMContext(session.getId(), "gdbcontrol[" + ++fgInstanceCounter + "]"); //$NON-NLS-1$ //$NON-NLS-2$
120
        fControlDmc = new GDBControlDMContext(session.getId(), "gdbcontrol[" + ++fgInstanceCounter + "]"); //$NON-NLS-1$ //$NON-NLS-2$
118
    }
121
    }
119
122
120
    public void setGdbPath(IPath path) { fGdbPath = path; }
123
    public void initData(ILaunchConfiguration config) { 
121
124
        fSessionType = LaunchUtils.getSessionType(config);
122
    public void setExecPath(IPath path) { fExecPath = path; }
125
        fAttach = LaunchUtils.getIsAttach(config);
123
126
        fGdbPath = LaunchUtils.getGDBPath(config);
124
    public void setSessionType(SessionType type) { fSessionType = type; }
127
        try {
125
128
			fExecPath = LaunchUtils.verifyProgramPath(config, LaunchUtils.getCProject(config));
126
    public void setAttach(boolean attach) { fAttach = attach; }
129
		} catch (CoreException e) {
127
130
			fExecPath = new Path(""); //$NON-NLS-1$
128
    public void setLaunchTimeout(int timeout) { fGDBLaunchTimeout = timeout; }
131
		}
132
    }
129
133
130
    @Deprecated
134
    @Deprecated
131
    public GDBControl(DsfSession session, IPath gdbPath, IPath execPath, SessionType sessionType, boolean attach, int gdbLaunchTimeout) {
135
    public GDBControl(DsfSession session, IPath gdbPath, IPath execPath, SessionType sessionType, boolean attach, int gdbLaunchTimeout) {
(-)src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunchDelegate.java (-43 / +5 lines)
Lines 17-23 Link Here
17
17
18
import org.eclipse.cdt.core.model.ICModelMarker;
18
import org.eclipse.cdt.core.model.ICModelMarker;
19
import org.eclipse.cdt.core.model.ICProject;
19
import org.eclipse.cdt.core.model.ICProject;
20
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
21
import org.eclipse.core.resources.IMarker;
20
import org.eclipse.core.resources.IMarker;
22
import org.eclipse.core.resources.IProject;
21
import org.eclipse.core.resources.IProject;
23
import org.eclipse.core.resources.IResource;
22
import org.eclipse.core.resources.IResource;
Lines 88-95 Link Here
88
			return;
87
			return;
89
		}
88
		}
90
		
89
		
91
		SessionType sessionType = getSessionType(config);
90
		SessionType sessionType = LaunchUtils.getSessionType(config);
92
		boolean attach = getIsAttach(config);
91
		boolean attach = LaunchUtils.getIsAttach(config);
93
		
92
		
94
        final GdbLaunch launch = (GdbLaunch)l;
93
        final GdbLaunch launch = (GdbLaunch)l;
95
94
Lines 159-183 Link Here
159
		return new FinalLaunchSequence(executor, launch, type, attach);
158
		return new FinalLaunchSequence(executor, launch, type, attach);
160
	}
159
	}
161
	
160
	
162
	private SessionType getSessionType(ILaunchConfiguration config) {
161
163
    	try {
164
    		String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
165
    		if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
166
    			return SessionType.LOCAL;
167
    		} else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
168
    			return SessionType.LOCAL;
169
    		} else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
170
    			return SessionType.CORE;
171
    		} else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE)) {
172
    			return SessionType.REMOTE;
173
    		} else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH)) {
174
    		    return SessionType.REMOTE;
175
    	    }
176
    	} catch (CoreException e) {    		
177
    	}
178
    	return SessionType.LOCAL;
179
    }
180
    
181
	private boolean isNonStopSession(ILaunchConfiguration config) {
162
	private boolean isNonStopSession(ILaunchConfiguration config) {
182
		try {
163
		try {
183
			boolean nonStopMode = config.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
164
			boolean nonStopMode = config.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
Lines 187-217 Link Here
187
    	}
168
    	}
188
    	return false;
169
    	return false;
189
    }
170
    }
190
    
171
191
	private boolean getIsAttach(ILaunchConfiguration config) {
192
    	try {
193
    		String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
194
    		if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
195
    			return false;
196
    		} else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
197
    			return true;
198
    		} else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
199
    			return false;
200
    		} else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE)) {
201
    			return false;
202
    		} else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH)) {
203
    		    return true;
204
    	    }
205
    	} catch (CoreException e) {    		
206
    	}
207
    	return false;
208
    }
209
    
210
172
211
	@Override
173
	@Override
212
    public boolean preLaunchCheck(ILaunchConfiguration config, String mode, IProgressMonitor monitor) throws CoreException {
174
    public boolean preLaunchCheck(ILaunchConfiguration config, String mode, IProgressMonitor monitor) throws CoreException {
213
		// no pre launch check for core file
175
		// no pre launch check for core file
214
		if (mode.equals(ILaunchManager.DEBUG_MODE) && getSessionType(config) == SessionType.CORE) return true; 
176
		if (mode.equals(ILaunchManager.DEBUG_MODE) && LaunchUtils.getSessionType(config) == SessionType.CORE) return true; 
215
		
177
		
216
		return super.preLaunchCheck(config, mode, monitor);
178
		return super.preLaunchCheck(config, mode, monitor);
217
	}
179
	}
(-)src/org/eclipse/dd/gdb/internal/provisional/launching/LaunchUtils.java (+40 lines)
Lines 37-42 Link Here
37
import org.eclipse.core.runtime.Status;
37
import org.eclipse.core.runtime.Status;
38
import org.eclipse.dd.gdb.internal.GdbPlugin;
38
import org.eclipse.dd.gdb.internal.GdbPlugin;
39
import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
39
import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
40
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
40
import org.eclipse.debug.core.DebugException;
41
import org.eclipse.debug.core.DebugException;
41
import org.eclipse.debug.core.ILaunchConfiguration;
42
import org.eclipse.debug.core.ILaunchConfiguration;
42
43
Lines 227-231 Link Here
227
228
228
        return version;
229
        return version;
229
	}
230
	}
231
	
232
	public static boolean getIsAttach(ILaunchConfiguration config) {
233
    	try {
234
    		String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
235
    		if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
236
    			return false;
237
    		} else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
238
    			return true;
239
    		} else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
240
    			return false;
241
    		} else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE)) {
242
    			return false;
243
    		} else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH)) {
244
    		    return true;
245
    	    }
246
    	} catch (CoreException e) {    		
247
    	}
248
    	return false;
249
    }
250
	
251
	public static SessionType getSessionType(ILaunchConfiguration config) {
252
    	try {
253
    		String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
254
    		if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
255
    			return SessionType.LOCAL;
256
    		} else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
257
    			return SessionType.LOCAL;
258
    		} else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
259
    			return SessionType.CORE;
260
    		} else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE)) {
261
    			return SessionType.REMOTE;
262
    		} else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH)) {
263
    		    return SessionType.REMOTE;
264
    	    }
265
    	} catch (CoreException e) {    		
266
    	}
267
    	return SessionType.LOCAL;
268
    }
269
    
230
}
270
}
231
271
(-)src/org/eclipse/dd/gdb/internal/provisional/launching/ServicesLaunchSequence.java (-6 / +1 lines)
Lines 41-52 Link Here
41
                // Create the connection.
41
                // Create the connection.
42
                //
42
                //
43
                fCommandControl = fLaunch.getServiceFactory().createService(fSession, GDBControl.class);
43
                fCommandControl = fLaunch.getServiceFactory().createService(fSession, GDBControl.class);
44
44
                fCommandControl.initData(fLaunch.getLaunchConfiguration());
45
                fCommandControl.setAttach(fAttach);
46
                fCommandControl.setExecPath(fExecPath);
47
                fCommandControl.setGdbPath(LaunchUtils.getGDBPath(fLaunch.getLaunchConfiguration()));
48
                fCommandControl.setSessionType(fSessionType);
49
50
                fCommandControl.initialize(requestMonitor);
45
                fCommandControl.initialize(requestMonitor);
51
            }
46
            }
52
        },
47
        },

Return to bug 241985