1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug 326137: Allow DSF-GDB attach session to work without a project or binary.

This commit is contained in:
Marc Khouzam 2010-09-27 00:45:05 +00:00
parent 65b7d3b1fd
commit 9ebb65f407
4 changed files with 38 additions and 3 deletions

View file

@ -27,7 +27,7 @@
id="org.eclipse.cdt.dsf.gdb.launch.attachCLaunch"
type="org.eclipse.cdt.launch.attachLaunchType"
modes="debug"
delegate="org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate"
delegate="org.eclipse.cdt.dsf.gdb.launching.GdbAttachLaunchDelegate"
name="%launchDelegate.attach.name"
delegateDescription="%launchDelegate.attach.description"
sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"

View file

@ -0,0 +1,23 @@
/*******************************************************************************
* Copyright (c) 2010 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Ericsson - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.launching;
import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
@ThreadSafe
public class GdbAttachLaunchDelegate extends GdbLaunchDelegate
{
public GdbAttachLaunchDelegate() {
// For an attach session, we don't require a project
// to be specified
super(false);
}
}

View file

@ -61,6 +61,14 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
private final static String TRACING_FIRST_VERSION = "7.1.50"; //$NON-NLS-1$
private boolean fIsPostMortemTracingSession;
public GdbLaunchDelegate() {
super();
}
public GdbLaunchDelegate(boolean requireCProject) {
super(requireCProject);
}
@Override
public void launch( ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor ) throws CoreException {
org.eclipse.cdt.launch.LaunchUtils.enableActivity("org.eclipse.cdt.debug.dsfgdbActivity", true); //$NON-NLS-1$

View file

@ -358,9 +358,13 @@ public class LaunchUtils {
public static String[] getLaunchEnvironment(ILaunchConfiguration config) throws CoreException {
// Get the project
String projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
if (projectName == null)
if (projectName == null) {
return null;
}
projectName = projectName.trim();
if (projectName.length() == 0) {
return null;
}
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
if (project == null || !project.isAccessible())
return null;