void IDkmModuleSymbolsLoadedNotification.OnModuleSymbolsLoaded( DkmModuleInstance moduleInstance, DkmModule module, bool isReload, DkmWorkList workList, DkmEventDescriptor eventDescriptor ) { OnModuleLoad(moduleInstance, workList); }
void IDkmModuleInstanceUnloadNotification.OnModuleInstanceUnload( DkmModuleInstance moduleInstance, DkmWorkList workList, DkmEventDescriptor eventDescriptor ) { // Implementing IDkmModuleInstanceUnloadNotification // (with Synchronized="true" in .vsdconfigxml) prevents // caller from unloading modules while binding. }
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); } }
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; } }
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)); } }
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); } } }
public void OnRuntimeInstanceLoad(DkmRuntimeInstance runtimeInstance, DkmEventDescriptor eventDescriptor) { runtimeInstance.VscxOnRuntimeInstanceLoad(); }
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)); }
void IDkmModuleInstanceUnloadNotification.OnModuleInstanceUnload(DkmModuleInstance moduleInstance, DkmWorkList workList, DkmEventDescriptor eventDescriptor) { RemoveDataItemIfNecessary(moduleInstance); }
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); } } }
/// <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); } }
void IDkmModuleInstanceUnloadNotification.OnModuleInstanceUnload(DkmModuleInstance moduleInstance, DkmWorkList workList, DkmEventDescriptor eventDescriptor) { if (moduleInstance is DkmClrModuleInstance clrModuleInstance) { Contract.ThrowIfNull(_encService); _encService.OnManagedModuleInstanceUnloaded(clrModuleInstance.Mvid); } }