예제 #1
0
        /// <summary>
        /// Creates a default 'source level step' on process with current active frame and active thread.
        /// </summary>
        /// <param name="process">non-null process </param>
        /// <param name="type">type of step (in, out, over)</param>
        /// <param name="singleStepInstructions">false to step source level, true to step single instructions</param>
        /// <returns></returns>
        public static StepperDescriptor CreateSourceLevelStep(MDbgProcess process, StepperType type, bool singleStepInstructions)
        {
            StepperDescriptor s = new StepperDescriptor(process);

            s.StepperType = type;

            //
            // Handle Step-out case.
            //
            if (type == StepperType.Out)
            {
                return(s);
            }

            //
            // Handle step-over / step-in case
            //
            bool stepInto = (type == StepperType.In);

            // Cache current
            s.Thread = process.Threads.Active.CorThread;
            s.Frame  = s.Thread.ActiveFrame;

            CorDebugMappingResult mappingResult;
            uint ip;

            if (!singleStepInstructions)
            {
                // For source-level stepping, skip some interceptors. These are random, and cause
                // random differences in stepping across different runtimes; and user generally don't care
                // about interceptors.
                // It's actually a debatable policy about which interceptors to skip and stop on.
                s.InterceptMask = CorDebugIntercept.INTERCEPT_ALL &
                                  ~(CorDebugIntercept.INTERCEPT_SECURITY | CorDebugIntercept.INTERCEPT_CLASS_INIT);
            }

            s.Frame.GetIP(out ip, out mappingResult);
            if (singleStepInstructions ||
                (mappingResult != CorDebugMappingResult.MAPPING_EXACT &&
                 mappingResult != CorDebugMappingResult.MAPPING_APPROXIMATE))
            {
                // Leave step ranges null
            }
            else
            {
                // Getting the step ranges is what really makes this a source-level step.
                MDbgFunction           f  = process.Modules.LookupFunction(s.Frame.Function);
                COR_DEBUG_STEP_RANGE[] sr = f.GetStepRangesFromIP((int)ip);
                if (sr != null)
                {
                    s.SetStepRanges(sr, true);
                }
                else
                {
                    // Leave step ranges null.
                }
            }

            return(s);
        }
예제 #2
0
 public Stepper(
     List <Step> steps,
     Key key          = null,
     StepperType type = StepperType.vertical,
     int currentStep  = 0,
     ValueChanged <int> onStepTapped       = null,
     VoidCallback onStepContinue           = null,
     VoidCallback onStepCancel             = null,
     ControlsWidgetBuilder controlsBuilder = null
     ) : base(key)
 {
     this.steps           = steps;
     this.type            = type;
     this.currentStep     = currentStep;
     this.onStepTapped    = onStepTapped;
     this.onStepContinue  = onStepContinue;
     this.onStepCancel    = onStepCancel;
     this.controlsBuilder = controlsBuilder;
 }
예제 #3
0
        /// <summary>
        /// Creates a default 'source level step' on process with current active frame and active thread. 
        /// </summary>
        /// <param name="process">non-null process </param>
        /// <param name="type">type of step (in, out, over)</param>
        /// <param name="singleStepInstructions">false to step source level, true to step single instructions</param>
        /// <returns></returns>
        public static StepperDescriptor CreateSourceLevelStep(MDbgProcess process, StepperType type, bool singleStepInstructions)
        {
            StepperDescriptor s = new StepperDescriptor(process);
            s.StepperType = type;

            //
            // Handle Step-out case.
            //
            if (type == StepperType.Out)
            {
                 return s;
            }

            //
            // Handle step-over / step-in case
            //
            bool stepInto = (type == StepperType.In);

            // Cache current
            s.Thread = process.Threads.Active.CorThread;
            s.Frame = s.Thread.ActiveFrame;

            CorDebugMappingResult mappingResult;
            uint ip;

            if (!singleStepInstructions)
            {
                // For source-level stepping, skip some interceptors. These are random, and cause
                // random differences in stepping across different runtimes; and user generally don't care
                // about interceptors.
                // It's actually a debatable policy about which interceptors to skip and stop on.
                s.InterceptMask = CorDebugIntercept.INTERCEPT_ALL &
                    ~(CorDebugIntercept.INTERCEPT_SECURITY | CorDebugIntercept.INTERCEPT_CLASS_INIT);
            }

            s.Frame.GetIP(out ip, out mappingResult);
            if (singleStepInstructions ||
                (mappingResult != CorDebugMappingResult.MAPPING_EXACT &&
                 mappingResult != CorDebugMappingResult.MAPPING_APPROXIMATE))
            {
                // Leave step ranges null
            }
            else
            {
                // Getting the step ranges is what really makes this a source-level step.
                MDbgFunction f = process.Modules.LookupFunction(s.Frame.Function);
                COR_DEBUG_STEP_RANGE[] sr = f.GetStepRangesFromIP((int)ip);
                if (sr != null)
                {
                    s.SetStepRanges(sr, true);
                }
                else
                {
                    // Leave step ranges null.
                }
            }

            return s;
        }
예제 #4
0
 /// <summary>
 /// Creates a source level stepper
 /// </summary>
 /// <param name="process"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static StepperDescriptor CreateSourceLevelStep(MDbgProcess process, StepperType type)
 {
     bool stepNativeCode = false;
     return CreateSourceLevelStep(process, type, stepNativeCode);
 }
예제 #5
0
        /// <summary>
        /// Creates a source level stepper
        /// </summary>
        /// <param name="process"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static StepperDescriptor CreateSourceLevelStep(MDbgProcess process, StepperType type)
        {
            bool stepNativeCode = false;

            return(CreateSourceLevelStep(process, type, stepNativeCode));
        }
예제 #6
0
        //////////////////////////////////////////////////////////////////////////////////
        //
        // Private functions
        //
        //////////////////////////////////////////////////////////////////////////////////
        private void StepImpl(bool stepNativeCode, StepperType type)
        {
            EnsureCanExecute("stepping");

            StepperDescriptor s = StepperDescriptor.CreateSourceLevelStep(this, type, stepNativeCode);
            CorStepper stepper = s.Step();

            SetActiveStepper(stepper);
            ReallyContinueProcess();
        }