Browse Source

Fix SD-1753 - Attach to process dialog shows no managed processes after attaching to one process

pull/14/head
Eusebiu Marcu 15 years ago
parent
commit
b7b7c5cf6b
  1. 1
      src/AddIns/Debugger/Debugger.AddIn/Service/AttachToProcessForm.cs
  2. 7
      src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs
  3. 6
      src/AddIns/Debugger/Debugger.Core/NDebugger.cs
  4. 18
      src/AddIns/Debugger/Debugger.Core/Process.cs

1
src/AddIns/Debugger/Debugger.AddIn/Service/AttachToProcessForm.cs

@ -57,6 +57,7 @@ namespace ICSharpCode.SharpDevelop.Services @@ -57,6 +57,7 @@ namespace ICSharpCode.SharpDevelop.Services
Process currentProcess = Process.GetCurrentProcess();
foreach (Process process in Process.GetProcesses()) {
try {
if (process.HasExited) continue;
// Prevent attaching to our own process.
if (currentProcess.Id != process.Id) {
ProcessListViewItem item = new ProcessListViewItem(process, debugger);

7
src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs

@ -13,6 +13,7 @@ using System.Windows.Forms; @@ -13,6 +13,7 @@ using System.Windows.Forms;
using Debugger;
using Debugger.AddIn;
using Debugger.AddIn.TreeModel;
using Debugger.Interop;
using Debugger.Interop.CorPublish;
using ICSharpCode.Core;
using ICSharpCode.Core.WinForms;
@ -362,10 +363,8 @@ namespace ICSharpCode.SharpDevelop.Services @@ -362,10 +363,8 @@ namespace ICSharpCode.SharpDevelop.Services
public bool IsManaged(int processId)
{
if (corPublish == null) {
corPublish = new CorpubPublishClass();
Debugger.Interop.TrackedComObjects.Track(corPublish);
}
corPublish = new CorpubPublishClass();
Debugger.Interop.TrackedComObjects.Track(corPublish);
ICorPublishProcess process = corPublish.GetProcess((uint)processId);
if (process != null) {

6
src/AddIns/Debugger/Debugger.Core/NDebugger.cs

@ -212,8 +212,10 @@ namespace Debugger @@ -212,8 +212,10 @@ namespace Debugger
}
// Detach all processes.
while (this.Processes.Count > 0) {
Process process = this.Processes[0];
for (int i = 0; i < this.Processes.Count; ++i) {
Process process = this.Processes[i];
if (process == null || process.HasExited)
continue;
process.Detach();
}
}

18
src/AddIns/Debugger/Debugger.Core/Process.cs

@ -3,10 +3,12 @@ @@ -3,10 +3,12 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Debugger.Interop;
using Debugger.Interop.CorDebug;
using ICSharpCode.NRefactory.Ast;
using ICSharpCode.NRefactory.Visitors;
using System.Runtime.InteropServices;
namespace Debugger
{
@ -400,6 +402,7 @@ namespace Debugger @@ -400,6 +402,7 @@ namespace Debugger
corProcess.Stop(uint.MaxValue);
NotifyPaused(PausedReason.ForcedBreak);
}
// This is necessary for detach
foreach(Stepper s in this.Steppers) {
if (s.CorStepper.IsActive() == 1) {
@ -407,7 +410,20 @@ namespace Debugger @@ -407,7 +410,20 @@ namespace Debugger
}
}
this.Steppers.Clear();
corProcess.Detach();
// modules
foreach(Module m in this.Modules)
{
m.Dispose();
}
this.modules.Clear();
// threads
this.threads.Clear();
NotifyHasExited();
}

Loading…
Cancel
Save