Browse Source

Reimplemented COM object tracking. Fixed remaining compile errors.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5140 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 16 years ago
parent
commit
9686a82a01
  1. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  2. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Eval.cs
  3. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/MTA2STA.cs
  4. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs
  5. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackProxy.cs
  6. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackSwitch.cs
  7. 89
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/Common.cs
  8. 72
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug.cs
  9. 9
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.cs
  10. 108
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.generated.cs
  11. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorPublishExtensionMethods.cs
  12. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorPublishExtensionMethods.generated.cs
  13. 72
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSym.cs
  14. 5
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.cs
  15. 86
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.generated.cs
  16. 15
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/MetaDataWrapper.cs
  17. 114
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/ResourceManager.cs
  18. 61
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/TrackedComObjects.cs
  19. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/MetaData/DebugType.cs
  20. 5
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Module.cs
  21. 12
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/NDebugger.cs
  22. 5
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/StackFrame.cs
  23. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Stepper.cs
  24. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Thread.cs
  25. 2
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ControlFlow_Stepping.cs
  26. 37
      src/Tools/ComExtensionMethodGenerator/ComExtensionMethodGenerator.cs

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

@ -74,6 +74,7 @@ @@ -74,6 +74,7 @@
<Compile Include="Src\Internal\ManagedCallbackProxy.cs" />
<Compile Include="Src\Internal\ManagedCallbackSwitch.cs" />
<Compile Include="Src\Internal\MTA2STA.cs" />
<Compile Include="Src\Interop\Common.cs" />
<Compile Include="Src\Interop\CorDebug.cs" />
<Compile Include="Src\Interop\CorDebugExtensionMethods.cs" />
<Compile Include="Src\Interop\CorDebugExtensionMethods.generated.cs" />
@ -86,7 +87,7 @@ @@ -86,7 +87,7 @@
<Compile Include="Src\Interop\MetaData.cs" />
<Compile Include="Src\Interop\MetaDataWrapper.cs" />
<Compile Include="Src\Interop\NativeMethods.cs" />
<Compile Include="Src\Interop\ResourceManager.cs" />
<Compile Include="Src\Interop\TrackedComObjects.cs" />
<Compile Include="Src\Interop\Util.cs" />
<Compile Include="Src\MetaData\DebugFieldInfo.cs" />
<Compile Include="Src\MetaData\DebugLocalVariableInfo.cs" />

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Eval.cs

@ -11,7 +11,6 @@ using System.Runtime.InteropServices; @@ -11,7 +11,6 @@ using System.Runtime.InteropServices;
using Debugger.MetaData;
using Debugger.Interop.CorDebug;
using CorElementType = Debugger.Interop.CorDebug.CorElementType;
namespace Debugger
{

3
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/MTA2STA.cs

@ -212,7 +212,8 @@ namespace Debugger.Internal @@ -212,7 +212,8 @@ namespace Debugger.Internal
}
// Marshal a COM object
object comObject = Marshal.GetObjectForIUnknown(param);
return Activator.CreateInstance(outputType, comObject);
Debugger.Interop.TrackedComObjects.Track(comObject);
return comObject;
}
/// <summary>

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs

@ -12,12 +12,10 @@ @@ -12,12 +12,10 @@
// Replace with:
// \1\2\n\1{\n\1\tEnterCallback(PausedReason.Other, "\3");\n\1\t\n\1\tExitCallback_Continue();\n\1}
using Debugger.Interop;
using System;
using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug;
using CorDebugStepReason = Debugger.Interop.CorDebug.CorDebugStepReason;
using CorDebugExceptionCallbackType = Debugger.Interop.CorDebug.CorDebugExceptionCallbackType;
using CorDebugExceptionUnwindCallbackType = Debugger.Interop.CorDebug.CorDebugExceptionUnwindCallbackType;
namespace Debugger.Internal
{

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackProxy.cs

@ -7,10 +7,8 @@ @@ -7,10 +7,8 @@
using System;
using System.Windows.Forms;
using Debugger.Interop;
using Debugger.Interop.CorDebug;
using CorDebugStepReason = Debugger.Interop.CorDebug.CorDebugStepReason;
using CorDebugExceptionCallbackType = Debugger.Interop.CorDebug.CorDebugExceptionCallbackType;
using CorDebugExceptionUnwindCallbackType = Debugger.Interop.CorDebug.CorDebugExceptionUnwindCallbackType;
// Regular expresion:
// ^{\t*}{(:Ll| )*{:i} *\(((.# {:i}, |\))|())^6\)*}\n\t*\{(.|\n)@\t\}

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackSwitch.cs

@ -12,12 +12,10 @@ @@ -12,12 +12,10 @@
// Replace with:
// \1\2\n\1{\n\1\tGetProcessCallbackInterface(\4).\3(\4, \5, \6, \7, \8, \9);\n\1}
using Debugger.Interop;
using System;
using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug;
using CorDebugStepReason = Debugger.Interop.CorDebug.CorDebugStepReason;
using CorDebugExceptionCallbackType = Debugger.Interop.CorDebug.CorDebugExceptionCallbackType;
using CorDebugExceptionUnwindCallbackType = Debugger.Interop.CorDebug.CorDebugExceptionUnwindCallbackType;
namespace Debugger.Internal
{

89
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/Common.cs

@ -0,0 +1,89 @@ @@ -0,0 +1,89 @@
// <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
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Debugger.Interop
{
// These are used in both CorDebug and CorSym
[StructLayout(LayoutKind.Sequential, Pack=4)]
public struct _FILETIME
{
public uint dwLowDateTime;
public uint dwHighDateTime;
}
[StructLayout(LayoutKind.Sequential, Pack=8)]
public struct _LARGE_INTEGER
{
public long QuadPart;
}
[StructLayout(LayoutKind.Sequential, Pack=8)]
public struct _ULARGE_INTEGER
{
public ulong QuadPart;
}
[ComImport, Guid("0C733A30-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType((short) 1)]
public interface ISequentialStream
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteRead(out byte pv, [In] uint cb, out uint pcbRead);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteWrite([In] ref byte pv, [In] uint cb, out uint pcbWritten);
}
[ComImport, InterfaceType((short) 1), Guid("0000000C-0000-0000-C000-000000000046")]
public interface IStream : ISequentialStream
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteRead(out byte pv, [In] uint cb, out uint pcbRead);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteWrite([In] ref byte pv, [In] uint cb, out uint pcbWritten);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteSeek([In] _LARGE_INTEGER dlibMove, [In] uint dwOrigin, out _ULARGE_INTEGER plibNewPosition);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __SetSize([In] _ULARGE_INTEGER libNewSize);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteCopyTo([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In] _ULARGE_INTEGER cb, out _ULARGE_INTEGER pcbRead, out _ULARGE_INTEGER pcbWritten);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Commit([In] uint grfCommitFlags);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Revert();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __LockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] uint dwLockType);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __UnlockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] uint dwLockType);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Stat(out tagSTATSTG pstatstg, [In] uint grfStatFlag);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Clone([MarshalAs(UnmanagedType.Interface)] out IStream ppstm);
}
[StructLayout(LayoutKind.Sequential, Pack=8)]
public struct tagSTATSTG
{
[MarshalAs(UnmanagedType.LPWStr)]
public string pwcsName;
public uint type;
public _ULARGE_INTEGER cbSize;
public _FILETIME mtime;
public _FILETIME ctime;
public _FILETIME atime;
public uint grfMode;
public uint grfLocksSupported;
public Guid clsid;
public uint grfStateBits;
public uint reserved;
}
}

72
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug.cs

@ -30,19 +30,6 @@ namespace Debugger.Interop.CorDebug @@ -30,19 +30,6 @@ namespace Debugger.Interop.CorDebug
public uint dwSubBuild;
}
[StructLayout(LayoutKind.Sequential, Pack=4)]
public struct _FILETIME
{
public uint dwLowDateTime;
public uint dwHighDateTime;
}
[StructLayout(LayoutKind.Sequential, Pack=8)]
public struct _LARGE_INTEGER
{
public long QuadPart;
}
[StructLayout(LayoutKind.Sequential, Pack=4)]
public struct _SECURITY_ATTRIBUTES
{
@ -51,12 +38,6 @@ namespace Debugger.Interop.CorDebug @@ -51,12 +38,6 @@ namespace Debugger.Interop.CorDebug
public int bInheritHandle;
}
[StructLayout(LayoutKind.Sequential, Pack=8)]
public struct _ULARGE_INTEGER
{
public ulong QuadPart;
}
[StructLayout(LayoutKind.Sequential, Pack=4)]
public struct COR_DEBUG_STEP_RANGE
{
@ -1635,59 +1616,6 @@ namespace Debugger.Interop.CorDebug @@ -1635,59 +1616,6 @@ namespace Debugger.Interop.CorDebug
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Next([In] uint celt, [Out] IntPtr values, out uint pceltFetched);
}
[ComImport, Guid("0C733A30-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType((short) 1)]
public interface ISequentialStream
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteRead(out byte pv, [In] uint cb, out uint pcbRead);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteWrite([In] ref byte pv, [In] uint cb, out uint pcbWritten);
}
[ComImport, Guid("0000000C-0000-0000-C000-000000000046"), InterfaceType((short) 1)]
public interface IStream : ISequentialStream
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteRead(out byte pv, [In] uint cb, out uint pcbRead);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteWrite([In] ref byte pv, [In] uint cb, out uint pcbWritten);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteSeek([In] _LARGE_INTEGER dlibMove, [In] uint dwOrigin, out _ULARGE_INTEGER plibNewPosition);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __SetSize([In] _ULARGE_INTEGER libNewSize);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteCopyTo([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In] _ULARGE_INTEGER cb, out _ULARGE_INTEGER pcbRead, out _ULARGE_INTEGER pcbWritten);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Commit([In] uint grfCommitFlags);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Revert();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __LockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] uint dwLockType);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __UnlockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] uint dwLockType);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Stat(out tagSTATSTG pstatstg, [In] uint grfStatFlag);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Clone([MarshalAs(UnmanagedType.Interface)] out IStream ppstm);
}
[StructLayout(LayoutKind.Sequential, Pack=8)]
public struct tagSTATSTG
{
[MarshalAs(UnmanagedType.LPWStr)]
public string pwcsName;
public uint type;
public _ULARGE_INTEGER cbSize;
public _FILETIME mtime;
public _FILETIME ctime;
public _FILETIME atime;
public uint grfMode;
public uint grfLocksSupported;
public Guid clsid;
public uint grfStateBits;
public uint reserved;
}
}
#pragma warning restore 108, 1591

9
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.cs

@ -31,6 +31,11 @@ namespace Debugger.Interop.CorDebug @@ -31,6 +31,11 @@ namespace Debugger.Interop.CorDebug
return obj as T;
}
static void ProcessOutParameter(object parameter)
{
TrackedComObjects.ProcessOutParameter(parameter);
}
// ICorDebugArrayValue
public static unsafe uint[] GetDimensions(this ICorDebugArrayValue corArray)
@ -215,9 +220,7 @@ namespace Debugger.Interop.CorDebug @@ -215,9 +220,7 @@ namespace Debugger.Interop.CorDebug
public static bool HasQueuedCallbacks(this ICorDebugProcess corProcess)
{
int pbQueued;
corProcess.HasQueuedCallbacks(null, out pbQueued);
return pbQueued != 0;
return corProcess.HasQueuedCallbacks(null) != 0;
}
// ICorDebugStepper

108
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.generated.cs

@ -13,10 +13,6 @@ namespace Debugger.Interop.CorDebug @@ -13,10 +13,6 @@ namespace Debugger.Interop.CorDebug
{
public static partial class CorDebugExtensionMethods
{
static void ProcessOutParameter(object parameter)
{
}
public static void CanLaunchOrAttach(this CorDebugClass instance, uint dwProcessId, int win32DebuggingEnabled)
{
instance.__CanLaunchOrAttach(dwProcessId, win32DebuggingEnabled);
@ -386,7 +382,7 @@ namespace Debugger.Interop.CorDebug @@ -386,7 +382,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
public static uint GetType(this ICorDebugArrayValue instance)
public static uint GetTheType(this ICorDebugArrayValue instance)
{
uint pType;
instance.__GetType(out pType);
@ -557,7 +553,7 @@ namespace Debugger.Interop.CorDebug @@ -557,7 +553,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
public static uint GetType(this ICorDebugBoxValue instance)
public static uint GetTheType(this ICorDebugBoxValue instance)
{
uint pType;
instance.__GetType(out pType);
@ -908,7 +904,7 @@ namespace Debugger.Interop.CorDebug @@ -908,7 +904,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
public static uint GetType(this ICorDebugContext instance)
public static uint GetTheType(this ICorDebugContext instance)
{
uint pType;
instance.__GetType(out pType);
@ -1469,7 +1465,7 @@ namespace Debugger.Interop.CorDebug @@ -1469,7 +1465,7 @@ namespace Debugger.Interop.CorDebug
return pnOffset;
}
public static uint GetType(this ICorDebugGenericValue instance)
public static uint GetTheType(this ICorDebugGenericValue instance)
{
uint pType;
instance.__GetType(out pType);
@ -1508,7 +1504,7 @@ namespace Debugger.Interop.CorDebug @@ -1508,7 +1504,7 @@ namespace Debugger.Interop.CorDebug
instance.__SetValue(pFrom);
}
public static uint GetType(this ICorDebugHandleValue instance)
public static uint GetTheType(this ICorDebugHandleValue instance)
{
uint pType;
instance.__GetType(out pType);
@ -1585,7 +1581,7 @@ namespace Debugger.Interop.CorDebug @@ -1585,7 +1581,7 @@ namespace Debugger.Interop.CorDebug
instance.__Dispose();
}
public static uint GetType(this ICorDebugHeapValue instance)
public static uint GetTheType(this ICorDebugHeapValue instance)
{
uint pType;
instance.__GetType(out pType);
@ -2400,7 +2396,7 @@ namespace Debugger.Interop.CorDebug @@ -2400,7 +2396,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
public static uint GetType(this ICorDebugObjectValue instance)
public static uint GetTheType(this ICorDebugObjectValue instance)
{
uint pType;
instance.__GetType(out pType);
@ -2747,7 +2743,7 @@ namespace Debugger.Interop.CorDebug @@ -2747,7 +2743,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
public static uint GetType(this ICorDebugReferenceValue instance)
public static uint GetTheType(this ICorDebugReferenceValue instance)
{
uint pType;
instance.__GetType(out pType);
@ -2917,7 +2913,7 @@ namespace Debugger.Interop.CorDebug @@ -2917,7 +2913,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
public static uint GetType(this ICorDebugStringValue instance)
public static uint GetTheType(this ICorDebugStringValue instance)
{
uint pType;
instance.__GetType(out pType);
@ -3156,7 +3152,7 @@ namespace Debugger.Interop.CorDebug @@ -3156,7 +3152,7 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
public static uint GetType(this ICorDebugType instance)
public static uint GetTheType(this ICorDebugType instance)
{
uint ty;
instance.__GetType(out ty);
@ -3248,7 +3244,7 @@ namespace Debugger.Interop.CorDebug @@ -3248,7 +3244,7 @@ namespace Debugger.Interop.CorDebug
instance.__DebugEvent(pDebugEvent, fOutOfBand);
}
public static uint GetType(this ICorDebugValue instance)
public static uint GetTheType(this ICorDebugValue instance)
{
uint pType;
instance.__GetType(out pType);
@ -3337,87 +3333,5 @@ namespace Debugger.Interop.CorDebug @@ -3337,87 +3333,5 @@ namespace Debugger.Interop.CorDebug
return pceltFetched;
}
public static void RemoteRead(this ISequentialStream instance, out byte pv, uint cb, out uint pcbRead)
{
instance.__RemoteRead(out pv, cb, out pcbRead);
ProcessOutParameter(pv);
}
public static uint RemoteWrite(this ISequentialStream instance, ref byte pv, uint cb)
{
uint pcbWritten;
instance.__RemoteWrite(ref pv, cb, out pcbWritten);
ProcessOutParameter(pv);
return pcbWritten;
}
public static void RemoteRead(this IStream instance, out byte pv, uint cb, out uint pcbRead)
{
instance.__RemoteRead(out pv, cb, out pcbRead);
ProcessOutParameter(pv);
}
public static uint RemoteWrite(this IStream instance, ref byte pv, uint cb)
{
uint pcbWritten;
instance.__RemoteWrite(ref pv, cb, out pcbWritten);
ProcessOutParameter(pv);
return pcbWritten;
}
public static _ULARGE_INTEGER RemoteSeek(this IStream instance, _LARGE_INTEGER dlibMove, uint dwOrigin)
{
_ULARGE_INTEGER plibNewPosition;
instance.__RemoteSeek(dlibMove, dwOrigin, out plibNewPosition);
ProcessOutParameter(plibNewPosition);
return plibNewPosition;
}
public static void SetSize(this IStream instance, _ULARGE_INTEGER libNewSize)
{
instance.__SetSize(libNewSize);
}
public static void RemoteCopyTo(this IStream instance, IStream pstm, _ULARGE_INTEGER cb, out _ULARGE_INTEGER pcbRead, out _ULARGE_INTEGER pcbWritten)
{
instance.__RemoteCopyTo(pstm, cb, out pcbRead, out pcbWritten);
ProcessOutParameter(pcbRead);
ProcessOutParameter(pcbWritten);
}
public static void Commit(this IStream instance, uint grfCommitFlags)
{
instance.__Commit(grfCommitFlags);
}
public static void Revert(this IStream instance)
{
instance.__Revert();
}
public static void LockRegion(this IStream instance, _ULARGE_INTEGER libOffset, _ULARGE_INTEGER cb, uint dwLockType)
{
instance.__LockRegion(libOffset, cb, dwLockType);
}
public static void UnlockRegion(this IStream instance, _ULARGE_INTEGER libOffset, _ULARGE_INTEGER cb, uint dwLockType)
{
instance.__UnlockRegion(libOffset, cb, dwLockType);
}
public static void Stat(this IStream instance, out tagSTATSTG pstatstg, uint grfStatFlag)
{
instance.__Stat(out pstatstg, grfStatFlag);
ProcessOutParameter(pstatstg);
}
public static IStream Clone(this IStream instance)
{
IStream ppstm;
instance.__Clone(out ppstm);
ProcessOutParameter(ppstm);
return ppstm;
}
}
}

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorPublishExtensionMethods.cs

@ -11,5 +11,9 @@ namespace Debugger.Interop.CorPublish @@ -11,5 +11,9 @@ namespace Debugger.Interop.CorPublish
{
public static partial class CorPublishExtensionMethods
{
static void ProcessOutParameter(object parameter)
{
TrackedComObjects.ProcessOutParameter(parameter);
}
}
}

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorPublishExtensionMethods.generated.cs

@ -14,10 +14,6 @@ namespace Debugger.Interop.CorPublish @@ -14,10 +14,6 @@ namespace Debugger.Interop.CorPublish
{
public static partial class CorPublishExtensionMethods
{
static void ProcessOutParameter(object parameter)
{
}
public static ICorPublishEnum Clone(this CorpubPublishClass instance)
{
ICorPublishEnum ppEnum;

72
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSym.cs

@ -381,42 +381,6 @@ namespace Debugger.Interop.CorSym @@ -381,42 +381,6 @@ namespace Debugger.Interop.CorSym
}
[ComImport, Guid("0C733A30-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType((short) 1)]
public interface ISequentialStream
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteRead(out byte pv, [In] uint cb, out uint pcbRead);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteWrite([In] ref byte pv, [In] uint cb, out uint pcbWritten);
}
[ComImport, InterfaceType((short) 1), Guid("0000000C-0000-0000-C000-000000000046")]
public interface IStream : ISequentialStream
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteRead(out byte pv, [In] uint cb, out uint pcbRead);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteWrite([In] ref byte pv, [In] uint cb, out uint pcbWritten);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteSeek([In] _LARGE_INTEGER dlibMove, [In] uint dwOrigin, out _ULARGE_INTEGER plibNewPosition);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __SetSize([In] _ULARGE_INTEGER libNewSize);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __RemoteCopyTo([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In] _ULARGE_INTEGER cb, out _ULARGE_INTEGER pcbRead, out _ULARGE_INTEGER pcbWritten);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Commit([In] uint grfCommitFlags);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Revert();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __LockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] uint dwLockType);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __UnlockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] uint dwLockType);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Stat(out tagSTATSTG pstatstg, [In] uint grfStatFlag);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __Clone([MarshalAs(UnmanagedType.Interface)] out IStream ppstm);
}
[ComImport, InterfaceType((short) 1), Guid("AA544D42-28CB-11D3-BD22-0000F80849BD")]
public interface ISymUnmanagedBinder
{
@ -729,42 +693,6 @@ namespace Debugger.Interop.CorSym @@ -729,42 +693,6 @@ namespace Debugger.Interop.CorSym
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void __DefineConstant2([In] IntPtr name, [In, MarshalAs(UnmanagedType.Struct)] object value, [In] uint sigToken);
}
[StructLayout(LayoutKind.Sequential, Pack=4)]
public struct _FILETIME
{
public uint dwLowDateTime;
public uint dwHighDateTime;
}
[StructLayout(LayoutKind.Sequential, Pack=8)]
public struct _LARGE_INTEGER
{
public long QuadPart;
}
[StructLayout(LayoutKind.Sequential, Pack=8)]
public struct _ULARGE_INTEGER
{
public ulong QuadPart;
}
[StructLayout(LayoutKind.Sequential, Pack=8)]
public struct tagSTATSTG
{
[MarshalAs(UnmanagedType.LPWStr)]
public string pwcsName;
public uint type;
public _ULARGE_INTEGER cbSize;
public _FILETIME mtime;
public _FILETIME ctime;
public _FILETIME atime;
public uint grfMode;
public uint grfLocksSupported;
public Guid clsid;
public uint grfStateBits;
public uint reserved;
}
}
#pragma warning restore 108, 1591

5
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.cs

@ -12,6 +12,11 @@ namespace Debugger.Interop.CorSym @@ -12,6 +12,11 @@ namespace Debugger.Interop.CorSym
{
public static partial class CorSymExtensionMethods
{
static void ProcessOutParameter(object parameter)
{
TrackedComObjects.ProcessOutParameter(parameter);
}
// ISymUnmanagedBinder
public static ISymUnmanagedReader GetReaderForFile(this ISymUnmanagedBinder symBinder, object importer, string filename, string searchPath)

86
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.generated.cs

@ -13,10 +13,6 @@ namespace Debugger.Interop.CorSym @@ -13,10 +13,6 @@ namespace Debugger.Interop.CorSym
{
public static partial class CorSymExtensionMethods
{
static void ProcessOutParameter(object parameter)
{
}
public static ISymUnmanagedReader GetReaderForFile(this CorSymBinder_SxSClass instance, object importer, IntPtr filename, IntPtr searchPath)
{
ISymUnmanagedReader returnValue = instance.__GetReaderForFile(importer, filename, searchPath);
@ -493,88 +489,6 @@ namespace Debugger.Interop.CorSym @@ -493,88 +489,6 @@ namespace Debugger.Interop.CorSym
instance.__UsingNamespace(fullName);
}
public static void RemoteRead(this ISequentialStream instance, out byte pv, uint cb, out uint pcbRead)
{
instance.__RemoteRead(out pv, cb, out pcbRead);
ProcessOutParameter(pv);
}
public static uint RemoteWrite(this ISequentialStream instance, ref byte pv, uint cb)
{
uint pcbWritten;
instance.__RemoteWrite(ref pv, cb, out pcbWritten);
ProcessOutParameter(pv);
return pcbWritten;
}
public static void RemoteRead(this IStream instance, out byte pv, uint cb, out uint pcbRead)
{
instance.__RemoteRead(out pv, cb, out pcbRead);
ProcessOutParameter(pv);
}
public static uint RemoteWrite(this IStream instance, ref byte pv, uint cb)
{
uint pcbWritten;
instance.__RemoteWrite(ref pv, cb, out pcbWritten);
ProcessOutParameter(pv);
return pcbWritten;
}
public static _ULARGE_INTEGER RemoteSeek(this IStream instance, _LARGE_INTEGER dlibMove, uint dwOrigin)
{
_ULARGE_INTEGER plibNewPosition;
instance.__RemoteSeek(dlibMove, dwOrigin, out plibNewPosition);
ProcessOutParameter(plibNewPosition);
return plibNewPosition;
}
public static void SetSize(this IStream instance, _ULARGE_INTEGER libNewSize)
{
instance.__SetSize(libNewSize);
}
public static void RemoteCopyTo(this IStream instance, IStream pstm, _ULARGE_INTEGER cb, out _ULARGE_INTEGER pcbRead, out _ULARGE_INTEGER pcbWritten)
{
instance.__RemoteCopyTo(pstm, cb, out pcbRead, out pcbWritten);
ProcessOutParameter(pcbRead);
ProcessOutParameter(pcbWritten);
}
public static void Commit(this IStream instance, uint grfCommitFlags)
{
instance.__Commit(grfCommitFlags);
}
public static void Revert(this IStream instance)
{
instance.__Revert();
}
public static void LockRegion(this IStream instance, _ULARGE_INTEGER libOffset, _ULARGE_INTEGER cb, uint dwLockType)
{
instance.__LockRegion(libOffset, cb, dwLockType);
}
public static void UnlockRegion(this IStream instance, _ULARGE_INTEGER libOffset, _ULARGE_INTEGER cb, uint dwLockType)
{
instance.__UnlockRegion(libOffset, cb, dwLockType);
}
public static void Stat(this IStream instance, out tagSTATSTG pstatstg, uint grfStatFlag)
{
instance.__Stat(out pstatstg, grfStatFlag);
ProcessOutParameter(pstatstg);
}
public static IStream Clone(this IStream instance)
{
IStream ppstm;
instance.__Clone(out ppstm);
ProcessOutParameter(ppstm);
return ppstm;
}
public static ISymUnmanagedReader GetReaderForFile(this ISymUnmanagedBinder instance, object importer, IntPtr filename, IntPtr searchPath)
{
ISymUnmanagedReader returnValue = instance.__GetReaderForFile(importer, filename, searchPath);

15
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/MetaDataWrapper.cs

@ -28,25 +28,25 @@ namespace Debugger.Interop.MetaData @@ -28,25 +28,25 @@ namespace Debugger.Interop.MetaData
{
Guid guid = new Guid("{ 0x7dac8207, 0xd3ae, 0x4c75, { 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44 } }");
metaData = (IMetaDataImport)pModule.GetMetaDataInterface(ref guid);
ResourceManager.TrackCOMObject(metaData, typeof(IMetaDataImport));
TrackedComObjects.Track(metaData);
}
public ISymUnmanagedReader GetSymReader(string fullname, string searchPath)
{
try {
// TODO: Track
ISymUnmanagedBinder symBinder = new Debugger.Interop.CorSym.CorSymBinder_SxSClass();
TrackedComObjects.Track(symBinder);
return symBinder.GetReaderForFile(metaData, fullname, searchPath);
} catch {
return null;
}
}
public ISymUnmanagedReader GetSymReader(Debugger.Interop.CorSym.IStream stream)
public ISymUnmanagedReader GetSymReader(IStream stream)
{
try {
// TODO: Track
ISymUnmanagedBinder symBinder = new Debugger.Interop.CorSym.CorSymBinder_SxSClass();
TrackedComObjects.Track(symBinder);
return symBinder.GetReaderFromStream(metaData, stream);
} catch {
return null;
@ -60,16 +60,15 @@ namespace Debugger.Interop.MetaData @@ -60,16 +60,15 @@ namespace Debugger.Interop.MetaData
public void Dispose()
{
if (metaData != null) {
ResourceManager.ReleaseCOMObject(metaData, typeof(IMetaDataImport));
IMetaDataImport m = this.metaData;
if (m != null) {
Marshal.ReleaseComObject(m);
metaData = null;
}
}
// CloseEnum, CountEnum and ResetEnum are not wrapped
public uint[] EnumCustomAttributes(uint token_Scope, uint token_TypeOfAttributes)
{
return EnumerateTokens(metaData.EnumCustomAttributes, token_Scope, token_TypeOfAttributes);

114
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/ResourceManager.cs

@ -1,114 +0,0 @@ @@ -1,114 +0,0 @@
// <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
using Debugger.Internal;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Debugger.Interop;
namespace Debugger.Interop
{
class TrackedObjectMetaData
{
public Type ObjectType;
public int RefCount;
public TrackedObjectMetaData(Type objectType, int refCount)
{
this.ObjectType = objectType;
this.RefCount = refCount;
}
}
public static class ResourceManager
{
static MTA2STA mta2sta = new MTA2STA();
static bool trace = false;
static Dictionary<object, TrackedObjectMetaData> trackedCOMObjects = new Dictionary<object, TrackedObjectMetaData>();
public static bool TraceMessagesEnabled {
get {
return trace;
}
set {
trace = value;
}
}
public static void TrackCOMObject(object comObject, Type type)
{
if (comObject == null || !Marshal.IsComObject(comObject)) {
if (trace) Trace("Will not be tracked: {0}", type.Name);
} else {
TrackedObjectMetaData metaData;
if (trackedCOMObjects.TryGetValue(comObject, out metaData)) {
metaData.RefCount += 1;
} else {
metaData = new TrackedObjectMetaData(type,1);
trackedCOMObjects.Add(comObject, metaData);
}
if (trace) Trace("AddRef {0,2}: {1}", metaData.RefCount, type.Name);
}
}
public static void ReleaseCOMObject(object comObject, Type type)
{
// Ensure that the release is done synchronosly
try {
mta2sta.AsyncCall(delegate {
ReleaseCOMObjectInternal(comObject, type);
});
} catch (InvalidOperationException) {
// This might happen when the application is shuting down
}
}
static void ReleaseCOMObjectInternal(object comObject, Type type)
{
TrackedObjectMetaData metaData;
if (comObject != null && trackedCOMObjects.TryGetValue(comObject, out metaData)) {
metaData.RefCount -= 1;
if (metaData.RefCount == 0) {
Marshal.FinalReleaseComObject(comObject);
trackedCOMObjects.Remove(comObject);
}
if (trace) Trace("Release {0,2}: {1}", metaData.RefCount, type.Name);
} else {
if (trace) Trace("Was not tracked: {0}", type.Name);
}
}
public static void ReleaseAllTrackedCOMObjects()
{
if (trace) Trace("Releasing {0} tracked COM objects... ", trackedCOMObjects.Count);
while(trackedCOMObjects.Count > 0) {
foreach (KeyValuePair<object, TrackedObjectMetaData> pair in trackedCOMObjects) {
Marshal.FinalReleaseComObject(pair.Key);
if (trace) Trace(" * Releasing {0} ({1} references)", pair.Value.ObjectType.Name, pair.Value.RefCount);
trackedCOMObjects.Remove(pair.Key);
break;
}
}
if (trace) Trace(" * Done");
}
public static event EventHandler<MessageEventArgs> TraceMessage;
static void Trace(string msg, params object[] pars)
{
if (TraceMessage != null && trace) {
string message = String.Format("COM({0,-3}): {1}", trackedCOMObjects.Count, String.Format(msg, pars));
TraceMessage(null, new MessageEventArgs(null, message));
}
}
}
}
#pragma warning restore 1591

61
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/TrackedComObjects.cs

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
// <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
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Debugger.Interop
{
public static class TrackedComObjects
{
static List<WeakReference> objects = new List<WeakReference>();
public static void ProcessOutParameter(object parameter)
{
if (parameter != null) {
if (Marshal.IsComObject(parameter)) {
Track(parameter);
} else if (parameter is Array) {
foreach(object elem in (Array)parameter) {
ProcessOutParameter(elem);
}
}
}
}
public static void Track(object obj)
{
if (Marshal.IsComObject(obj)) {
lock(objects) {
objects.Add(new WeakReference(obj));
}
}
}
public static int ReleaseAll()
{
lock(objects) {
int count = 0;
foreach(WeakReference weakRef in objects) {
object obj = weakRef.Target;
if (obj != null) {
Marshal.FinalReleaseComObject(obj);
count++;
}
}
objects.Clear();
objects.TrimExcess();
return count;
}
}
}
}
#pragma warning restore 1591

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/MetaData/DebugType.cs

@ -15,8 +15,6 @@ using Debugger.Interop.CorDebug; @@ -15,8 +15,6 @@ using Debugger.Interop.CorDebug;
using Debugger.Interop.MetaData;
using ICSharpCode.NRefactory.Ast;
using Mono.Cecil.Signatures;
using CorElementType = Debugger.Interop.CorDebug.CorElementType;
using CorTokenType = Debugger.Interop.MetaData.CorTokenType;
namespace Debugger.MetaData
{
@ -951,7 +949,7 @@ namespace Debugger.MetaData @@ -951,7 +949,7 @@ namespace Debugger.MetaData
public static DebugType CreateFromCorType(AppDomain appDomain, ICorDebugType corType)
{
// Convert primitive type to class
CorElementType corElemType = (CorElementType)(corType.GetType());
CorElementType corElemType = (CorElementType)(corType.GetTheType());
Type primitiveType = CorElementTypeToManagedType(corElemType);
if (primitiveType != null) {
corType = CreateFromType(appDomain.Mscorlib, primitiveType).CorType;
@ -971,7 +969,7 @@ namespace Debugger.MetaData @@ -971,7 +969,7 @@ namespace Debugger.MetaData
DateTime startTime = Util.HighPrecisionTimer.Now;
this.corType = corType;
this.corElementType = (CorElementType)corType.GetType();
this.corElementType = (CorElementType)corType.GetTheType();
// Loading might access the type again
loadedTypes[corType] = this;

5
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Module.cs

@ -5,12 +5,13 @@ @@ -5,12 +5,13 @@
// <version>$Revision$</version>
// </file>
using Debugger.Interop;
using System;
using System.Collections.Generic;
using Debugger.MetaData;
using Debugger.Interop.CorDebug;
using Debugger.Interop.CorSym;
using Debugger.Interop.MetaData;
using Debugger.MetaData;
namespace Debugger
{
@ -198,7 +199,7 @@ namespace Debugger @@ -198,7 +199,7 @@ namespace Debugger
}
}
public void UpdateSymbolsFromStream(Debugger.Interop.CorDebug.IStream pSymbolStream)
public void UpdateSymbolsFromStream(IStream pSymbolStream)
{
if (symReader != null) {
symReader.As<ISymUnmanagedDispose>().Destroy();

12
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/NDebugger.cs

@ -72,11 +72,6 @@ namespace Debugger @@ -72,11 +72,6 @@ namespace Debugger
} else {
mta2sta.CallMethod = CallMethod.DirectCall;
}
Wrappers.ResourceManager.TraceMessagesEnabled = false;
Wrappers.ResourceManager.TraceMessage += delegate (object s, MessageEventArgs e) {
TraceMessage(e.Message);
};
}
/// <summary>
@ -119,7 +114,8 @@ namespace Debugger @@ -119,7 +114,8 @@ namespace Debugger
}
this.debuggeeVersion = debuggeeVersion;
corDebug = new ICorDebug(NativeMethods.CreateDebuggingInterfaceFromVersion(3, debuggeeVersion));
corDebug = NativeMethods.CreateDebuggingInterfaceFromVersion(3, debuggeeVersion);
TrackedComObjects.Track(corDebug);
managedCallbackSwitch = new ManagedCallbackSwitch(this);
managedCallbackProxy = new ManagedCallbackProxy(this, managedCallbackSwitch);
@ -143,9 +139,9 @@ namespace Debugger @@ -143,9 +139,9 @@ namespace Debugger
TraceMessage("ICorDebug terminated");
Wrappers.ResourceManager.ReleaseAllTrackedCOMObjects();
int released = TrackedComObjects.ReleaseAll();
TraceMessage("Tracked COM objects released");
TraceMessage("Released " + released + " tracked COM objects");
}
/// <summary>

5
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/StackFrame.cs

@ -12,7 +12,6 @@ using System.Runtime.InteropServices; @@ -12,7 +12,6 @@ using System.Runtime.InteropServices;
using Debugger.MetaData;
using Debugger.Interop.CorDebug;
using Debugger.Interop.MetaData;
using CorElementType = Debugger.Interop.CorDebug.CorElementType;
namespace Debugger
{
@ -293,7 +292,7 @@ namespace Debugger @@ -293,7 +292,7 @@ namespace Debugger
throw;
}
// This can be 'by ref' for value types
if (corValue.GetType() == (uint)CorElementType.BYREF) {
if (corValue.GetTheType() == (uint)CorElementType.BYREF) {
corValue = corValue.CastTo<ICorDebugReferenceValue>().Dereference();
}
return corValue;
@ -341,7 +340,7 @@ namespace Debugger @@ -341,7 +340,7 @@ namespace Debugger
throw;
}
// Method arguments can be passed 'by ref'
if (corValue.GetType() == (uint)CorElementType.BYREF) {
if (corValue.GetTheType() == (uint)CorElementType.BYREF) {
try {
corValue = corValue.CastTo<ICorDebugReferenceValue>().Dereference();
} catch (COMException e) {

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Stepper.cs

@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
using System;
using Debugger.Interop.CorDebug;
using CorDebugStepReason = Debugger.Interop.CorDebug.CorDebugStepReason;
namespace Debugger
{

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Thread.cs

@ -292,13 +292,17 @@ namespace Debugger @@ -292,13 +292,17 @@ namespace Debugger
yield break;
}
uint corChainIndex = CorThread.EnumerateChains().GetCount();
foreach(ICorDebugChain corChain in CorThread.EnumerateChains().GetEnumerator()) {
corChainIndex--;
if (corChain.IsManaged() == 0) continue; // Only managed ones
uint corFrameIndex = corChain.EnumerateFrames().GetCount();
foreach(ICorDebugFrame corFrame in corChain.EnumerateFrames().GetEnumerator()) {
corFrameIndex--;
if (!corFrame.Is<ICorDebugILFrame>()) continue; // Only IL frames
StackFrame stackFrame;
try {
stackFrame = new StackFrame(this, corFrame.CastTo<ICorDebugILFrame>(), corChain.Index, corFrame.Index);
stackFrame = new StackFrame(this, corFrame.CastTo<ICorDebugILFrame>(), corChainIndex, corFrameIndex);
} catch (COMException) { // TODO
continue;
};

2
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ControlFlow_Stepping.cs

@ -115,8 +115,6 @@ namespace Debugger.Tests.TestPrograms @@ -115,8 +115,6 @@ namespace Debugger.Tests.TestPrograms
#if TEST_CODE
namespace Debugger.Tests {
using NUnit.Framework;
using Debugger.Wrappers.CorDebug;
using Debugger.Wrappers.MetaData;
public partial class DebuggerTests
{

37
src/Tools/ComExtensionMethodGenerator/ComExtensionMethodGenerator.cs

@ -84,23 +84,23 @@ namespace ComExtensionMethodGenerator @@ -84,23 +84,23 @@ namespace ComExtensionMethodGenerator
new NamespaceDeclaration(Namespace) { Children = extensionMethodsType.ToList<INode>() }
);
// Add the ProcessOutParameter method
if (ProcessOutParameter) {
extensionMethodsType.AddChild(
new MethodDeclaration() {
Modifier = Modifiers.Static,
TypeReference = new TypeReference("void", true),
Name = ProcessOutParameterMethodName,
Parameters =
new ParameterDeclarationExpression(
new TypeReference("object", true),
"parameter"
).ToList(),
Body = new BlockStatement()
}
);
extensionMethodsType.AddChild(new IdentifierExpression("\t\t\r\n"));
}
// // Add the ProcessOutParameter method
// if (ProcessOutParameter) {
// extensionMethodsType.AddChild(
// new MethodDeclaration() {
// Modifier = Modifiers.Static,
// TypeReference = new TypeReference("void", true),
// Name = ProcessOutParameterMethodName,
// Parameters =
// new ParameterDeclarationExpression(
// new TypeReference("object", true),
// "parameter"
// ).ToList(),
// Body = new BlockStatement()
// }
// );
// extensionMethodsType.AddChild(new IdentifierExpression("\t\t\r\n"));
// }
// Add the extesion methods
foreach(NamespaceDeclaration ns in parser.CompilationUnit.Children.OfType<NamespaceDeclaration>()) {
@ -120,6 +120,9 @@ namespace ComExtensionMethodGenerator @@ -120,6 +120,9 @@ namespace ComExtensionMethodGenerator
Console.WriteLine("Warning: {0}.{1} is missing prefix {2}.", type.Name, method.Name, MethodPrefix);
hasWarnings = true;
}
// HACK: GetType is used by System.Object
if (extensionMethod.Name == "GetType")
extensionMethod.Name = "GetTheType";
// Parameters
extensionMethod.Parameters.Add(new ParameterDeclarationExpression(new TypeReference(type.Name), ThisParameterName));
foreach(ParameterDeclarationExpression param in method.Parameters) {

Loading…
Cancel
Save