Exemplo n.º 1
0
        // Resume a process launched by IDebugEngineLaunch2.LaunchSuspended
        int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process)
        {
            IDebugPort2 port;

            EngineUtils.RequireOk(process.GetPort(out port));

            IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port;

            IDebugPortNotify2 portNotify;

            EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify));

            EngineUtils.RequireOk(portNotify.AddProgramNode(new AD7ProgramNode((int)pi.dwProcessId)));

            if (this.m_ad7ProgramId == Guid.Empty)
            {
                Debug.Fail("Attaching failed");
                return(VSConstants.E_FAIL);
            }

            this._programCreateContinued.WaitOne();
            this.writeCommandQueue.Enqueue(new Command(CommandKind.DebuggerEnvironmentReady));

            NativeMethods.ResumeThread(threadHandle);
            return(0);
        }
Exemplo n.º 2
0
        // Resume a process launched by IDebugEngineLaunch2.LaunchSuspended
        int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process)
        {
            //Debug.Assert(Worker.MainThreadId == Worker.CurrentThreadId);

            /*Debug.Assert(m_pollThread != null);
             * Debug.Assert(m_engineCallback != null);
             * Debug.Assert(m_debuggedProcess != null);
             * Debug.Assert(m_ad7ProgramId == Guid.Empty);*/

            try
            {
                int processId = EngineUtils.GetProcessId(process);

                if (processId != debuggedProcess.Id)
                {
                    return(EngineConstants.S_FALSE);
                }

                // 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
                IDebugPort2 port;
                EngineUtils.RequireOk(process.GetPort(out port));

                IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port;

                IDebugPortNotify2 portNotify;
                EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify));

                EngineUtils.RequireOk(portNotify.AddProgramNode(new AD7ProgramNode(debuggedProcess.Id)));

                if (m_ad7ProgramId == Guid.Empty)
                {
                    Debug.Fail("Unexpected problem -- IDebugEngine2.Attach wasn't called");
                    return(EngineConstants.E_FAIL);
                }

                debuggedProcess.ResumeFromLaunch();

                // Resume the threads in the debuggee process

                /*m_pollThread.RunOperation(new Operation(delegate
                 * {
                 *  m_debuggedProcess.ResumeFromLaunch();
                 * }));*/

                return(EngineConstants.S_OK);
            }
            catch (ComponentException e)
            {
                return(e.HRESULT);
            }
            catch (Exception e)
            {
                return(EngineUtils.UnexpectedException(e));
            }
        }
Exemplo n.º 3
0
        public int ResumeProcess(IDebugProcess2 process)
        {
            IDebugPort2 port;

            EngineUtils.RequireOk(process.GetPort(out port));

            IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port;
            IDebugPortNotify2  portNotify;

            EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify));

            EngineUtils.RequireOk(portNotify.AddProgramNode(new MonoProgramNode(processId)));

            return(VSConstants.S_OK);
        }
Exemplo n.º 4
0
        public int ResumeProcess(IDebugProcess2 process)
        {
            IDebugPort2 port;

            EngineUtils.RequireOk(process.GetPort(out port));
            IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port;

            IDebugPortNotify2 portNotify;

            EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify));
            EngineUtils.RequireOk(portNotify.AddProgramNode(_program));

            Debug.WriteLine("IDebugEngineLaunch2.ResumeProcess: returning S_OK");
            return(VSConstants.S_OK);
        }
Exemplo n.º 5
0
        public int ResumeProcess(IDebugProcess2 pProcess)
        {
            IDebugPort2 port;
            Guid        id;

            pProcess.GetPort(out port);
            pProcess.GetProcessId(out id);

            IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port;

            IDebugPortNotify2 notify;

            defaultPort.GetPortNotify(out notify);

            return(notify.AddProgramNode(new MonoProgramNode(id)));
        }
Exemplo n.º 6
0
        // Resume a process launched by IDebugEngineLaunch2.LaunchSuspended
        int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process)
        {
            Debug.Assert(_pollThread != null);
            Debug.Assert(_engineCallback != null);
            Debug.Assert(_debuggedProcess != null);
            Debug.Assert(_ad7ProgramId == Guid.Empty);

            try
            {
                AD_PROCESS_ID processId = EngineUtils.GetProcessId(process);

                if (!EngineUtils.ProcIdEquals(processId, _debuggedProcess.Id))
                {
                    return(Constants.S_FALSE);
                }

                // 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
                IDebugPort2 port;
                EngineUtils.RequireOk(process.GetPort(out port));

                IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port;

                IDebugPortNotify2 portNotify;
                EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify));

                EngineUtils.RequireOk(portNotify.AddProgramNode(new AD7ProgramNode(_debuggedProcess.Id, _engineGuid)));

                if (_ad7ProgramId == Guid.Empty)
                {
                    Debug.Fail("Unexpected problem -- IDebugEngine2.Attach wasn't called");
                    return(Constants.E_FAIL);
                }

                // NOTE: We wait for the program create event to be continued before we really resume the process

                return(Constants.S_OK);
            }
            catch (MIException e)
            {
                return(e.HResult);
            }
            catch (Exception e) when(ExceptionHelper.BeforeCatch(e, Logger, reportOnlyCorrupting: true))
            {
                return(EngineUtils.UnexpectedException(e));
            }
        }
Exemplo n.º 7
0
        int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process)
        {
            var program = process as Program;

            if (program == null)
            {
                return(VSConstants.E_FAIL);
            }

            IDebugPort2 port;

            if (process.GetPort(out port) != VSConstants.S_OK)
            {
                return(VSConstants.E_FAIL);
            }

            string portName;

            port.GetPortName(out portName);

            Guid guidPort;

            port.GetPortId(out guidPort);

            IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port;

            IDebugPortNotify2 portNotify;

            if (defaultPort.GetPortNotify(out portNotify) != VSConstants.S_OK)
            {
                return(VSConstants.E_FAIL);
            }

            if (portNotify.AddProgramNode(program) != VSConstants.S_OK)
            {
                return(VSConstants.E_FAIL);
            }

            return(VSConstants.S_OK);
        }
Exemplo n.º 8
0
        // Resume a process launched by IDebugEngineLaunch2.LaunchSuspended
        int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process)
        {
            Debug.WriteLine("Python Debugger ResumeProcess Begin");

            AssertMainThread();
            if (_events == null)
            {
                // process failed to start
                Debug.WriteLine("ResumeProcess fails, no events");
                return(VSConstants.E_FAIL);
            }

            Debug.Assert(_events != null);
            Debug.Assert(_process != null);
            Debug.Assert(_process != null);
            Debug.Assert(_ad7ProgramId == Guid.Empty);

            int processId = EngineUtils.GetProcessId(process);

            if (processId != _process.Id)
            {
                Debug.WriteLine("ResumeProcess fails, wrong process");
                return(VSConstants.S_FALSE);
            }

            // 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
            IDebugPort2 port;

            EngineUtils.RequireOk(process.GetPort(out port));

            IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port;

            IDebugPortNotify2 portNotify;

            EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify));

            EngineUtils.RequireOk(portNotify.AddProgramNode(new AD7ProgramNode(_process.Id)));

            if (_ad7ProgramId == Guid.Empty)
            {
                Debug.WriteLine("ResumeProcess fails, empty program guid");
                Debug.Fail("Unexpected problem -- IDebugEngine2.Attach wasn't called");
                return(VSConstants.E_FAIL);
            }

            // wait for the load event to complete, and pump messages

            while (!_process.HasExited && !_loadComplete.WaitOne(100))
            {
                Debug.WriteLine("ResumeProcess waiting for load complete");
            }

            // Resume the threads in the debuggee process
            if (_process.HasExited)
            {
                Debug.WriteLine("ResumeProcess resume all");
                _process.Resume();
            }
            else
            {
                // return failure?
                Debug.WriteLine("Process exited");
            }

            Debug.WriteLine("ResumeProcess return S_OK");
            return(VSConstants.S_OK);
        }