Browse Source

Attach to process dialog now can show or hide non-managed processes.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3165 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 17 years ago
parent
commit
5d69e1012e
  1. BIN
      data/resources/StringResources.nl.resources
  2. 1
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj
  3. 78
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/AttachToProcessForm.cs
  4. 24
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  5. 12
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  6. 60
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/CorPublishClass.cs
  7. 23
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/CorpubPublish.cs
  8. 31
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/ICorPublish.cs
  9. 27
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/ICorPublishAppDomain.cs
  10. 35
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/ICorPublishAppDomainEnum.cs
  11. 30
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/ICorPublishEnum.cs
  12. 31
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/ICorPublishProcess.cs
  13. 32
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/ICorPublishProcessEnum.cs
  14. 34
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/ICorPublish.cs
  15. 68
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/ICorPublishProcess.cs
  16. 9
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  17. 6
      src/Main/Base/Project/Src/Commands/DebugCommands.cs
  18. 38
      src/Main/Base/Project/Src/Gui/Dialogs/AbstractAttachToProcessForm.Designer.cs
  19. 43
      src/Main/Base/Project/Src/Gui/Dialogs/AbstractAttachToProcessForm.cs
  20. 120
      src/Main/Base/Project/Src/Gui/Dialogs/AttachToProcessForm.resx
  21. 4
      src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs
  22. 10
      src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs
  23. BIN
      src/Main/StartUp/Project/Resources/StringResources.resources

BIN
data/resources/StringResources.nl.resources

Binary file not shown.

1
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj

@ -60,6 +60,7 @@ @@ -60,6 +60,7 @@
<Compile Include="Src\Pads\LoadedModulesPad.cs" />
<Compile Include="Src\Pads\LocalVarPad.cs" />
<Compile Include="Src\Pads\RunningThreadsPad.cs" />
<Compile Include="Src\Service\AttachToProcessForm.cs" />
<Compile Include="Src\Service\DebuggerEventForm.cs">
<SubType>Form</SubType>
</Compile>

78
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/AttachToProcessForm.cs

@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Debugging;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpDevelop.Services
{
public class AttachToProcessForm : AbstractAttachToProcessForm
{
class ProcessListViewItem : ListViewItem
{
Process process;
bool managed;
public ProcessListViewItem(Process process, WindowsDebugger debugger)
{
this.process = process;
try {
managed = debugger.IsManaged(process.Id);
} catch { }
string fileName = Path.GetFileName(process.MainModule.FileName);
Text = fileName;
SubItems.Add(process.Id.ToString());
SubItems.Add(process.MainWindowTitle);
SubItems.Add(GetManagedString(managed));
}
public Process Process {
get { return process; }
}
public bool IsManaged {
get { return managed; }
}
static string GetManagedString(bool managed)
{
if (managed) {
return StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.Dialogs.AttachToProcessForm.Managed}");
}
return String.Empty;
}
}
protected override void RefreshProcessList(ListView listView, bool showNonManaged)
{
listView.Items.Clear();
WindowsDebugger debugger = (WindowsDebugger)DebuggerService.CurrentDebugger;
Process currentProcess = Process.GetCurrentProcess();
foreach (System.Diagnostics.Process process in System.Diagnostics.Process.GetProcesses()) {
try {
// Prevent attaching to our own process.
if (currentProcess.Id != process.Id) {
ProcessListViewItem item = new ProcessListViewItem(process, debugger);
if (showNonManaged || item.IsManaged) {
item.Tag = process;
listView.Items.Add(item);
}
}
} catch (Win32Exception) {
// Do nothing.
}
}
listView.Sort();
}
}
}

24
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -46,6 +46,7 @@ using Bitmap = System.Drawing.Bitmap; @@ -46,6 +46,7 @@ using Bitmap = System.Drawing.Bitmap;
using Debugger;
using Debugger.Expressions;
using Debugger.AddIn.TreeModel;
using Debugger.Core.Wrappers.CorPub;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
@ -60,6 +61,8 @@ namespace ICSharpCode.SharpDevelop.Services @@ -60,6 +61,8 @@ namespace ICSharpCode.SharpDevelop.Services
NDebugger debugger;
ICorPublish corPublish;
Debugger.Process debuggedProcess;
DynamicTreeDebuggerRow currentTooltipRow;
@ -152,6 +155,15 @@ namespace ICSharpCode.SharpDevelop.Services @@ -152,6 +155,15 @@ namespace ICSharpCode.SharpDevelop.Services
}
}
public void ShowAttachDialog()
{
using (AttachToProcessForm attachForm = new AttachToProcessForm()) {
if (attachForm.ShowDialog() == DialogResult.OK) {
Attach(attachForm.Process);
}
}
}
public void Attach(System.Diagnostics.Process existingProcess)
{
if (IsDebugging) {
@ -292,6 +304,18 @@ namespace ICSharpCode.SharpDevelop.Services @@ -292,6 +304,18 @@ namespace ICSharpCode.SharpDevelop.Services
}
}
public bool IsManaged(int processId)
{
if (corPublish == null) {
corPublish = new ICorPublish();
}
ICorPublishProcess process = corPublish.GetProcess(processId);
if (process != null) {
return process.IsManaged;
}
return false;
}
/// <summary>
/// Gets the current value of the variable as string that can be displayed in tooltips.

12
src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj

@ -324,6 +324,16 @@ @@ -324,6 +324,16 @@
<Compile Include="Src\Wrappers\CorDebug\ICorDebugStepper.cs" />
<Compile Include="Src\Wrappers\CorDebug\ICorDebugStringValue.cs" />
<Compile Include="Src\Wrappers\CorDebug\ICorDebugTypeEnum.cs" />
<Compile Include="Src\Wrappers\CorPub\Autogenerated\CorPublishClass.cs" />
<Compile Include="Src\Wrappers\CorPub\Autogenerated\CorpubPublish.cs" />
<Compile Include="Src\Wrappers\CorPub\Autogenerated\ICorPublish.cs" />
<Compile Include="Src\Wrappers\CorPub\Autogenerated\ICorPublishAppDomain.cs" />
<Compile Include="Src\Wrappers\CorPub\Autogenerated\ICorPublishAppDomainEnum.cs" />
<Compile Include="Src\Wrappers\CorPub\Autogenerated\ICorPublishEnum.cs" />
<Compile Include="Src\Wrappers\CorPub\Autogenerated\ICorPublishProcess.cs" />
<Compile Include="Src\Wrappers\CorPub\Autogenerated\ICorPublishProcessEnum.cs" />
<Compile Include="Src\Wrappers\CorPub\ICorPublish.cs" />
<Compile Include="Src\Wrappers\CorPub\ICorPublishProcess.cs" />
<Compile Include="Src\Wrappers\CorSym\Autogenerated\CorSymAddrKind.cs" />
<Compile Include="Src\Wrappers\CorSym\Autogenerated\CorSymBinder_deprecated.cs" />
<Compile Include="Src\Wrappers\CorSym\Autogenerated\CorSymBinder_deprecatedClass.cs" />
@ -390,9 +400,11 @@ @@ -390,9 +400,11 @@
<Folder Include="Src\Wrappers" />
<Folder Include="Src\Wrappers\CorDebug" />
<Folder Include="Src\Wrappers\CorDebug\Autogenerated" />
<Folder Include="Src\Wrappers\CorPub\Autogenerated" />
<Folder Include="Src\Wrappers\CorSym" />
<Folder Include="Src\Wrappers\CorSym\Autogenerated" />
<Folder Include="Src\Wrappers\MetaData" />
<Folder Include="Src\Wrappers\CorPub" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>

60
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/CorPublishClass.cs

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 108, 1591
namespace Debugger.Interop.CorPub
{
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
[ComImport, TypeLibType((short) 2), ClassInterface((short) 0), Guid("047A9A40-657E-11D3-8D5B-00104B35E7EF")]
public class CorpubPublishClass : ICorPublish, CorpubPublish, ICorPublishProcess, ICorPublishAppDomain, ICorPublishProcessEnum, ICorPublishAppDomainEnum
{
// Methods
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void Clone([MarshalAs(UnmanagedType.Interface)] out ICorPublishEnum ppEnum);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void EnumAppDomains([MarshalAs(UnmanagedType.Interface)] out ICorPublishAppDomainEnum ppEnum);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void EnumProcesses([In, ComAliasName("CorpubProcessLib.COR_PUB_ENUMPROCESS")] COR_PUB_ENUMPROCESS Type, [MarshalAs(UnmanagedType.Interface)] out ICorPublishProcessEnum ppIEnum);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void GetCount(out uint pcelt);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void GetDisplayName([In] uint cchName, out uint pcchName, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void GetID(out uint puId);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void GetName([In] uint cchName, out uint pcchName, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void GetProcess([In] uint pid, [MarshalAs(UnmanagedType.Interface)] out ICorPublishProcess ppProcess);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void GetProcessID(out uint pid);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void ICorPublishAppDomainEnum_Clone([MarshalAs(UnmanagedType.Interface)] out ICorPublishEnum ppEnum);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void ICorPublishAppDomainEnum_GetCount(out uint pcelt);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void ICorPublishAppDomainEnum_Reset();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void ICorPublishAppDomainEnum_Skip([In] uint celt);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void IsManaged(out int pbManaged);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void Next([In] uint celt, [MarshalAs(UnmanagedType.Interface)] out ICorPublishAppDomain objects, out uint pceltFetched);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void Next([In] uint celt, [MarshalAs(UnmanagedType.Interface)] out ICorPublishProcess objects, out uint pceltFetched);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void Reset();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
public virtual extern void Skip([In] uint celt);
}
}
#pragma warning restore 108, 1591

23
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/CorpubPublish.cs

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 108, 1591
namespace Debugger.Interop.CorPub
{
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[ComImport, CoClass(typeof(CorpubPublishClass)), Guid("9613A0E7-5A68-11D3-8F84-00A0C9B4D50C")]
public interface CorpubPublish : ICorPublish
{
}
}
#pragma warning restore 108, 1591

31
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/ICorPublish.cs

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 108, 1591
namespace Debugger.Interop.CorPub
{
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
public enum COR_PUB_ENUMPROCESS
{
COR_PUB_MANAGEDONLY = 1
}
[ComImport, Guid("9613A0E7-5A68-11D3-8F84-00A0C9B4D50C"), InterfaceType((short) 1)]
public interface ICorPublish
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void EnumProcesses([In, ComAliasName("CorpubProcessLib.COR_PUB_ENUMPROCESS")] COR_PUB_ENUMPROCESS Type, [MarshalAs(UnmanagedType.Interface)] out ICorPublishProcessEnum ppIEnum);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetProcess([In] uint pid, [MarshalAs(UnmanagedType.Interface)] out ICorPublishProcess ppProcess);
}
}
#pragma warning restore 108, 1591

27
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/ICorPublishAppDomain.cs

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 108, 1591
namespace Debugger.Interop.CorPub
{
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
[ComImport, Guid("D6315C8F-5A6A-11D3-8F84-00A0C9B4D50C"), InterfaceType((short) 1)]
public interface ICorPublishAppDomain
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetID(out uint puId);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetName([In] uint cchName, out uint pcchName, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName);
}
}
#pragma warning restore 108, 1591

35
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/ICorPublishAppDomainEnum.cs

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 108, 1591
namespace Debugger.Interop.CorPub
{
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[ComImport, Guid("9F0C98F5-5A6A-11D3-8F84-00A0C9B4D50C"), InterfaceType((short) 1),]
public interface ICorPublishAppDomainEnum : ICorPublishEnum
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Skip([In] uint celt);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Reset();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Clone([MarshalAs(UnmanagedType.Interface)] out ICorPublishEnum ppEnum);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetCount(out uint pcelt);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Next([In] uint celt, [MarshalAs(UnmanagedType.Interface)] out ICorPublishAppDomain objects, out uint pceltFetched);
}
}
#pragma warning restore 108, 1591

30
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/ICorPublishEnum.cs

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 108, 1591
namespace Debugger.Interop.CorPub
{
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[ComImport, Guid("C0B22967-5A69-11D3-8F84-00A0C9B4D50C"), InterfaceType((short) 1)]
public interface ICorPublishEnum
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Skip([In] uint celt);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Reset();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Clone([MarshalAs(UnmanagedType.Interface)] out ICorPublishEnum ppEnum);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetCount(out uint pcelt);
}
}
#pragma warning restore 108, 1591

31
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/ICorPublishProcess.cs

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 108, 1591
namespace Debugger.Interop.CorPub
{
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
[ComImport, Guid("18D87AF1-5A6A-11D3-8F84-00A0C9B4D50C"), InterfaceType((short) 1)]
public interface ICorPublishProcess
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void IsManaged(out int pbManaged);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void EnumAppDomains([MarshalAs(UnmanagedType.Interface)] out ICorPublishAppDomainEnum ppEnum);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetProcessID(out uint pid);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetDisplayName([In] uint cchName, out uint pcchName, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName);
}
}
#pragma warning restore 108, 1591

32
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/Autogenerated/ICorPublishProcessEnum.cs

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 108, 1591
namespace Debugger.Interop.CorPub
{
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[ComImport, Guid("A37FBD41-5A69-11D3-8F84-00A0C9B4D50C"), InterfaceType((short) 1)]
public interface ICorPublishProcessEnum : ICorPublishEnum
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Skip([In] uint celt);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Reset();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Clone([MarshalAs(UnmanagedType.Interface)] out ICorPublishEnum ppEnum);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetCount(out uint pcelt);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Next([In] uint celt, [MarshalAs(UnmanagedType.Interface)] out ICorPublishProcess objects, out uint pceltFetched);
}
}
#pragma warning restore 108, 1591

34
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/ICorPublish.cs

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 1591
namespace Debugger.Core.Wrappers.CorPub
{
using System;
using System.Runtime.InteropServices;
using Debugger.Wrappers;
public partial class ICorPublish
{
private Debugger.Interop.CorPub.CorpubPublishClass corpubPublishClass;
public ICorPublish()
{
corpubPublishClass = new Debugger.Interop.CorPub.CorpubPublishClass();
}
public ICorPublishProcess GetProcess(int id)
{
Debugger.Interop.CorPub.ICorPublishProcess process;
this.corpubPublishClass.GetProcess((uint)id, out process);
return ICorPublishProcess.Wrap(process);
}
}
}
#pragma warning restore 1591

68
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorPub/ICorPublishProcess.cs

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 1591
namespace Debugger.Core.Wrappers.CorPub
{
using System;
using System.Runtime.InteropServices;
using System.Text;
using Debugger.Wrappers;
public partial class ICorPublishProcess
{
private Debugger.Interop.CorPub.ICorPublishProcess wrappedObject;
internal Debugger.Interop.CorPub.ICorPublishProcess WrappedObject
{
get
{
return this.wrappedObject;
}
}
public ICorPublishProcess(Debugger.Interop.CorPub.ICorPublishProcess wrappedObject)
{
this.wrappedObject = wrappedObject;
ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorPublishProcess));
}
public static ICorPublishProcess Wrap(Debugger.Interop.CorPub.ICorPublishProcess objectToWrap)
{
if ((objectToWrap != null))
{
return new ICorPublishProcess(objectToWrap);
} else
{
return null;
}
}
public int ProcessId
{
get
{
uint id;
wrappedObject.GetProcessID(out id);
return (int)id;
}
}
public bool IsManaged
{
get
{
int managed;
wrappedObject.IsManaged(out managed);
return managed != 0;
}
}
}
}
#pragma warning restore 1591

9
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -67,9 +67,9 @@ @@ -67,9 +67,9 @@
<Compile Include="Src\Gui\Dialogs\AsynchronousWaitDialog.Designer.cs">
<DependentUpon>AsynchronousWaitDialog.cs</DependentUpon>
</Compile>
<Compile Include="Src\Gui\Dialogs\AttachToProcessForm.cs" />
<Compile Include="Src\Gui\Dialogs\AttachToProcessForm.Designer.cs">
<DependentUpon>AttachToProcessForm.cs</DependentUpon>
<Compile Include="Src\Gui\Dialogs\AbstractAttachToProcessForm.cs" />
<Compile Include="Src\Gui\Dialogs\AbstractAttachToProcessForm.Designer.cs">
<DependentUpon>AbstractAttachToProcessForm.cs</DependentUpon>
</Compile>
<Compile Include="Src\Gui\Dialogs\ExtractInterfaceDialog.cs" />
<None Include="Src\Gui\Dialogs\ExtractInterfaceDialog.cs">
@ -715,9 +715,6 @@ @@ -715,9 +715,6 @@
<Compile Include="Src\Internal\Templates\TemplateLoadException.cs" />
<Compile Include="Src\Util\UnclosableStream.cs" />
<EmbeddedResource Include="Resources\DefaultManifest.manifest" />
<EmbeddedResource Include="Src\Gui\Dialogs\AttachToProcessForm.resx">
<DependentUpon>AttachToProcessForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Src\Gui\Dialogs\ExtractInterfaceDialog.resx">
<DependentUpon>ExtractInterfaceDialog.cs</DependentUpon>
</EmbeddedResource>

6
src/Main/Base/Project/Src/Commands/DebugCommands.cs

@ -118,11 +118,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -118,11 +118,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
{
public override void Run()
{
using (AttachToProcessForm attachForm = new AttachToProcessForm()) {
if (attachForm.ShowDialog() == DialogResult.OK) {
DebuggerService.CurrentDebugger.Attach(attachForm.Process);
}
}
DebuggerService.CurrentDebugger.ShowAttachDialog();
}
}

38
src/Main/Base/Project/Src/Gui/Dialogs/AttachToProcessForm.Designer.cs → src/Main/Base/Project/Src/Gui/Dialogs/AbstractAttachToProcessForm.Designer.cs generated

@ -1,13 +1,12 @@ @@ -1,13 +1,12 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
namespace ICSharpCode.SharpDevelop.Gui
{
partial class AttachToProcessForm
partial class AbstractAttachToProcessForm
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
@ -42,6 +41,8 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -42,6 +41,8 @@ namespace ICSharpCode.SharpDevelop.Gui
this.processColumnHeader = new System.Windows.Forms.ColumnHeader();
this.processIdColumnHeader = new System.Windows.Forms.ColumnHeader();
this.titleColumnHeader = new System.Windows.Forms.ColumnHeader();
this.typeColumnHeader = new System.Windows.Forms.ColumnHeader();
this.showNonManagedCheckBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// attachButton
@ -85,10 +86,12 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -85,10 +86,12 @@ namespace ICSharpCode.SharpDevelop.Gui
this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.processColumnHeader,
this.processIdColumnHeader,
this.titleColumnHeader});
this.titleColumnHeader,
this.typeColumnHeader});
this.listView.FullRowSelect = true;
this.listView.HideSelection = false;
this.listView.Location = new System.Drawing.Point(0, 0);
this.listView.MultiSelect = false;
this.listView.Name = "listView";
this.listView.Size = new System.Drawing.Size(636, 334);
this.listView.Sorting = System.Windows.Forms.SortOrder.Ascending;
@ -96,6 +99,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -96,6 +99,7 @@ namespace ICSharpCode.SharpDevelop.Gui
this.listView.UseCompatibleStateImageBehavior = false;
this.listView.View = System.Windows.Forms.View.Details;
this.listView.ItemActivate += new System.EventHandler(this.ListViewItemActivate);
this.listView.SelectedIndexChanged += new System.EventHandler(this.ListViewSelectedIndexChanged);
//
// processColumnHeader
//
@ -109,7 +113,24 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -109,7 +113,24 @@ namespace ICSharpCode.SharpDevelop.Gui
// titleColumnHeader
//
this.titleColumnHeader.Text = "Title";
this.titleColumnHeader.Width = 337;
this.titleColumnHeader.Width = 294;
//
// typeColumnHeader
//
this.typeColumnHeader.Text = "Type";
this.typeColumnHeader.Width = 74;
//
// showNonManagedCheckBox
//
this.showNonManagedCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.showNonManagedCheckBox.Location = new System.Drawing.Point(13, 339);
this.showNonManagedCheckBox.Name = "showNonManagedCheckBox";
this.showNonManagedCheckBox.Size = new System.Drawing.Size(370, 24);
this.showNonManagedCheckBox.TabIndex = 5;
this.showNonManagedCheckBox.Text = "Show Non-Managed";
this.showNonManagedCheckBox.UseVisualStyleBackColor = true;
this.showNonManagedCheckBox.CheckedChanged += new System.EventHandler(this.ShowNonManagedCheckBoxCheckedChanged);
//
// AttachToProcessForm
//
@ -118,17 +139,20 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -118,17 +139,20 @@ namespace ICSharpCode.SharpDevelop.Gui
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(637, 374);
this.Controls.Add(this.showNonManagedCheckBox);
this.Controls.Add(this.listView);
this.Controls.Add(this.refreshButton);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.attachButton);
this.MinimumSize = new System.Drawing.Size(273, 140);
this.Name = "AttachToProcessForm";
this.MinimumSize = new System.Drawing.Size(273, 240);
this.Name = "bstractAAttachToProcessForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "Attach to Process";
this.ResumeLayout(false);
}
private System.Windows.Forms.CheckBox showNonManagedCheckBox;
private System.Windows.Forms.ColumnHeader typeColumnHeader;
private System.Windows.Forms.ColumnHeader titleColumnHeader;
private System.Windows.Forms.ColumnHeader processIdColumnHeader;
private System.Windows.Forms.ColumnHeader processColumnHeader;

43
src/Main/Base/Project/Src/Gui/Dialogs/AttachToProcessForm.cs → src/Main/Base/Project/Src/Gui/Dialogs/AbstractAttachToProcessForm.cs

@ -7,18 +7,17 @@ @@ -7,18 +7,17 @@
using System;
using System.Diagnostics;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Debugging;
namespace ICSharpCode.SharpDevelop.Gui
{
public partial class AttachToProcessForm : Form
{
public AttachToProcessForm()
public partial class AbstractAttachToProcessForm : Form
{
public AbstractAttachToProcessForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
@ -32,29 +31,15 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -32,29 +31,15 @@ namespace ICSharpCode.SharpDevelop.Gui
public System.Diagnostics.Process Process {
get { return GetSelectedProcess(); }
}
protected virtual void RefreshProcessList(ListView listView, bool showNonManaged)
{
}
void RefreshProcessList()
{
listView.Items.Clear();
Process currentProcess = Process.GetCurrentProcess();
foreach (System.Diagnostics.Process process in System.Diagnostics.Process.GetProcesses()) {
try {
// Prevent attaching to our own process.
if (currentProcess.Id != process.Id) {
string fileName = Path.GetFileName(process.MainModule.FileName);
ListViewItem item = new ListViewItem(fileName);
item.SubItems.Add(process.Id.ToString());
item.SubItems.Add(process.MainWindowTitle);
item.Tag = process;
listView.Items.Add(item);
}
} catch (Win32Exception) {
// Do nothing.
}
}
RefreshProcessList(listView, showNonManagedCheckBox.Checked);
listView.Sort();
if (listView.Items.Count > 0) {
listView.Items[0].Selected = true;
} else {
@ -95,5 +80,15 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -95,5 +80,15 @@ namespace ICSharpCode.SharpDevelop.Gui
Close();
}
}
void ShowNonManagedCheckBoxCheckedChanged(object sender, EventArgs e)
{
RefreshProcessList();
}
void ListViewSelectedIndexChanged(object sender, EventArgs e)
{
attachButton.Enabled = listView.SelectedItems.Count > 0;
}
}
}

120
src/Main/Base/Project/Src/Gui/Dialogs/AttachToProcessForm.resx

@ -1,120 +0,0 @@ @@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

4
src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs

@ -53,6 +53,10 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -53,6 +53,10 @@ namespace ICSharpCode.SharpDevelop.Debugging
}
}
public void ShowAttachDialog()
{
}
public void Attach(Process process)
{
}

10
src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs

@ -55,11 +55,19 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -55,11 +55,19 @@ namespace ICSharpCode.SharpDevelop.Debugging
void StepOver();
void StepOut();
/// <summary>
/// Shows a dialog so the user can attach to a process.
/// </summary>
void ShowAttachDialog();
/// <summary>
/// Used to attach to an existing process.
/// </summary>
void Attach(Process process);
void Detach();
/// <summary>
/// Gets the current value of the variable as string that can be displayed in tooltips.
/// </summary>

BIN
src/Main/StartUp/Project/Resources/StringResources.resources

Binary file not shown.
Loading…
Cancel
Save