int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 aProcess) { // Resume a process launched by IDebugEngineLaunch2.LaunchSuspended try { // Send a program node to the SDM. This will cause the SDM to turn around and call IDebugEngine2.Attach // which will complete the hookup with AD7 var xProcess = aProcess as AD7Process; if (xProcess == null) { return(VSConstants.E_INVALIDARG); } IDebugPort2 xPort; EngineUtils.RequireOk(aProcess.GetPort(out xPort)); var xDefPort = (IDebugDefaultPort2)xPort; IDebugPortNotify2 xNotify; EngineUtils.RequireOk(xDefPort.GetPortNotify(out xNotify)); // This triggers Attach EngineUtils.RequireOk(xNotify.AddProgramNode(mProgNode)); Callback.OnModuleLoad(mModule); Callback.OnSymbolSearch(mModule, xProcess.mISO.Replace("iso", "pdb"), enum_MODULE_INFO_FLAGS.MIF_SYMBOLS_LOADED); // Important! // // This call triggers setting of breakpoints that exist before run. // So it must be called before we resume the process. // If not called VS will call it after our 3 startup events, but thats too late. // This line was commented out in earlier Cosmos builds and caused problems with // breakpoints and timing. Callback.OnThreadStart(mThread); // Not sure what this does exactly. It was commented out before // but so was a lot of stuff we actually needed. If its uncommented it // throws: // "Operation is not valid due to the current state of the object." //AD7EntrypointEvent.Send(this); // Now finally release our process to go after breakpoints are set mProcess.ResumeFromLaunch(); } catch (Exception e) { return(EngineUtils.UnexpectedException(e)); } return(VSConstants.S_OK); }