コード例 #1
0
ファイル: FunctionResolver.cs プロジェクト: belav/roslyn
 void IDkmModuleSymbolsLoadedNotification.OnModuleSymbolsLoaded(
     DkmModuleInstance moduleInstance,
     DkmModule module,
     bool isReload,
     DkmWorkList workList,
     DkmEventDescriptor eventDescriptor
     )
 {
     OnModuleLoad(moduleInstance, workList);
 }
コード例 #2
0
ファイル: FunctionResolver.cs プロジェクト: belav/roslyn
 void IDkmModuleInstanceUnloadNotification.OnModuleInstanceUnload(
     DkmModuleInstance moduleInstance,
     DkmWorkList workList,
     DkmEventDescriptor eventDescriptor
     )
 {
     // Implementing IDkmModuleInstanceUnloadNotification
     // (with Synchronized="true" in .vsdconfigxml) prevents
     // caller from unloading modules while binding.
 }
コード例 #3
0
        public void OnLoadComplete(DkmProcess process, DkmWorkList workList, DkmEventDescriptor eventDescriptor)
        {
            DisposeStreams();

            if (_debugPane == null)
            {
                IVsOutputWindow outWindow     = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;
                Guid            debugPaneGuid = VSConstants.GUID_OutWindowDebugPane;
                outWindow.GetPane(ref debugPaneGuid, out _debugPane);
            }
        }
コード例 #4
0
        public void OnLoadComplete(DkmProcess process, DkmWorkList workList, DkmEventDescriptor eventDescriptor)
        {
            _enabled = true;
            DisposeStreams();

            if (_debugPane == null)
            {
                IVsOutputWindow outWindow     = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;
                Guid            debugPaneGuid = VSConstants.GUID_OutWindowDebugPane;
                outWindow.GetPane(ref debugPaneGuid, out _debugPane);
            }

            var env = Environment.GetEnvironmentVariable("UNITY_MIXED_CALLSTACK");

            if (env == null || env == "0") // plugin not enabled
            {
                _debugPane.OutputString("Warning: To use the UnityMixedCallstack plugin please set the environment variable UNITY_MIXED_CALLSTACK=1 and relaunch Unity and Visual Studio\n");
                _debugPane.Activate();
                _enabled = false;
            }
        }
コード例 #5
0
ファイル: LocalComponent.cs プロジェクト: krus/PTVS
        unsafe void IDkmRuntimeInstanceLoadNotification.OnRuntimeInstanceLoad(DkmRuntimeInstance runtimeInstance, DkmEventDescriptor eventDescriptor)
        {
            if (runtimeInstance.Id.RuntimeType != Guids.PythonRuntimeTypeGuid)
            {
                Debug.Fail("OnRuntimeInstanceLoad notification for a non-Python runtime.");
                throw new NotSupportedException();
            }

            var process = runtimeInstance.Process;

            process.SetDataItem(DkmDataCreationDisposition.CreateNew, new ModuleManager(process));
            process.SetDataItem(DkmDataCreationDisposition.CreateNew, new CallStackFilter(process));
            process.SetDataItem(DkmDataCreationDisposition.CreateNew, new ExpressionEvaluator(process));
            process.SetDataItem(DkmDataCreationDisposition.CreateNew, new PyObjectAllocator(process));

            if (process.LivePart != null)
            {
                process.SetDataItem(DkmDataCreationDisposition.CreateNew, new TraceManagerLocalHelper(process, TraceManagerLocalHelper.Kind.StepIn));
            }

            // If both local and remote components are actually in the same process, they share the same DebuggerOptions, so no need to propagate it.
            if (process.Connection.Flags.HasFlag(DkmTransportConnectionFlags.MarshallingRequired))
            {
                process.SetDataItem(DkmDataCreationDisposition.CreateNew, new DebuggerOptionsPropagator(process));
            }
        }
コード例 #6
0
ファイル: LocalComponent.cs プロジェクト: krus/PTVS
        void IDkmModuleSymbolsLoadedNotification.OnModuleSymbolsLoaded(DkmModuleInstance moduleInstance, DkmModule module, bool isReload, DkmWorkList workList, DkmEventDescriptor eventDescriptor)
        {
            var process = moduleInstance.Process;

            var engines = process.DebugLaunchSettings.EngineFilter;

            if (engines == null || !engines.Contains(AD7Engine.DebugEngineGuid))
            {
                return;
            }

            var pyrtInfo = process.GetPythonRuntimeInfo();

            var nativeModuleInstance = moduleInstance as DkmNativeModuleInstance;

            if (nativeModuleInstance != null)
            {
                if (PythonDLLs.CTypesNames.Contains(moduleInstance.Name))
                {
                    pyrtInfo.DLLs.CTypes = nativeModuleInstance;

                    var traceHelper = process.GetDataItem <TraceManagerLocalHelper>();
                    if (traceHelper != null)
                    {
                        traceHelper.OnCTypesLoaded(nativeModuleInstance);
                    }
                }
                else if (PythonDLLs.GetPythonLanguageVersion(nativeModuleInstance) != PythonLanguageVersion.None)
                {
                    if (IsModuleCompiledWithPGO(moduleInstance))
                    {
                        pyrtInfo.DLLs.Python = null;
                        var pgoWarnMsg = DkmCustomMessage.Create(process.Connection, process, Guid.Empty, (int)VsPackageMessage.WarnAboutPGO, moduleInstance.Name, null);
                        pgoWarnMsg.SendToVsService(Guids.CustomDebuggerEventHandlerGuid, IsBlocking: true);
                        return;
                    }
                }
            }

            if (process.GetPythonRuntimeInstance() != null)
            {
                return;
            }

            if (pyrtInfo.DLLs.Python != null && pyrtInfo.DLLs.Python.HasSymbols())
            {
                if (process.LivePart == null || pyrtInfo.DLLs.DebuggerHelper != null)
                {
                    CreatePythonRuntimeInstance(process);
                }
                else
                {
                    InjectHelperDll(process);
                }
            }
        }
コード例 #7
0
 public void OnRuntimeInstanceLoad(DkmRuntimeInstance runtimeInstance, DkmEventDescriptor eventDescriptor)
 {
     runtimeInstance.VscxOnRuntimeInstanceLoad();
 }
コード例 #8
0
        unsafe void IDkmRuntimeInstanceLoadNotification.OnRuntimeInstanceLoad(DkmRuntimeInstance runtimeInstance, DkmEventDescriptor eventDescriptor)
        {
            if (runtimeInstance.Id.RuntimeType != Guids.PythonRuntimeTypeGuid)
            {
                Debug.Fail("OnRuntimeInstanceLoad notification for a non-Python runtime.");
                throw new NotSupportedException();
            }

            var process = runtimeInstance.Process;

            process.SetDataItem(DkmDataCreationDisposition.CreateNew, new TraceManagerLocalHelper(process, TraceManagerLocalHelper.Kind.StepOut));
        }
コード例 #9
0
 void IDkmModuleInstanceUnloadNotification.OnModuleInstanceUnload(DkmModuleInstance moduleInstance, DkmWorkList workList, DkmEventDescriptor eventDescriptor)
 {
     RemoveDataItemIfNecessary(moduleInstance);
 }
コード例 #10
0
        void IDkmModuleSymbolsLoadedNotification.OnModuleSymbolsLoaded(DkmModuleInstance moduleInstance, DkmModule module, bool isReload, DkmWorkList workList, DkmEventDescriptor eventDescriptor)
        {
            var process = moduleInstance.Process;

            var engines = process.DebugLaunchSettings.EngineFilter;

            if (engines == null || !engines.Contains(Guids.PythonDebugEngineGuid))
            {
                return;
            }

            var pyrtInfo = process.GetPythonRuntimeInfo();

            var nativeModuleInstance = moduleInstance as DkmNativeModuleInstance;

            if (nativeModuleInstance != null)
            {
                if (PythonDLLs.CTypesNames.Contains(moduleInstance.Name))
                {
                    pyrtInfo.DLLs.CTypes = nativeModuleInstance;

                    var traceHelper = process.GetDataItem <TraceManagerLocalHelper>();
                    if (traceHelper != null)
                    {
                        traceHelper.OnCTypesLoaded(nativeModuleInstance);
                    }
                }
            }

            if (process.GetPythonRuntimeInstance() != null)
            {
                return;
            }

            if (pyrtInfo.DLLs.Python != null && pyrtInfo.DLLs.Python.HasSymbols())
            {
                if (process.LivePart == null || pyrtInfo.DLLs.DebuggerHelper != null)
                {
                    CreatePythonRuntimeInstance(process);
                }
                else
                {
                    InjectHelperDll(process);
                }
            }
        }
コード例 #11
0
 /// <summary>
 /// <see cref="IDkmModuleInstanceUnloadNotification"/> is implemented by components that want to listen
 /// for the ModuleInstanceUnload event. When this notification fires, the target process
 /// will be suspended and can be examined. ModuleInstanceUnload is sent when the monitor
 /// detects that a module has unloaded from within the target process.
 /// </summary>
 public void OnModuleInstanceUnload(DkmModuleInstance moduleInstance, DkmWorkList workList, DkmEventDescriptor eventDescriptor)
 {
     if (moduleInstance is DkmClrModuleInstance clrModuleInstance)
     {
         _listener.OnManagedModuleInstanceUnloaded(clrModuleInstance);
     }
 }
コード例 #12
0
 public void OnRuntimeInstanceLoad(DkmRuntimeInstance runtimeInstance, DkmEventDescriptor eventDescriptor)
 {
     runtimeInstance.VscxOnRuntimeInstanceLoad();
 }
コード例 #13
0
 void IDkmModuleInstanceUnloadNotification.OnModuleInstanceUnload(DkmModuleInstance moduleInstance, DkmWorkList workList, DkmEventDescriptor eventDescriptor)
 {
     if (moduleInstance is DkmClrModuleInstance clrModuleInstance)
     {
         Contract.ThrowIfNull(_encService);
         _encService.OnManagedModuleInstanceUnloaded(clrModuleInstance.Mvid);
     }
 }