Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/launch
diff options
context:
space:
mode:
authorAnton Leherbauer2008-04-03 08:46:05 +0000
committerAnton Leherbauer2008-04-03 08:46:05 +0000
commitf2bcb6cb77cc74d1e1de2e6efcdf6a00ace5a863 (patch)
treefa5c18c0b2d00b75233474c16db49501e3a20d4b /launch
parent402016a6f0db01b564ef464acfb491319e03274b (diff)
downloadorg.eclipse.cdt-f2bcb6cb77cc74d1e1de2e6efcdf6a00ace5a863.tar.gz
org.eclipse.cdt-f2bcb6cb77cc74d1e1de2e6efcdf6a00ace5a863.tar.xz
org.eclipse.cdt-f2bcb6cb77cc74d1e1de2e6efcdf6a00ace5a863.zip
Fix for 212632: Failure to debug-attach on Windows using GDB
and 224187: NPE launching debug configuration without app name
Diffstat (limited to 'launch')
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java19
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCDILaunchDelegate.java36
2 files changed, 46 insertions, 9 deletions
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
index a4332ccf126..29eb2de929d 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 QNX Software Systems and others.
+ * Copyright (c) 2005, 2008 QNX Software Systems 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
@@ -9,6 +9,7 @@
* QNX Software Systems - initial API and implementation
* Andrew Ferguson (andrew.ferguson@arm.com) - bug 123997
* Ken Ryall (Nokia) - bug 178731
+ * Anton Leherbauer (Wind River Systems) - bug 224187
*******************************************************************************/
package org.eclipse.cdt.launch;
@@ -153,9 +154,14 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
* error code
*/
protected void abort(String message, Throwable exception, int code) throws CoreException {
- MultiStatus status = new MultiStatus(getPluginID(), code, message, exception);
- status.add(new Status(IStatus.ERROR, getPluginID(), code, exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
- exception));
+ IStatus status;
+ if (exception != null) {
+ MultiStatus multiStatus = new MultiStatus(getPluginID(), code, message, exception);
+ multiStatus.add(new Status(IStatus.ERROR, getPluginID(), code, exception.getLocalizedMessage(), exception));
+ status= multiStatus;
+ } else {
+ status= new Status(IStatus.ERROR, getPluginID(), code, message, null);
+ }
throw new CoreException(status);
}
@@ -190,7 +196,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
public static IPath getProgramPath(ILaunchConfiguration configuration) throws CoreException {
String path = getProgramName(configuration);
- if (path == null) {
+ if (path == null || path.trim().length() == 0) {
return null;
}
return new Path(path);
@@ -364,7 +370,8 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
ICProject cproject = verifyCProject(config);
IPath programPath = getProgramPath(config);
if (programPath == null || programPath.isEmpty()) {
- return null;
+ abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_not_specified"), null, //$NON-NLS-1$
+ ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM);
}
if (!programPath.isAbsolute()) {
IFile wsProgramPath = cproject.getProject().getFile(programPath);
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCDILaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCDILaunchDelegate.java
index 99ff199dccb..194d1702009 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCDILaunchDelegate.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCDILaunchDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 QNX Software Systems and others.
+ * Copyright (c) 2004, 2008 QNX Software Systems 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
@@ -7,7 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
- * Anton Leherbauer (Wind River Systems) - bug 205108
+ * Anton Leherbauer (Wind River Systems) - bugs 205108, 212632, 224187
*******************************************************************************/
package org.eclipse.cdt.launch.internal;
@@ -16,6 +16,9 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.IProcessInfo;
+import org.eclipse.cdt.core.IProcessList;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.debug.core.CDIDebugModel;
@@ -38,6 +41,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.debug.core.DebugPlugin;
@@ -196,7 +200,10 @@ public class LocalCDILaunchDelegate extends AbstractCLaunchDelegate {
}
cancel( "", -1 ); //$NON-NLS-1$
}
- IPath exePath = verifyProgramPath( config );
+ IPath exePath = getProgramPath( config );
+ if (exePath == null) {
+ exePath= getProgramPathForPid(pid);
+ }
ICProject project = verifyCProject( config );
IBinaryObject exeFile = null;
if ( exePath != null ) {
@@ -232,6 +239,29 @@ public class LocalCDILaunchDelegate extends AbstractCLaunchDelegate {
}
}
+ private IPath getProgramPathForPid(int pid) {
+ IProcessList processList= null;
+ try {
+ processList= CCorePlugin.getDefault().getProcessList();
+ } catch (CoreException exc) {
+ // ignored on purpose
+ }
+ if (processList != null) {
+ IProcessInfo[] pInfos= processList.getProcessList();
+ for (int i = 0; i < pInfos.length; i++) {
+ IProcessInfo processInfo = pInfos[i];
+ if (processInfo.getPid() == pid) {
+ final String name= processInfo.getName();
+ if (name != null) {
+ return new Path(name);
+ }
+ break;
+ }
+ }
+ }
+ return null;
+ }
+
private void launchCoreDebugSession( ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor ) throws CoreException {
if ( monitor.isCanceled() ) {
return;

Back to the top