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:
parent
65b7d3b1fd
commit
9ebb65f407
4 changed files with 38 additions and 3 deletions
|
@ -27,7 +27,7 @@
|
||||||
id="org.eclipse.cdt.dsf.gdb.launch.attachCLaunch"
|
id="org.eclipse.cdt.dsf.gdb.launch.attachCLaunch"
|
||||||
type="org.eclipse.cdt.launch.attachLaunchType"
|
type="org.eclipse.cdt.launch.attachLaunchType"
|
||||||
modes="debug"
|
modes="debug"
|
||||||
delegate="org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate"
|
delegate="org.eclipse.cdt.dsf.gdb.launching.GdbAttachLaunchDelegate"
|
||||||
name="%launchDelegate.attach.name"
|
name="%launchDelegate.attach.name"
|
||||||
delegateDescription="%launchDelegate.attach.description"
|
delegateDescription="%launchDelegate.attach.description"
|
||||||
sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
|
sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -61,6 +61,14 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
|
||||||
private final static String TRACING_FIRST_VERSION = "7.1.50"; //$NON-NLS-1$
|
private final static String TRACING_FIRST_VERSION = "7.1.50"; //$NON-NLS-1$
|
||||||
private boolean fIsPostMortemTracingSession;
|
private boolean fIsPostMortemTracingSession;
|
||||||
|
|
||||||
|
public GdbLaunchDelegate() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GdbLaunchDelegate(boolean requireCProject) {
|
||||||
|
super(requireCProject);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void launch( ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor ) throws CoreException {
|
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$
|
org.eclipse.cdt.launch.LaunchUtils.enableActivity("org.eclipse.cdt.debug.dsfgdbActivity", true); //$NON-NLS-1$
|
||||||
|
|
|
@ -358,9 +358,13 @@ public class LaunchUtils {
|
||||||
public static String[] getLaunchEnvironment(ILaunchConfiguration config) throws CoreException {
|
public static String[] getLaunchEnvironment(ILaunchConfiguration config) throws CoreException {
|
||||||
// Get the project
|
// Get the project
|
||||||
String projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
|
String projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
|
||||||
if (projectName == null)
|
if (projectName == null) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
projectName = projectName.trim();
|
||||||
|
if (projectName.length() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
||||||
if (project == null || !project.isAccessible())
|
if (project == null || !project.isAccessible())
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue