Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/launch
diff options
context:
space:
mode:
authorDavid Inglis2002-10-01 02:00:12 +0000
committerDavid Inglis2002-10-01 02:00:12 +0000
commit103c42de84799d83f1d9d1af375f97a4bfe4e8b2 (patch)
tree4328c794ab5e3b61603758fea6ea86d289d50fe7 /launch
parent75201f7a47b9d0f42c2d4aba51c355bd00493493 (diff)
downloadorg.eclipse.cdt-103c42de84799d83f1d9d1af375f97a4bfe4e8b2.tar.gz
org.eclipse.cdt-103c42de84799d83f1d9d1af375f97a4bfe4e8b2.tar.xz
org.eclipse.cdt-103c42de84799d83f1d9d1af375f97a4bfe4e8b2.zip
use new debug target creation methods
Diffstat (limited to 'launch')
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java36
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCLaunchConfigurationDelegate.java93
2 files changed, 59 insertions, 70 deletions
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 31720560c6d..1bcbaaafc3d 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
@@ -32,10 +32,8 @@ import org.eclipse.swt.widgets.Shell;
*/
public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
+ 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 {
-
if (monitor == null) {
monitor = new NullProgressMonitor();
}
@@ -52,39 +50,32 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
ICDISession dsession = null;
ICProject cproject = getCProject(config);
-
- IPath corefile = getCoreFilePath((IProject)cproject.getResource());
- if ( corefile == null ) {
+
+ IPath corefile = getCoreFilePath((IProject) cproject.getResource());
+ if (corefile == null) {
cancel("No Corefile selected", ICDTLaunchConfigurationConstants.ERR_NO_COREFILE);
}
try {
dsession = debugConfig.getDebugger().createCoreSession(config, exe, corefile);
- }
- catch (CDIException e) {
- abort( "Failed Launching CDI Debugger", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ } catch (CDIException e) {
+ abort("Failed Launching CDI Debugger", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
ICDITarget dtarget = dsession.getTargets()[0];
- Process process = dtarget.getProcess();
- IProcess iprocess =
- DebugPlugin.newProcess(launch, process, renderProcessLabel(projectPath.toOSString()));
- CDebugModel.newDebugTarget(
+ CDebugModel.newCoreFileDebugTarget(
launch,
- dsession.getTargets()[0],
+ dsession.getCurrentTarget(),
renderTargetLabel(debugConfig),
- iprocess,
- exe.getProject(),
- false,
- true,
- false);
+ null,
+ exe.getProject());
}
- private IPath getCoreFilePath(final IProject project) throws CoreException {
+ protected IPath getCoreFilePath(final IProject project) throws CoreException {
final Shell shell = LaunchUIPlugin.getShell();
final String res[] = { null };
if (shell == null) {
- abort( "No Shell availible in Launch", null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ abort("No Shell availible in Launch", null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
Display display = shell.getDisplay();
display.syncExec(new Runnable() {
@@ -95,8 +86,7 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
String initPath = null;
try {
initPath = project.getPersistentProperty(new QualifiedName(LaunchUIPlugin.getUniqueIdentifier(), "SavePath"));
- }
- catch (CoreException e) {
+ } catch (CoreException e) {
}
if (initPath == null || initPath.equals("")) {
initPath = project.getLocation().toString();
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 35dfc235656..5f2e7df722a 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
@@ -76,41 +76,44 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
dsession = debugConfig.getDebugger().createLaunchSession(config, exe);
- }
- else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
+ ICDIRuntimeOptions opt = dsession.getRuntimeOptions();
+ opt.setArguments(getProgramArgumentsArray(config));
+ File wd = getWorkingDir(config);
+ if (wd != null) {
+ opt.setWorkingDirectory(wd.toString());
+ }
+ opt.setEnvironment(getEnvironmentProperty(config));
+ ICDITarget dtarget = dsession.getTargets()[0];
+ Process process = dtarget.getProcess();
+ IProcess iprocess = DebugPlugin.newProcess(launch, process, renderProcessLabel(commandArray[0]));
+ boolean stopInMain = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
+ CDebugModel.newDebugTarget(
+ launch,
+ dsession.getCurrentTarget(),
+ renderTargetLabel(debugConfig),
+ iprocess,
+ exe.getProject(),
+ true,
+ false,
+ stopInMain);
+
+ } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
int pid = getProcessID();
- if ( pid == -1 ) {
+ if (pid == -1) {
cancel("No Process ID selected", ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID);
}
dsession = debugConfig.getDebugger().createAttachSession(config, exe, pid);
+ CDebugModel.newAttachDebugTarget(
+ launch,
+ dsession.getCurrentTarget(),
+ renderTargetLabel(debugConfig),
+ null,
+ exe.getProject());
}
+ } catch (CDIException e) {
+ abort("Failed Launching CDI Debugger", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
- catch (CDIException e) {
- abort( "Failed Launching CDI Debugger", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
- ICDIRuntimeOptions opt = dsession.getRuntimeOptions();
- opt.setArguments(getProgramArgumentsArray(config));
- File wd = getWorkingDir(config);
- if (wd != null) {
- opt.setWorkingDirectory(wd.toString());
- }
- opt.setEnvironment(getEnvironmentProperty(config));
- ICDITarget dtarget = dsession.getTargets()[0];
- Process process = dtarget.getProcess();
- IProcess iprocess =
- DebugPlugin.newProcess(launch, process, renderProcessLabel(commandArray[0]));
- boolean stopInMain = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
- CDebugModel.newDebugTarget(
- launch,
- dsession.getTargets()[0],
- renderTargetLabel(debugConfig),
- iprocess,
- exe.getProject(),
- true,
- false,
- stopInMain);
- }
- else {
+ } else {
Process process = exec(commandArray, getEnvironmentArray(config), getWorkingDir(config));
DebugPlugin.getDefault().newProcess(launch, process, renderProcessLabel(commandArray[0]));
}
@@ -119,29 +122,29 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
private int getProcessID() throws CoreException {
final Shell shell = LaunchUIPlugin.getShell();
- final int pid[] = {-1};
- if ( shell == null ) {
- abort( "No Shell availible in Launch", null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ final int pid[] = { -1 };
+ if (shell == null) {
+ abort("No Shell availible in Launch", null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
Display display = shell.getDisplay();
display.syncExec(new Runnable() {
public void run() {
- ElementListSelectionDialog dialog = new ElementListSelectionDialog( shell, new LabelProvider() {
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider() {
public String getText(Object element) {
- IProcessInfo info = (IProcessInfo)element;
+ IProcessInfo info = (IProcessInfo) element;
return info.getPid() + " " + info.getName();
}
- } );
- dialog.setTitle( "Select Process" );
+ });
+ dialog.setTitle("Select Process");
dialog.setMessage("Select a Process to attach debugger to:");
IProcessList plist = CCorePlugin.getDefault().getProcessList();
- if ( plist == null ) {
+ if (plist == null) {
MessageDialog.openError(shell, "CDT Launch Error", "Current platform does not support listing processes");
return;
}
dialog.setElements(plist.getProcessList());
- if ( dialog.open() == dialog.OK ) {
- IProcessInfo info = (IProcessInfo)dialog.getFirstResult();
+ if (dialog.open() == dialog.OK) {
+ IProcessInfo info = (IProcessInfo) dialog.getFirstResult();
pid[0] = info.getPid();
}
}
@@ -149,7 +152,6 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
return pid[0];
}
-
/**
* Performs a runtime exec on the given command line in the context
* of the specified working directory, and returns
@@ -169,18 +171,15 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
try {
if (workingDirectory == null) {
p = Runtime.getRuntime().exec(cmdLine, envp);
- }
- else {
+ } else {
p = Runtime.getRuntime().exec(cmdLine, envp, workingDirectory);
}
- }
- catch (IOException e) {
+ } catch (IOException e) {
if (p != null) {
p.destroy();
}
abort("Error starting process", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
- catch (NoSuchMethodError e) {
+ } catch (NoSuchMethodError e) {
//attempting launches on 1.2.* - no ability to set working directory
IStatus status =
@@ -201,7 +200,7 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
}
return p;
}
-
+
protected String getPluginID() {
return LaunchUIPlugin.getUniqueIdentifier();
}

Back to the top