Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Khouzam2011-05-25 19:07:11 +0000
committerMarc Khouzam2011-05-25 19:07:11 +0000
commit5226c0b13aa62a92d74459b6f5b4c3e91a281674 (patch)
tree308644508d1deea21ab9ad2d7b8e1a72d3cad765 /dsf-gdb
parentaa5d0e73a4420ad33d11698ff81929d08b2cd05b (diff)
downloadorg.eclipse.cdt-5226c0b13aa62a92d74459b6f5b4c3e91a281674.tar.gz
org.eclipse.cdt-5226c0b13aa62a92d74459b6f5b4c3e91a281674.tar.xz
org.eclipse.cdt-5226c0b13aa62a92d74459b6f5b4c3e91a281674.zip
Bug 347163: Canceling a remote attach causes a bad debug session
Diffstat (limited to 'dsf-gdb')
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java28
1 files changed, 19 insertions, 9 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java
index c6282f4dbcb..60c921422dd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java
@@ -167,16 +167,26 @@ public class GdbConnectCommand implements IConnect {
binaryPath = fd.open();
}
- final String finalBinaryPath = binaryPath;
- fExecutor.execute(new DsfRunnable() {
- public void run() {
- IGDBProcesses procService = fTracker.getService(IGDBProcesses.class);
- ICommandControlService commandControl = fTracker.getService(ICommandControlService.class);
+ if (binaryPath == null) {
+ // The user pressed the cancel button, so we cancel the attach gracefully
+ fRm.done();
+ } else {
+ final String finalBinaryPath = binaryPath;
+ fExecutor.execute(new DsfRunnable() {
+ public void run() {
+ IGDBProcesses procService = fTracker.getService(IGDBProcesses.class);
+ ICommandControlService commandControl = fTracker.getService(ICommandControlService.class);
- IProcessDMContext procDmc = procService.createProcessContext(commandControl.getContext(), fPid);
- procService.attachDebuggerToProcess(procDmc, finalBinaryPath, new DataRequestMonitor<IDMContext>(fExecutor, fRm));
- }
- });
+ if (procService != null && commandControl != null) {
+ IProcessDMContext procDmc = procService.createProcessContext(commandControl.getContext(), fPid);
+ procService.attachDebuggerToProcess(procDmc, finalBinaryPath, new DataRequestMonitor<IDMContext>(fExecutor, fRm));
+ } else {
+ fRm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Cannot find services", null)); //$NON-NLS-1$
+ fRm.done();
+ }
+ }
+ });
+ }
return Status.OK_STATUS;
}

Back to the top