public void CreateProcessAndAttach(string CommandLine)
        {
            if (_disposed)
            {
                throw new ApplicationException("Object already disposed");
            }

            logger.Debug("CreateProcessAndAttach: " + CommandLine);

            count++;

            dbgClient.CreateProcessAndAttach(0,
                                             CommandLine, 1, 0, 0);

            try
            {
                while (!exitDebugger.WaitOne(0, false) && !handledException.WaitOne(0, false))
                {
                    dbgControl.WaitForEvent(0, 100);
                }
            }
            catch (Exception ex)
            {
                logger.Debug(ex.ToString());
                //Debugger.Break();
            }

            logger.Debug("EndSession");
            dbgClient.EndSession((uint)Const.DEBUG_END_ACTIVE_TERMINATE);
        }
示例#2
0
        private bool DoPostCommand()
        {
            var status = UpdateStatus();

            Control.OutputPromptWide(DEBUG_OUTCTL.THIS_CLIENT, null);

            if (status == DEBUG_STATUS.NO_DEBUGGEE)
            {
                Client.EndSession(DEBUG_END.ACTIVE_TERMINATE);
                return(false);
            }

            if (status == DEBUG_STATUS.GO || status == DEBUG_STATUS.STEP_BRANCH || status == DEBUG_STATUS.STEP_INTO || status == DEBUG_STATUS.STEP_OVER)
            {
                if (Control.WaitForEvent(DEBUG_WAIT.DEFAULT, uint.MaxValue) < 0)
                {
                    UpdateStatus();
                    if (Status == DEBUG_STATUS.NO_DEBUGGEE)
                    {
                        return(false);
                    }
                }
                Control.OutputCurrentState(DEBUG_OUTCTL.THIS_CLIENT, DEBUG_CURRENT.DEFAULT);
                _stateChanged = true;
            }

            if (_stateChanged)
            {
                if (Status == DEBUG_STATUS.NO_DEBUGGEE)
                {
                    return(false);
                }

                _stateChanged = false;
                if (_breakpointHit)
                {
                    //Control.OutputCurrentState(DEBUG_OUTCTL.THIS_CLIENT, DEBUG_CURRENT.DEFAULT);
                    _breakpointHit = false;

                    UpdateStatus();
                }
                Control.OutputPromptWide(DEBUG_OUTCTL.THIS_CLIENT, null);
            }
            return(true);
        }
示例#3
0
 public void TerminateProcess()
 {
     m_exited = true;
     _client.EndSession(DEBUG_END.ACTIVE_TERMINATE);
 }