diff --git a/launch/org.eclipse.cdt.launch/ChangeLog b/launch/org.eclipse.cdt.launch/ChangeLog index c491503805f..8e6afcd42d1 100644 --- a/launch/org.eclipse.cdt.launch/ChangeLog +++ b/launch/org.eclipse.cdt.launch/ChangeLog @@ -1,3 +1,10 @@ +2003-07-03 David Inglis + * src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java + * src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java + * src/org/eclipse/cdt/launch/internal/LocalCLaunchConfigurationDelegate.java + * src/org/eclipse/cdt/launch/ui/CMainTab.java + Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=39583 + 2003-06-26 David Inglis * src/org/eclipse/cdt/launch/ui/CDebuggerTab.java 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 e039c9e6dfa..112f87e745d 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 @@ -399,20 +399,24 @@ abstract public class AbstractCLaunchDelegate implements ILaunchConfigurationDel return cproject; } - protected IPath verifyProgramFile(ILaunchConfiguration config) throws CoreException { + protected IFile getProgramFile(ILaunchConfiguration config) throws CoreException { ICProject cproject = verifyCProject(config); String fileName = getProgramName(config); if (fileName == null) { abort("Program file not specified", null, ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM); } - IFile projectPath = ((IProject) cproject.getResource()).getFile(fileName); - if (projectPath == null || !projectPath.exists() || !projectPath.getLocation().toFile().exists()) { + IFile programPath = ((IProject) cproject.getResource()).getFile(fileName); + if (programPath == null || !programPath.exists() || !programPath.getLocation().toFile().exists()) { abort("Program file does not exist", null, ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST); } - return projectPath.getLocation(); + return programPath; } + protected IPath verifyProgramFile(ILaunchConfiguration config) throws CoreException { + return getProgramFile(config).getLocation(); + } + /** * Verifies the working directory specified by the given * launch configuration exists, and returns the working diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java index 7ee455a8005..e29aab1423a 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java @@ -10,7 +10,6 @@ import org.eclipse.cdt.launch.AbstractCLaunchDelegate; import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; @@ -42,12 +41,10 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate { if (monitor.isCanceled()) { return; } - IPath projectPath = verifyProgramFile(config); + IFile exeFile = getProgramFile(config); ICDebugConfiguration debugConfig = getDebugConfig(config); - IFile exe = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(projectPath); ICDISession dsession = null; - ICProject cproject = getCProject(config); IPath corefile = getCoreFilePath((IProject) cproject.getResource()); @@ -57,7 +54,7 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate { Process debugger = null; IProcess debuggerProcess = null; try { - dsession = debugConfig.getDebugger().createCoreSession(config, exe, corefile); + dsession = debugConfig.getDebugger().createCoreSession(config, exeFile, corefile); debugger = dsession.getSessionProcess(); } catch (CDIException e) { abort("Failed Launching CDI Debugger", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); @@ -74,7 +71,7 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate { dsession.getCurrentTarget(), renderTargetLabel(debugConfig), debuggerProcess, - exe); + exeFile); monitor.done(); } diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCLaunchConfigurationDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCLaunchConfigurationDelegate.java index 59f129a8578..6f85722e0f8 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCLaunchConfigurationDelegate.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCLaunchConfigurationDelegate.java @@ -26,9 +26,7 @@ import org.eclipse.cdt.launch.AbstractCLaunchDelegate; import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; import org.eclipse.cdt.utils.spawner.ProcessFactory; import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; @@ -61,10 +59,10 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate { if (monitor.isCanceled()) { return; } - IPath projectPath = verifyProgramFile(config); + IFile exeFile = getProgramFile(config); String arguments[] = getProgramArgumentsArray(config); ArrayList command = new ArrayList(1 + arguments.length); - command.add(projectPath.toOSString()); + command.add(exeFile.getLocation().toOSString()); command.addAll(Arrays.asList(arguments)); String[] commandArray = (String[]) command.toArray(new String[command.size()]); @@ -75,7 +73,6 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate { IProcess debuggerProcess = null; Process debugger; ICDebugConfiguration debugConfig = getDebugConfig(config); - IFile exe = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(projectPath); ICDISession dsession = null; try { String debugMode = @@ -83,7 +80,7 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate { ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN); if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) { - dsession = debugConfig.getDebugger().createLaunchSession(config, exe); + dsession = debugConfig.getDebugger().createLaunchSession(config, exeFile); ICDIRuntimeOptions opt = dsession.getRuntimeOptions(); opt.setArguments(getProgramArgumentsArray(config)); File wd = getWorkingDirectory(config); @@ -106,7 +103,7 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate { renderTargetLabel(debugConfig), iprocess, debuggerProcess, - exe, + exeFile, true, false, stopInMain); @@ -116,7 +113,7 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate { if (pid == -1) { cancel("No Process ID selected", ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID); } - dsession = debugConfig.getDebugger().createAttachSession(config, exe, pid); + dsession = debugConfig.getDebugger().createAttachSession(config, exeFile, pid); debugger = dsession.getSessionProcess(); if ( debugger != null ) { debuggerProcess = DebugPlugin.newProcess(launch, debugger, "Debug Console"); @@ -127,7 +124,7 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate { dsession.getCurrentTarget(), renderTargetLabel(debugConfig), debuggerProcess, - exe); + exeFile); } } catch (CDIException e) { abort("Failed Launching CDI Debugger", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java index f6f86c2ffee..f48e7163503 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java @@ -285,7 +285,7 @@ public class CMainTab extends CLaunchConfigurationTab { list.add(cproject[i]); } } catch (CoreException e) { - e.printStackTrace(); + list.add(cproject[i]); } } return (ICProject[]) list.toArray(new ICProject[list.size()]);