Exemple #1
0
 public unsafe void RegisterTracing(PyThreadState tstate)
 {
     tstate.use_tracing.Write(1);
     tstate.c_tracefunc.Write(_traceFunc.GetPointer());
     _pyTracingPossible.Write(_pyTracingPossible.Read() + 1);
     _isTracing.Write(1);
 }
Exemple #2
0
        public void Step(DkmStepper stepper, DkmStepArbitrationReason reason)
        {
            var thread  = stepper.Thread;
            var process = thread.Process;

            if (stepper.StepKind == DkmStepKind.StepIntoSpecific)
            {
                throw new NotSupportedException();
            }
            else if (_stepper != null)
            {
                _stepper.CancelStepper(process.GetPythonRuntimeInstance());
                _stepper = null;
            }

            // Check if this was a step out (or step over/in that fell through) from native to Python.
            // If so, we consider the step done, since we can report the correct callstack at this point.
            if (reason == DkmStepArbitrationReason.TransitionModule)
            {
                var beginState = stepper.GetDataItem <StepBeginState>();
                if (beginState != null)
                {
                    thread.GetCurrentFrameInfo(out global::System.UInt64 retAddr, out global::System.UInt64 frameBase, out global::System.UInt64 vframe);
                    if (frameBase >= beginState.FrameBase)
                    {
                        stepper.OnStepComplete(thread, false);
                        return;
                    }
                }
            }

            if (stepper.StepKind == DkmStepKind.Into)
            {
                new LocalComponent.BeginStepInNotification
                {
                    ThreadId = thread.UniqueId
                }.SendHigher(process);
            }

            _stepper = stepper;
            _stepKind.Write((int)stepper.StepKind + 1);
            _stepThreadId.Write((uint)thread.SystemPart.Id);
            _steppingStackDepth.Write(0);
        }