1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00
David Inglis 2003-07-03 18:45:07 +00:00
parent 77ed10f94c
commit fbfc9a8227
5 changed files with 25 additions and 20 deletions

View file

@ -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 2003-06-26 David Inglis
* src/org/eclipse/cdt/launch/ui/CDebuggerTab.java * src/org/eclipse/cdt/launch/ui/CDebuggerTab.java

View file

@ -399,18 +399,22 @@ abstract public class AbstractCLaunchDelegate implements ILaunchConfigurationDel
return cproject; return cproject;
} }
protected IPath verifyProgramFile(ILaunchConfiguration config) throws CoreException { protected IFile getProgramFile(ILaunchConfiguration config) throws CoreException {
ICProject cproject = verifyCProject(config); ICProject cproject = verifyCProject(config);
String fileName = getProgramName(config); String fileName = getProgramName(config);
if (fileName == null) { if (fileName == null) {
abort("Program file not specified", null, ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM); abort("Program file not specified", null, ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM);
} }
IFile projectPath = ((IProject) cproject.getResource()).getFile(fileName); IFile programPath = ((IProject) cproject.getResource()).getFile(fileName);
if (projectPath == null || !projectPath.exists() || !projectPath.getLocation().toFile().exists()) { if (programPath == null || !programPath.exists() || !programPath.getLocation().toFile().exists()) {
abort("Program file does not exist", null, ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST); 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();
} }
/** /**

View file

@ -10,7 +10,6 @@ import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -42,12 +41,10 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
return; return;
} }
IPath projectPath = verifyProgramFile(config); IFile exeFile = getProgramFile(config);
ICDebugConfiguration debugConfig = getDebugConfig(config); ICDebugConfiguration debugConfig = getDebugConfig(config);
IFile exe = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(projectPath);
ICDISession dsession = null; ICDISession dsession = null;
ICProject cproject = getCProject(config); ICProject cproject = getCProject(config);
IPath corefile = getCoreFilePath((IProject) cproject.getResource()); IPath corefile = getCoreFilePath((IProject) cproject.getResource());
@ -57,7 +54,7 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
Process debugger = null; Process debugger = null;
IProcess debuggerProcess = null; IProcess debuggerProcess = null;
try { try {
dsession = debugConfig.getDebugger().createCoreSession(config, exe, corefile); dsession = debugConfig.getDebugger().createCoreSession(config, exeFile, corefile);
debugger = dsession.getSessionProcess(); debugger = dsession.getSessionProcess();
} catch (CDIException e) { } catch (CDIException e) {
abort("Failed Launching CDI Debugger", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); abort("Failed Launching CDI Debugger", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
@ -74,7 +71,7 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
dsession.getCurrentTarget(), dsession.getCurrentTarget(),
renderTargetLabel(debugConfig), renderTargetLabel(debugConfig),
debuggerProcess, debuggerProcess,
exe); exeFile);
monitor.done(); monitor.done();
} }

View file

@ -26,9 +26,7 @@ import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.cdt.utils.spawner.ProcessFactory; import org.eclipse.cdt.utils.spawner.ProcessFactory;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
@ -61,10 +59,10 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
return; return;
} }
IPath projectPath = verifyProgramFile(config); IFile exeFile = getProgramFile(config);
String arguments[] = getProgramArgumentsArray(config); String arguments[] = getProgramArgumentsArray(config);
ArrayList command = new ArrayList(1 + arguments.length); ArrayList command = new ArrayList(1 + arguments.length);
command.add(projectPath.toOSString()); command.add(exeFile.getLocation().toOSString());
command.addAll(Arrays.asList(arguments)); command.addAll(Arrays.asList(arguments));
String[] commandArray = (String[]) command.toArray(new String[command.size()]); String[] commandArray = (String[]) command.toArray(new String[command.size()]);
@ -75,7 +73,6 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
IProcess debuggerProcess = null; IProcess debuggerProcess = null;
Process debugger; Process debugger;
ICDebugConfiguration debugConfig = getDebugConfig(config); ICDebugConfiguration debugConfig = getDebugConfig(config);
IFile exe = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(projectPath);
ICDISession dsession = null; ICDISession dsession = null;
try { try {
String debugMode = String debugMode =
@ -83,7 +80,7 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN); ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
if (debugMode.equals(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(); ICDIRuntimeOptions opt = dsession.getRuntimeOptions();
opt.setArguments(getProgramArgumentsArray(config)); opt.setArguments(getProgramArgumentsArray(config));
File wd = getWorkingDirectory(config); File wd = getWorkingDirectory(config);
@ -106,7 +103,7 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
renderTargetLabel(debugConfig), renderTargetLabel(debugConfig),
iprocess, iprocess,
debuggerProcess, debuggerProcess,
exe, exeFile,
true, true,
false, false,
stopInMain); stopInMain);
@ -116,7 +113,7 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
if (pid == -1) { if (pid == -1) {
cancel("No Process ID selected", ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID); 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(); debugger = dsession.getSessionProcess();
if ( debugger != null ) { if ( debugger != null ) {
debuggerProcess = DebugPlugin.newProcess(launch, debugger, "Debug Console"); debuggerProcess = DebugPlugin.newProcess(launch, debugger, "Debug Console");
@ -127,7 +124,7 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
dsession.getCurrentTarget(), dsession.getCurrentTarget(),
renderTargetLabel(debugConfig), renderTargetLabel(debugConfig),
debuggerProcess, debuggerProcess,
exe); exeFile);
} }
} catch (CDIException e) { } catch (CDIException e) {
abort("Failed Launching CDI Debugger", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); abort("Failed Launching CDI Debugger", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);

View file

@ -285,7 +285,7 @@ public class CMainTab extends CLaunchConfigurationTab {
list.add(cproject[i]); list.add(cproject[i]);
} }
} catch (CoreException e) { } catch (CoreException e) {
e.printStackTrace(); list.add(cproject[i]);
} }
} }
return (ICProject[]) list.toArray(new ICProject[list.size()]); return (ICProject[]) list.toArray(new ICProject[list.size()]);