void Step(DbgStepKind step)
        {
            if (!CanStepProcess)
            {
                return;
            }
            var thread = dbgManager.Value.CurrentThread.Current;

            if (thread is null)
            {
                return;
            }
            thread.CreateStepper().Step(step, autoClose: true);
        }
Beispiel #2
0
        public override void Step(DbgStepKind step, bool autoClose)
        {
            Debug.Assert(CanStep);
            if (IsClosed)
            {
                Debug.Fail("Stepper has been closed");
                // No need to localize it, if we're here it's a bug that should be fixed
                RaiseStepComplete("Stepper has been closed");
                return;
            }

            if (thread.Process.State != DbgProcessState.Paused)
            {
                Debug.Fail("Process isn't paused");
                // No need to localize it, if we're here it's a bug that should be fixed
                RaiseStepComplete("Process isn't paused");
                return;
            }

            bool   canStep;
            object stepperTagTmp;

            lock (lockObj) {
                canStep = stepperTag == null;
                if (canStep)
                {
                    stepperTag = new object();
                }
                stepperTagTmp = stepperTag;
            }
            if (!canStep)
            {
                Debug.Fail("Previous step isn't complete");
                // No need to localize it, if we're here it's a bug that should be fixed
                RaiseStepComplete("Previous step isn't complete");
                return;
            }

            closeWhenStepComplete = autoClose;
            switch (step)
            {
            case DbgStepKind.StepInto:
                dbgManager.Step(this, stepperTagTmp, DbgEngineStepKind.StepInto, singleProcess: false);
                break;

            case DbgStepKind.StepOver:
                dbgManager.Step(this, stepperTagTmp, DbgEngineStepKind.StepOver, singleProcess: false);
                break;

            case DbgStepKind.StepOut:
                dbgManager.Step(this, stepperTagTmp, DbgEngineStepKind.StepOut, singleProcess: false);
                break;

            case DbgStepKind.StepIntoProcess:
                dbgManager.Step(this, stepperTagTmp, DbgEngineStepKind.StepInto, singleProcess: true);
                break;

            case DbgStepKind.StepOverProcess:
                dbgManager.Step(this, stepperTagTmp, DbgEngineStepKind.StepOver, singleProcess: true);
                break;

            case DbgStepKind.StepOutProcess:
                dbgManager.Step(this, stepperTagTmp, DbgEngineStepKind.StepOut, singleProcess: true);
                break;

            default:
                lock (lockObj)
                    stepperTag = null;
                throw new ArgumentOutOfRangeException(nameof(step));
            }
        }
Beispiel #3
0
 /// <summary>
 /// Steps once. This method can be called again once <see cref="StepComplete"/> is raised.
 /// The method can only be called when its process is paused.
 /// </summary>
 /// <param name="step">Step kind</param>
 /// <param name="autoClose">true to call <see cref="Close"/> once <see cref="StepComplete"/> is raised</param>
 public abstract void Step(DbgStepKind step, bool autoClose = false);