Beispiel #1
0
        public PyFrameObject(DkmProcess process, ulong address)
            : base(process, address)
        {
            PythonRuntimeInfo pythonInfo = process.GetPythonRuntimeInfo();

            if (pythonInfo.LanguageVersion <= PythonLanguageVersion.V35)
            {
                InitializeStruct(this, out Fields_27_35 fields);
                _fields = fields;
            }
            else
            {
                InitializeStruct(this, out Fields_36 fields);
                _fields = fields;
            }
            CheckPyType <PyFrameObject>();
        }
Beispiel #2
0
        bool IDkmRuntimeStepper.OwnsCurrentExecutionLocation(DkmRuntimeInstance runtimeInstance, DkmStepper stepper, DkmStepArbitrationReason reason)
        {
            if (!DebuggerOptions.UsePythonStepping)
            {
                return(false);
            }

            var process = runtimeInstance.Process;
            PythonRuntimeInfo pyrtInfo = process.GetPythonRuntimeInfo();

            if (pyrtInfo.DLLs.Python == null)
            {
                return(false);
            }

            var thread = stepper.Thread;
            var ip     = thread.GetCurrentRegisters(new DkmUnwoundRegister[0]).GetInstructionPointer();

            return(pyrtInfo.DLLs.Python.ContainsAddress(ip) ||
                   (pyrtInfo.DLLs.DebuggerHelper != null && pyrtInfo.DLLs.DebuggerHelper.ContainsAddress(ip)) ||
                   (pyrtInfo.DLLs.CTypes != null && pyrtInfo.DLLs.CTypes.ContainsAddress(ip)));
        }
Beispiel #3
0
            public override void Handle(DkmProcess process)
            {
                PythonRuntimeInfo pyrtInfo = process.GetPythonRuntimeInfo();
                var nativeModules          = process.GetNativeRuntimeInstance().GetNativeModuleInstances();

                pyrtInfo.DLLs.Python = nativeModules.Single(mi => mi.UniqueId == PythonDllModuleInstanceId);
                pyrtInfo.DLLs.Python.FlagAsTransitionModule();

                if (DebuggerHelperDllModuleInstanceId != Guid.Empty)
                {
                    pyrtInfo.DLLs.DebuggerHelper = nativeModules.Single(mi => mi.UniqueId == DebuggerHelperDllModuleInstanceId);
                    pyrtInfo.DLLs.DebuggerHelper.FlagAsTransitionModule();

                    process.SetDataItem(DkmDataCreationDisposition.CreateNew, new TraceManager(process));
                }

                var runtimeId       = new DkmRuntimeInstanceId(Guids.PythonRuntimeTypeGuid, 0);
                var runtimeInstance = DkmCustomRuntimeInstance.Create(process, runtimeId, null);

                new CreateModuleRequest {
                    ModuleId = Guids.UnknownPythonModuleGuid
                }.Handle(process);
            }