コード例 #1
0
ファイル: PySetObject.cs プロジェクト: omnimark/PTVS
 public DummyHolder(DkmProcess process) {
     var pyrtInfo = process.GetPythonRuntimeInfo();
     Dummy = 
         pyrtInfo.LanguageVersion >= PythonLanguageVersion.V34 ? 
         pyrtInfo.DLLs.Python.GetStaticVariable<PointerProxy<PyObject>>("_PySet_Dummy") :
         pyrtInfo.DLLs.Python.GetStaticVariable<PointerProxy<PyObject>>("dummy", "setobject.obj");
 }
コード例 #2
0
ファイル: ModuleManager.cs プロジェクト: omnimark/PTVS
        public ModuleManager(DkmProcess process) {
            _process = process;
            _pyrtInfo = process.GetPythonRuntimeInfo();

            LoadInitialPythonModules();
            LocalComponent.CreateRuntimeDllFunctionBreakpoint(_pyrtInfo.DLLs.Python, "PyCode_New", PythonDllBreakpointHandlers.PyCode_New, enable: true, debugStart: true);
            LocalComponent.CreateRuntimeDllFunctionBreakpoint(_pyrtInfo.DLLs.Python, "PyCode_NewEmpty", PythonDllBreakpointHandlers.PyCode_NewEmpty, enable: true, debugStart: true);
        }
コード例 #3
0
ファイル: PyFrameObject.cs プロジェクト: zooba/PTVS
 public PyFrameObject(DkmProcess process, ulong address)
     : base(process, address) {
     var pythonInfo = process.GetPythonRuntimeInfo();
     if (pythonInfo.LanguageVersion <= PythonLanguageVersion.V35) {
         Fields_27_35 fields;
         InitializeStruct(this, out fields);
         _fields = fields;
     } else {
         Fields_36 fields;
         InitializeStruct(this, out fields);
         _fields = fields;
     }
     CheckPyType<PyFrameObject>();
 }
コード例 #4
0
ファイル: ExpressionEvaluator.cs プロジェクト: omnimark/PTVS
        public ExpressionEvaluator(DkmProcess process) {
            _process = process;
            var pyrtInfo = process.GetPythonRuntimeInfo();

            _evalLoopThreadId = pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<UInt64Proxy>("evalLoopThreadId");
            _evalLoopFrame = pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<UInt64Proxy>("evalLoopFrame");
            _evalLoopResult = pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<UInt64Proxy>("evalLoopResult");
            _evalLoopExcType = pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<UInt64Proxy>("evalLoopExcType");
            _evalLoopExcValue = pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<UInt64Proxy>("evalLoopExcValue");
            _evalLoopExcStr = pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<UInt64Proxy>("evalLoopExcStr");
            _evalLoopSEHCode = pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<UInt32Proxy>("evalLoopSEHCode");
            _evalLoopInput = pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<CStringProxy>("evalLoopInput");

            LocalComponent.CreateRuntimeDllExportedFunctionBreakpoint(pyrtInfo.DLLs.DebuggerHelper, "OnEvalComplete", OnEvalComplete, enable: true);
        }
コード例 #5
0
ファイル: TraceManagerLocalHelper.cs プロジェクト: zooba/PTVS
 public PyFrameObject_FieldOffsets(DkmProcess process) {
     if (process.GetPythonRuntimeInfo().LanguageVersion <= PythonLanguageVersion.V35) {
         var fields = StructProxy.GetStructFields<PyFrameObject, PyFrameObject.Fields_27_35>(process);
         f_back = -1;
         f_code = fields.f_code.Offset;
         f_globals = fields.f_globals.Offset;
         f_locals = fields.f_locals.Offset;
         f_lineno = fields.f_lineno.Offset;
     } else {
         var fields = StructProxy.GetStructFields<PyFrameObject, PyFrameObject.Fields_36>(process);
         f_back = fields.f_back.Offset;
         f_code = fields.f_code.Offset;
         f_globals = fields.f_globals.Offset;
         f_locals = fields.f_locals.Offset;
         f_lineno = fields.f_lineno.Offset;
     }
 }
コード例 #6
0
ファイル: PyInterpreterState.cs プロジェクト: zooba/PTVS
 public InterpHeadHolder(DkmProcess process) {
     Proxy = process.GetPythonRuntimeInfo().DLLs.Python.GetStaticVariable<PointerProxy<PyInterpreterState>>("interp_head");
 }
コード例 #7
0
        public unsafe TraceManagerLocalHelper(DkmProcess process, Kind kind) {
            _process = process;
            _pyrtInfo = process.GetPythonRuntimeInfo();

            _traceFunc = _pyrtInfo.DLLs.DebuggerHelper.GetExportedFunctionAddress("TraceFunc");
            _isTracing = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<ByteProxy>("isTracing");
            _pyTracingPossible = _pyrtInfo.DLLs.Python.GetStaticVariable<UInt32Proxy>("_Py_TracingPossible");

            if (kind == Kind.StepIn) {
                var fieldOffsets = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<CliStructProxy<FieldOffsets>>("fieldOffsets");
                fieldOffsets.Write(new FieldOffsets(process, _pyrtInfo));

                var types = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<CliStructProxy<Types>>("types");
                types.Write(new Types(process, _pyrtInfo));

                var functionPointers = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<CliStructProxy<FunctionPointers>>("functionPointers");
                functionPointers.Write(new FunctionPointers(process, _pyrtInfo));

                var stringEquals = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<PointerProxy>("stringEquals");
                if (_pyrtInfo.LanguageVersion <= PythonLanguageVersion.V27) {
                    stringEquals.Write(_pyrtInfo.DLLs.DebuggerHelper.GetExportedFunctionAddress("StringEquals27").GetPointer());
                } else {
                    stringEquals.Write(_pyrtInfo.DLLs.DebuggerHelper.GetExportedFunctionAddress("StringEquals33").GetPointer());
                }

                foreach (var interp in PyInterpreterState.GetInterpreterStates(process)) {
                    foreach (var tstate in interp.GetThreadStates()) {
                        RegisterTracing(tstate);
                    }
                }

                _handlers = new PythonDllBreakpointHandlers(this);
                LocalComponent.CreateRuntimeDllFunctionExitBreakpoints(_pyrtInfo.DLLs.Python, "new_threadstate", _handlers.new_threadstate, enable: true);

                foreach (var methodInfo in _handlers.GetType().GetMethods()) {
                    var stepInAttr = (StepInGateAttribute)Attribute.GetCustomAttribute(methodInfo, typeof(StepInGateAttribute));
                    if (stepInAttr != null &&
                        (stepInAttr.MinVersion == PythonLanguageVersion.None || _pyrtInfo.LanguageVersion >= stepInAttr.MinVersion) &&
                        (stepInAttr.MaxVersion == PythonLanguageVersion.None || _pyrtInfo.LanguageVersion <= stepInAttr.MaxVersion)) {

                        var handler = (StepInGateHandler)Delegate.CreateDelegate(typeof(StepInGateHandler), _handlers, methodInfo);
                        AddStepInGate(handler, _pyrtInfo.DLLs.Python, methodInfo.Name, stepInAttr.HasMultipleExitPoints);
                    }
                }

                if (_pyrtInfo.DLLs.CTypes != null) {
                    OnCTypesLoaded(_pyrtInfo.DLLs.CTypes);
                }
            }
        }
コード例 #8
0
ファイル: PyDictObject.cs プロジェクト: omnimark/PTVS
 public DummyHolder(DkmProcess process) {
     Dummy = process.GetPythonRuntimeInfo().DLLs.Python.GetStaticVariable<PointerProxy<PyObject>>("dummy", "dictobject.obj");
 }
コード例 #9
0
ファイル: PyTypeObject.cs プロジェクト: wenh123/PTVS
 public unsafe static PyTypeObject FromNativeGlobalVariable(DkmProcess process, string name) {
     var addr = process.GetPythonRuntimeInfo().DLLs.Python.GetStaticVariableAddress(name);
     return new PyTypeObject(process, addr);
 }
コード例 #10
0
ファイル: CallStackFilter.cs プロジェクト: wenh123/PTVS
 public CallStackFilter(DkmProcess process) {
     _process = process;
     _pyrtInfo = process.GetPythonRuntimeInfo();
 }
コード例 #11
0
ファイル: PyBoolObject.cs プロジェクト: wenh123/PTVS
            public ValuesHolder(DkmProcess process) {
                var pythonDll = process.GetPythonRuntimeInfo().DLLs.Python;

                False = pythonDll.GetStaticVariable<PyBoolObject33>("_Py_FalseStruct");
                True = pythonDll.GetStaticVariable<PyBoolObject33>("_Py_TrueStruct");
            }