1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 347163: Canceling a remote attach causes a bad debug session

This commit is contained in:
Marc Khouzam 2011-05-25 19:07:11 +00:00
parent aa5d0e73a4
commit 5226c0b13a

View file

@ -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;
}