public override void Execute(object sender, EventArgs e) { var dte = (EnvDTE.DTE)_visualStudioPackageProvider.Package.DTE; //GetService(typeof(EnvDTE.DTE)); HashSet <int> roots = new HashSet <int>(); foreach (EnvDTE90.Process3 p in dte.Debugger.DebuggedProcesses) { if (p.IsBeingDebugged && ChromeUtility.IsChromeProcess(p.Name)) { roots.Add(p.ProcessID); } } foreach (EnvDTE90.Process3 p in dte.Debugger.LocalProcesses) { if (p.IsBeingDebugged || !ChromeUtility.IsChromeProcess(p.Name)) { continue; } NtProcess process = new NtProcess(p.ProcessID); if (!roots.Contains(process.ParentProcessId)) { continue; } p.Attach(); } }
public override void Execute(object sender, EventArgs e) { var dte = (EnvDTE.DTE)_visualStudioPackageProvider.Package.DTE; //GetService(typeof(EnvDTE.DTE)); foreach (EnvDTE90.Process3 p in dte.Debugger.LocalProcesses) { if (!p.IsBeingDebugged && ChromeUtility.IsChromeProcess(p.Name)) { p.Attach(); } } }
public static void VscxOnRuntimeInstanceLoad(this DkmRuntimeInstance runtime) { if (runtime.TagValue != DkmRuntimeInstance.Tag.NativeRuntimeInstance) { return; } DkmNativeRuntimeInstance nativeRuntime = (DkmNativeRuntimeInstance)runtime; bool isChrome = false; bool isTestProcess = false; // Check if the process is a chrome executable, and if so, attach a CallstackFilter to the DkmProcess. if (ChromeUtility.IsChromeProcess(nativeRuntime.Process.Path)) { isChrome = true; } #if DEBUG string fileName = Path.GetFileName(nativeRuntime.Process.Path); if (fileName.Equals("vistest.exe", StringComparison.CurrentCultureIgnoreCase)) { isTestProcess = true; } #endif if (isTestProcess || isChrome) { DkmProcess process = nativeRuntime.Process; DebugProcessOptions options = DebugProcessOptions.Create(process.DebugLaunchSettings.OptionsString); ProcessDebugOptionsDataItem optionsDataItem = new ProcessDebugOptionsDataItem(options); process.SetDataItem(DkmDataCreationDisposition.CreateAlways, optionsDataItem); if (isTestProcess || ShouldEnableChildDebugging(nativeRuntime.Process, options)) { process.SetDataItem(DkmDataCreationDisposition.CreateAlways, new RuntimeBreakpointHandler()); process.SetDataItem(DkmDataCreationDisposition.CreateAlways, new AutoAttachToChildHandler()); } } }