debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AttachLaunchDelegate.java
branchRCL_2_4
changeset 857 d66843399035
parent 403 154ecf9c9186
child 1254 0e45b6356eac
equal deleted inserted replaced
855:3f37e327885c 857:d66843399035
    68 
    68 
    69 	        if (!RemoteConnectionsTRKHelper.configUsesConnectionAttribute(config)) {
    69 	        if (!RemoteConnectionsTRKHelper.configUsesConnectionAttribute(config)) {
    70 	        	config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy());
    70 	        	config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy());
    71 	        }
    71 	        }
    72 	        
    72 	        
    73 	        final IConnection connection = RemoteConnectionsTRKHelper.getConnectionFromConfig(config);
    73 	        final IConnection connection = RemoteConnectionsTRKHelper.ensureConnectionFromConfig(config);
    74 			if (connection == null) {
    74 			if (connection == null) {
    75 				IStatus status = new Status(Status.ERROR, LaunchPlugin.PLUGIN_ID, 
    75 				IStatus status = new Status(Status.ERROR, LaunchPlugin.PLUGIN_ID, 
    76 					LaunchMessages.getString("TRKLaunchDelegate.NoConnectionErrorMsg")); //$NON-NLS-1$
    76 					LaunchMessages.getString("TRKLaunchDelegate.NoConnectionErrorMsg")); //$NON-NLS-1$
    77 				throw new DebugException(status);
    77 				throw new DebugException(status);
    78 			}
    78 			}
    91 	            			
    91 	            			
    92 				// set the default source locator if required
    92 				// set the default source locator if required
    93 				setDefaultSourceLocator(launch, config);
    93 				setDefaultSourceLocator(launch, config);
    94 
    94 
    95 				if (mode.equals(ILaunchManager.DEBUG_MODE)) {
    95 				if (mode.equals(ILaunchManager.DEBUG_MODE)) {
       
    96 					hookConnectionStatus();
    96 					// debug mode
    97 					// debug mode
    97 					ICDebugConfiguration debugConfig = getDebugConfig(config);
    98 					ICDebugConfiguration debugConfig = getDebugConfig(config);
    98 					ICDISession dsession = null;
    99 					ICDISession dsession = null;
    99 	                String debugMode = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
   100 	                String debugMode = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
   100 									ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
   101 									ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
   167 								session.debuggingStopped(null);
   168 								session.debuggingStopped(null);
   168 								this.abort(e.getLocalizedMessage(), null, 0);
   169 								this.abort(e.getLocalizedMessage(), null, 0);
   169 							}
   170 							}
   170 						}
   171 						}
   171 					}
   172 					}
       
   173 	    			hookSessionEnded();
   172 				} else if (mode.equals(ILaunchManager.RUN_MODE)) {
   174 				} else if (mode.equals(ILaunchManager.RUN_MODE)) {
   173 					// run mode not supported for attach
   175 					// run mode not supported for attach
   174 				}
   176 				}
   175 			} catch (CoreException e) {
   177 			} catch (CoreException e) {
   176 	      		connection.useConnection(false);
   178 	      		connection.useConnection(false);
       
   179 	      		unhookConnectionStatus();
   177 	        	if (! monitor.isCanceled()) // don't throw on user cancellation
   180 	        	if (! monitor.isCanceled()) // don't throw on user cancellation
   178 					throw e;
   181 					throw e;
   179 			} finally {
   182 			} finally {
   180 				monitor.done();
   183 				monitor.done();
   181 	            removeBeingLaunched(config);
   184 	            removeBeingLaunched(config);