diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
index fec0278427..8663d2f8c0 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
@@ -57,7 +57,6 @@
-
@@ -205,8 +204,6 @@
-
-
@@ -214,7 +211,6 @@
-
@@ -356,6 +352,9 @@
+
+
+
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/README.TXT b/src/AddIns/Misc/Debugger/Debugger.Core/Project/README.TXT
index c80e61db06..239a7ab1e7 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/README.TXT
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/README.TXT
@@ -1,6 +1,6 @@
-Debugger.Core and Debugger.Interop are the two libraries that hold most core debugging functionality.
+Debugger.Core is the library that hold most core debugging functionality.
-The vast majority of the code of these libraries was written by me without any modifications made by other people. If you could preserve this ratio by not making any modifications, I would be extremely pleased and I would be indebted to you.
+The vast majority of the code of this library was written by me without any modifications made by other people. If you could preserve this ratio by not making any modifications, I would be extremely pleased and I would be indebted to you.
However, if you find a bug or if you have an idea or suggestion, please do send me an e-mail to dsrbecky@gmail.com
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs
index f4fe446872..52240c03c1 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs
@@ -23,7 +23,6 @@ namespace Debugger
bool hadBeenSet = false;
bool enabled = true;
ICorDebugFunctionBreakpoint corBreakpoint;
- IntPtr pBreakpoint;
public NDebugger Debugger {
get {
@@ -86,11 +85,6 @@ namespace Debugger
this.enabled = enabled;
}
- internal bool Equals(IntPtr ptr)
- {
- return pBreakpoint == ptr;
- }
-
internal bool Equals(ICorDebugFunctionBreakpoint obj)
{
return corBreakpoint == obj;
@@ -98,7 +92,7 @@ namespace Debugger
public override bool Equals(object obj)
{
- return base.Equals(obj) || corBreakpoint == (obj as ICorDebugFunctionBreakpoint);
+ return base.Equals(obj) || corBreakpoint.Equals(obj);
}
public override int GetHashCode()
@@ -127,7 +121,6 @@ namespace Debugger
hadBeenSet = true;
corBreakpoint.Activate(enabled?1:0);
- pBreakpoint = Marshal.GetComInterfaceForObject(corBreakpoint.WrappedObject, typeof(Debugger.Interop.CorDebug.ICorDebugFunctionBreakpoint));
OnChanged();
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs
index fbe5858d19..6d79cc8a39 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs
@@ -10,7 +10,6 @@ using System.Runtime.InteropServices;
using System.Collections.Generic;
using Debugger.Wrappers.CorDebug;
-using Debugger.Interop.MetaData;
namespace Debugger
{
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs
index 621d55e08b..21d1e3be44 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs
@@ -133,17 +133,18 @@ namespace Debugger
}
}
- public void Breakpoint(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, IntPtr pBreakpoint)
+ public void Breakpoint(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint)
{
EnterCallback("Breakpoint", pThread);
ExitCallback_Paused(PausedReason.Breakpoint);
- foreach (Breakpoint b in debugger.Breakpoints) {
- if (b.Equals(pBreakpoint)) {
- b.OnHit();
- }
- }
+// foreach (Breakpoint b in debugger.Breakpoints) {
+// if (b.Equals(pBreakpoint)) {
+// // TODO: Check that this works
+// b.OnHit();
+// }
+// }
}
public void BreakpointSetError(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint, uint dwError)
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallbackProxy.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallbackProxy.cs
index 4ddb270bc4..a9021d3071 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallbackProxy.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallbackProxy.cs
@@ -23,7 +23,7 @@ using Debugger.Wrappers.CorDebug;
namespace Debugger
{
- class ManagedCallbackProxy : Debugger.Interop.CorDebug.ICorDebugManagedCallback, Debugger.Interop.CorDebug.ICorDebugManagedCallback2
+ class ManagedCallbackProxy : ICorDebugManagedCallbacks
{
NDebugger debugger;
ManagedCallback realCallback;
@@ -45,14 +45,14 @@ namespace Debugger
debugger.MTA2STA.Call(callback);
}
- public void StepComplete(System.IntPtr pAppDomain, System.IntPtr pThread, System.IntPtr pStepper, Debugger.Interop.CorDebug.CorDebugStepReason reason)
+ public void StepComplete(System.IntPtr pAppDomain, System.IntPtr pThread, System.IntPtr pStepper, CorDebugStepReason reason)
{
Call(delegate {
realCallback.StepComplete(
MTA2STA.MarshalIntPtrTo(pAppDomain),
MTA2STA.MarshalIntPtrTo(pThread),
MTA2STA.MarshalIntPtrTo(pStepper),
- (CorDebugStepReason)reason
+ reason
);
});
}
@@ -93,7 +93,7 @@ namespace Debugger
realCallback.Breakpoint(
MTA2STA.MarshalIntPtrTo(pAppDomain),
MTA2STA.MarshalIntPtrTo(pThread),
- pBreakpoint
+ MTA2STA.MarshalIntPtrTo(pBreakpoint)
);
});
}
@@ -357,7 +357,7 @@ namespace Debugger
});
}
- public void Exception(IntPtr pAppDomain, IntPtr pThread, IntPtr pFrame, uint nOffset, Debugger.Interop.CorDebug.CorDebugExceptionCallbackType dwEventType, uint dwFlags)
+ public void Exception(IntPtr pAppDomain, IntPtr pThread, IntPtr pFrame, uint nOffset, CorDebugExceptionCallbackType dwEventType, uint dwFlags)
{
Call(delegate {
realCallback.Exception2(
@@ -365,19 +365,19 @@ namespace Debugger
MTA2STA.MarshalIntPtrTo(pThread),
MTA2STA.MarshalIntPtrTo(pFrame),
nOffset,
- (CorDebugExceptionCallbackType)dwEventType,
+ dwEventType,
dwFlags
);
});
}
- public void ExceptionUnwind(IntPtr pAppDomain, IntPtr pThread, Debugger.Interop.CorDebug.CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags)
+ public void ExceptionUnwind(IntPtr pAppDomain, IntPtr pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags)
{
Call(delegate {
realCallback.ExceptionUnwind(
MTA2STA.MarshalIntPtrTo(pAppDomain),
MTA2STA.MarshalIntPtrTo(pThread),
- (CorDebugExceptionUnwindCallbackType)dwEventType,
+ dwEventType,
dwFlags
);
});
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs
index b8500032dc..5b010f2f56 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs
@@ -7,13 +7,12 @@
using System;
using System.Collections;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using Debugger.Wrappers.CorDebug;
-using Debugger.Interop.MetaData;
-using System.Collections.Generic;
namespace Debugger
{
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
index 5ba528a611..6a129538c6 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
@@ -7,13 +7,12 @@
using System;
using System.Collections;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using Debugger.Wrappers.CorDebug;
-using Debugger.Interop.MetaData;
-using System.Collections.Generic;
namespace Debugger
{
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/CorDebugExceptionCallbackType.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/CorDebugExceptionCallbackType.cs
index 9a4dc9ac13..80c870dcc3 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/CorDebugExceptionCallbackType.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/CorDebugExceptionCallbackType.cs
@@ -5,7 +5,7 @@
// $Revision$
//
-namespace Debugger.Interop.CorDebug
+namespace Debugger.Wrappers.CorDebug
{
using System;
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/CorDebugExceptionUnwindCallbackType.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/CorDebugExceptionUnwindCallbackType.cs
index 6517668bf6..cb18080624 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/CorDebugExceptionUnwindCallbackType.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/CorDebugExceptionUnwindCallbackType.cs
@@ -5,7 +5,7 @@
// $Revision$
//
-namespace Debugger.Interop.CorDebug
+namespace Debugger.Wrappers.CorDebug
{
using System;
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/CorDebugStepReason.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/CorDebugStepReason.cs
index eaea8ff76b..0192ca0cbc 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/CorDebugStepReason.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/CorDebugStepReason.cs
@@ -5,7 +5,7 @@
// $Revision$
//
-namespace Debugger.Interop.CorDebug
+namespace Debugger.Wrappers.CorDebug
{
using System;
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/ICorDebugManagedCallback.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/ICorDebugManagedCallback.cs
index a0449b487c..4b62772dcb 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/ICorDebugManagedCallback.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/ICorDebugManagedCallback.cs
@@ -17,7 +17,7 @@ namespace Debugger.Interop.CorDebug
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Breakpoint([In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pBreakpoint);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void StepComplete([In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pStepper, [In] CorDebugStepReason reason);
+ void StepComplete([In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pStepper, [In] Debugger.Wrappers.CorDebug.CorDebugStepReason reason);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void Break([In] IntPtr pAppDomain, [In] IntPtr thread);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/ICorDebugManagedCallback2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/ICorDebugManagedCallback2.cs
index 14247b4f5a..911c4b5250 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/ICorDebugManagedCallback2.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebug/ICorDebugManagedCallback2.cs
@@ -23,9 +23,9 @@ namespace Debugger.Interop.CorDebug
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void DestroyConnection([In] IntPtr pProcess, [In] uint dwConnectionId);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void Exception([In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pFrame, [In] uint nOffset, [In] CorDebugExceptionCallbackType dwEventType, [In] uint dwFlags);
+ void Exception([In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pFrame, [In] uint nOffset, [In] Debugger.Wrappers.CorDebug.CorDebugExceptionCallbackType dwEventType, [In] uint dwFlags);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
- void ExceptionUnwind([In] IntPtr pAppDomain, [In] IntPtr pThread, [In] CorDebugExceptionUnwindCallbackType dwEventType, [In] uint dwFlags);
+ void ExceptionUnwind([In] IntPtr pAppDomain, [In] IntPtr pThread, [In] Debugger.Wrappers.CorDebug.CorDebugExceptionUnwindCallbackType dwEventType, [In] uint dwFlags);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void FunctionRemapComplete([In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pFunction);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs
index eee8882040..d9f8d800af 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs
@@ -12,7 +12,6 @@ using System.Runtime.InteropServices;
using Debugger.Wrappers.CorDebug;
using Debugger.Wrappers.MetaData;
-using Debugger.Interop.MetaData;
namespace Debugger
{
@@ -25,9 +24,9 @@ namespace Debugger
string fullPathPDB;
int orderOfLoading = 0;
- readonly ICorDebugModule corModule;
+ ICorDebugModule corModule;
SymReader symReader;
- IMetaDataImport metaDataInterface;
+ MetaData metaData;
public NDebugger Debugger {
get {
@@ -37,7 +36,7 @@ namespace Debugger
internal MetaData MetaData {
get {
- return new MetaData(metaDataInterface);
+ return metaData;
}
}
@@ -127,10 +126,7 @@ namespace Debugger
corModule = pModule;
- Guid metaDataInterfaceGuid = new Guid("{ 0x7dac8207, 0xd3ae, 0x4c75, { 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44 } }");
- object pMetaDataInterface = pModule.GetMetaDataInterface(ref metaDataInterfaceGuid);
-
- metaDataInterface = (IMetaDataImport) pMetaDataInterface;
+ metaData = new MetaData(pModule);
uint pStringLenght = 0; // Terminating character included in pStringLenght
IntPtr pString = IntPtr.Zero;
@@ -161,19 +157,8 @@ namespace Debugger
fullPathPDB = newPdbPath;
} catch {}
- SymBinder symBinder = new SymBinder();
- IntPtr ptr = IntPtr.Zero;
- try {
- ptr = Marshal.GetIUnknownForObject(metaDataInterface);
- symReader = (SymReader)symBinder.GetReader(ptr, fullPath, tempPath);
- } catch (System.Exception) {
- symReader = null;
- } finally {
- if (ptr != IntPtr.Zero) {
- Marshal.Release(ptr);
- }
- }
-
+ symReader = metaData.GetSymReader(fullPath, tempPath);
+
try {
if (File.Exists(newPdbPath) && !File.Exists(oldPdbPath)) {
File.Copy(newPdbPath, oldPdbPath);
@@ -208,13 +193,7 @@ namespace Debugger
}
}
- try {
- Marshal.FinalReleaseComObject(metaDataInterface);
- } catch {
- Console.WriteLine("metaDataInterface release failed. (FinalReleaseComObject)");
- } finally {
- metaDataInterface = null;
- }
+ metaData.Dispose();
unloaded = true;
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs
index 3bc9268089..08d39d6bd9 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs
@@ -11,7 +11,6 @@ using System.Runtime.InteropServices;
using System.Threading;
using Debugger.Wrappers.CorDebug;
-using Debugger.Interop.MetaData;
namespace Debugger
{
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs
index 0649726a0e..6599bfdb18 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs
@@ -11,7 +11,6 @@ using System.Runtime.InteropServices;
using System.Threading;
using Debugger.Wrappers.CorDebug;
-using Debugger.Interop.MetaData;
namespace Debugger
{
@@ -87,11 +86,6 @@ namespace Debugger
{
debugger.TraceMessage("Executing " + filename);
- Debugger.Interop.CorDebug._SECURITY_ATTRIBUTES secAttr = new Debugger.Interop.CorDebug._SECURITY_ATTRIBUTES();
- secAttr.bInheritHandle = 0;
- secAttr.lpSecurityDescriptor = IntPtr.Zero;
- secAttr.nLength = (uint)sizeof(Debugger.Interop.CorDebug._SECURITY_ATTRIBUTES); //=12?
-
uint[] processStartupInfo = new uint[17];
processStartupInfo[0] = sizeof(uint) * 17;
uint[] processInfo = new uint[4];
@@ -109,8 +103,8 @@ namespace Debugger
filename, // lpApplicationName
// If we do not prepend " ", the first argument migh just get lost
" " + arguments, // lpCommandLine
- ref secAttr, // lpProcessAttributes
- ref secAttr, // lpThreadAttributes
+ ref _SECURITY_ATTRIBUTES.Default, // lpProcessAttributes
+ ref _SECURITY_ATTRIBUTES.Default, // lpThreadAttributes
1,//TRUE // bInheritHandles
0x00000010 /*CREATE_NEW_CONSOLE*/, // dwCreationFlags
IntPtr.Zero, // lpEnvironment
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs
index 4d97681ce1..1e4cf07d6b 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs
@@ -11,7 +11,6 @@ using System.Runtime.InteropServices;
using System.Threading;
using Debugger.Wrappers.CorDebug;
-using Debugger.Interop.MetaData;
namespace Debugger
{
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs
index 9124c78824..314d71f95c 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs
@@ -9,9 +9,7 @@ using System;
using System.Collections;
using System.Runtime.InteropServices;
-using Debugger;
using Debugger.Wrappers.CorDebug;
-using Debugger.Interop.MetaData;
namespace Debugger
{
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugExceptionCallbackType.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugExceptionCallbackType.cs
deleted file mode 100644
index d51caeddb3..0000000000
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugExceptionCallbackType.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-namespace Debugger.Wrappers.CorDebug
-{
- using System;
-
-
- public enum CorDebugExceptionCallbackType : int
- {
-
- DEBUG_EXCEPTION_FIRST_CHANCE = 1,
-
- DEBUG_EXCEPTION_USER_FIRST_CHANCE = 2,
-
- DEBUG_EXCEPTION_CATCH_HANDLER_FOUND = 3,
-
- DEBUG_EXCEPTION_UNHANDLED = 4,
- }
-}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugStepReason.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugStepReason.cs
deleted file mode 100644
index 7f27b27320..0000000000
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugStepReason.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-namespace Debugger.Wrappers.CorDebug
-{
- using System;
-
-
- public enum CorDebugStepReason : int
- {
-
- STEP_NORMAL = 0,
-
- STEP_RETURN = 1,
-
- STEP_CALL = 2,
-
- STEP_EXCEPTION_FILTER = 3,
-
- STEP_EXCEPTION_HANDLER = 4,
-
- STEP_INTERCEPT = 5,
-
- STEP_EXIT = 6,
- }
-}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback.cs
index 63254b07a2..670ae88bcf 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback.cs
@@ -93,9 +93,9 @@ namespace Debugger.Wrappers.CorDebug
this.WrappedObject.Breakpoint(pAppDomain, pThread, pBreakpoint);
}
- public void StepComplete(System.IntPtr pAppDomain, System.IntPtr pThread, System.IntPtr pStepper, CorDebugStepReason reason)
+ public void StepComplete(System.IntPtr pAppDomain, System.IntPtr pThread, System.IntPtr pStepper, Debugger.Wrappers.CorDebug.CorDebugStepReason reason)
{
- this.WrappedObject.StepComplete(pAppDomain, pThread, pStepper, ((Debugger.Interop.CorDebug.CorDebugStepReason)(reason)));
+ this.WrappedObject.StepComplete(pAppDomain, pThread, pStepper, reason);
}
public void Break(System.IntPtr pAppDomain, System.IntPtr thread)
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback2.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback2.cs
index 2b56de61cc..b48ca5ce78 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback2.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/ICorDebugManagedCallback2.cs
@@ -108,14 +108,14 @@ namespace Debugger.Wrappers.CorDebug
this.WrappedObject.DestroyConnection(pProcess, dwConnectionId);
}
- public void Exception(System.IntPtr pAppDomain, System.IntPtr pThread, System.IntPtr pFrame, uint nOffset, CorDebugExceptionCallbackType dwEventType, uint dwFlags)
+ public void Exception(System.IntPtr pAppDomain, System.IntPtr pThread, System.IntPtr pFrame, uint nOffset, Debugger.Wrappers.CorDebug.CorDebugExceptionCallbackType dwEventType, uint dwFlags)
{
- this.WrappedObject.Exception(pAppDomain, pThread, pFrame, nOffset, ((Debugger.Interop.CorDebug.CorDebugExceptionCallbackType)(dwEventType)), dwFlags);
+ this.WrappedObject.Exception(pAppDomain, pThread, pFrame, nOffset, dwEventType, dwFlags);
}
- public void ExceptionUnwind(System.IntPtr pAppDomain, System.IntPtr pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags)
+ public void ExceptionUnwind(System.IntPtr pAppDomain, System.IntPtr pThread, Debugger.Wrappers.CorDebug.CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags)
{
- this.WrappedObject.ExceptionUnwind(pAppDomain, pThread, ((Debugger.Interop.CorDebug.CorDebugExceptionUnwindCallbackType)(dwEventType)), dwFlags);
+ this.WrappedObject.ExceptionUnwind(pAppDomain, pThread, dwEventType, dwFlags);
}
public void FunctionRemapComplete(System.IntPtr pAppDomain, System.IntPtr pThread, System.IntPtr pFunction)
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugExceptionUnwindCallbackType.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/ICorDebugManagedCallbacks.cs
similarity index 51%
rename from src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugExceptionUnwindCallbackType.cs
rename to src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/ICorDebugManagedCallbacks.cs
index 62866cc060..77b916b5d9 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/CorDebug/CorDebugExceptionUnwindCallbackType.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/ICorDebugManagedCallbacks.cs
@@ -1,7 +1,7 @@
//
//
//
-//
+//
// $Revision$
//
@@ -9,12 +9,8 @@ namespace Debugger.Wrappers.CorDebug
{
using System;
-
- public enum CorDebugExceptionUnwindCallbackType : int
+ public interface ICorDebugManagedCallbacks: Debugger.Interop.CorDebug.ICorDebugManagedCallback, Debugger.Interop.CorDebug.ICorDebugManagedCallback2
{
- DEBUG_EXCEPTION_UNWIND_BEGIN = 1,
-
- DEBUG_EXCEPTION_INTERCEPTED = 2,
}
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/MetaData.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/MetaData.cs
index fda75e12fb..8213da12be 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/MetaData.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/MetaData.cs
@@ -7,30 +7,63 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics.SymbolStore;
using System.Text;
-using Debugger.Interop.MetaData;
using System.Runtime.InteropServices;
+using Debugger.Wrappers.CorDebug;
+using Debugger.Interop.MetaData;
+
namespace Debugger.Wrappers.MetaData
{
- class MetaData
+ class MetaData: IDisposable
{
IMetaDataImport metaData;
-
- public MetaData(IMetaDataImport metaData)
+
+ public MetaData(ICorDebugModule pModule)
{
- this.metaData = metaData;
+ Guid guid = new Guid("{ 0x7dac8207, 0xd3ae, 0x4c75, { 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44 } }");
+ metaData = (IMetaDataImport)pModule.GetMetaDataInterface(ref guid);
}
-
+
+ public SymReader GetSymReader(string fullname, string searchPath)
+ {
+ SymReader symReader;
+ SymBinder symBinder = new SymBinder();
+ IntPtr ptr = IntPtr.Zero;
+ try {
+ ptr = Marshal.GetIUnknownForObject(metaData);
+ symReader = (SymReader)symBinder.GetReader(ptr, fullname, searchPath);
+ } catch (System.Exception) {
+ symReader = null;
+ } finally {
+ if (ptr != IntPtr.Zero) {
+ Marshal.Release(ptr);
+ }
+ }
+ return symReader;
+ }
+
+ public void Dispose()
+ {
+ try {
+ Marshal.FinalReleaseComObject(metaData);
+ } catch {
+ Console.WriteLine("metaData release failed. (FinalReleaseComObject)");
+ } finally {
+ metaData = null;
+ }
+ }
+
public TypeDefProps GetTypeDefProps(uint typeToken)
{
TypeDefProps typeDefProps;
-
+
typeDefProps.Token = typeToken;
-
+
uint pStringLenght = 0; // Terminating character included in pStringLenght
IntPtr pString = IntPtr.Zero;
-
+
// Get length of string
metaData.GetTypeDefProps(typeDefProps.Token,
pString,
@@ -38,10 +71,10 @@ namespace Debugger.Wrappers.MetaData
out pStringLenght,
out typeDefProps.Flags,
out typeDefProps.SuperClassToken);
-
+
// Allocate string buffer
pString = Marshal.AllocHGlobal((int)pStringLenght * 2);
-
+
// Get properties
metaData.GetTypeDefProps(typeDefProps.Token,
pString,
@@ -49,19 +82,19 @@ namespace Debugger.Wrappers.MetaData
out pStringLenght,
out typeDefProps.Flags,
out typeDefProps.SuperClassToken);
-
+
typeDefProps.Name = Marshal.PtrToStringUni(pString);
Marshal.FreeHGlobal(pString);
-
+
return typeDefProps;
}
-
+
public TypeRefProps GetTypeRefProps(uint typeToken)
{
TypeRefProps typeRefProps;
-
+
typeRefProps.Token = typeToken;
-
+
uint unused;
uint pStringLenght = 0; // Terminating character included in pStringLenght
IntPtr pString = IntPtr.Zero;
@@ -73,16 +106,16 @@ namespace Debugger.Wrappers.MetaData
// Allocate string buffer
pString = Marshal.AllocHGlobal((int)pStringLenght * 2);
-
+
metaData.GetTypeRefProps(typeRefProps.Token,
out unused,
pString,
pStringLenght,
out pStringLenght); // real string lenght
-
+
typeRefProps.Name = Marshal.PtrToStringUni(pString);
Marshal.FreeHGlobal(pString);
-
+
return typeRefProps;
}
@@ -100,13 +133,13 @@ namespace Debugger.Wrappers.MetaData
yield return GetFieldProps(fieldToken);
}
}
-
+
public FieldProps GetFieldProps(uint fieldToken)
{
FieldProps fieldProps;
-
+
fieldProps.Token = fieldToken;
-
+
uint unused;
IntPtr unusedPtr = IntPtr.Zero;
uint pStringLenght = 0; // Terminating character included in pStringLenght
@@ -122,10 +155,10 @@ namespace Debugger.Wrappers.MetaData
out unused,
out unusedPtr,
out unused);
-
+
// Allocate string buffer
pString = Marshal.AllocHGlobal((int)pStringLenght * 2);
-
+
metaData.GetFieldProps(fieldProps.Token,
out fieldProps.ClassToken,
pString,
@@ -137,10 +170,10 @@ namespace Debugger.Wrappers.MetaData
out unused,
out unusedPtr,
out unused);
-
+
fieldProps.Name = Marshal.PtrToStringUni(pString);
Marshal.FreeHGlobal(pString);
-
+
return fieldProps;
}
@@ -158,13 +191,13 @@ namespace Debugger.Wrappers.MetaData
yield return GetMethodProps(methodToken);
}
}
-
+
public unsafe MethodProps GetMethodProps(uint methodToken)
{
MethodProps methodProps;
-
+
methodProps.Token = methodToken;
-
+
uint pStringLenght = 0; // Terminating character included in pStringLenght
IntPtr pString = IntPtr.Zero;
//IntPtr pSigBlob;
@@ -179,10 +212,10 @@ namespace Debugger.Wrappers.MetaData
out sigBlobSize,
out methodProps.CodeRVA,
out methodProps.ImplFlags);
-
+
// Allocate string buffer
pString = Marshal.AllocHGlobal((int)pStringLenght * 2);
-
+
metaData.GetMethodProps(methodProps.Token,
out methodProps.ClassToken,
pString,
@@ -193,7 +226,7 @@ namespace Debugger.Wrappers.MetaData
out sigBlobSize,
out methodProps.CodeRVA,
out methodProps.ImplFlags);
-
+
methodProps.Name = Marshal.PtrToStringUni(pString);
Marshal.FreeHGlobal(pString);
@@ -201,23 +234,23 @@ namespace Debugger.Wrappers.MetaData
//methodProps.Signature = new SignatureStream(pSigBlob, sigBlobSize);
//Marshal.FreeCoTaskMem(pSigBlob);
-
+
return methodProps;
}
-
+
public ParamProps GetParamForMethodIndex(uint methodToken, uint parameterSequence)
{
uint paramToken = 0;
metaData.GetParamForMethodIndex(methodToken, parameterSequence, ref paramToken);
return GetParamProps(paramToken);
}
-
+
public ParamProps GetParamProps(uint paramToken)
{
ParamProps paramProps;
-
+
paramProps.Token = paramToken;
-
+
uint unused;
uint pStringLenght = 0; // Terminating character included in pStringLenght
IntPtr pString = IntPtr.Zero;
@@ -231,7 +264,7 @@ namespace Debugger.Wrappers.MetaData
out unused,
IntPtr.Zero,
out unused);
-
+
// Allocate string buffer
pString = Marshal.AllocHGlobal((int)pStringLenght * 2);
@@ -245,13 +278,13 @@ namespace Debugger.Wrappers.MetaData
out unused,
IntPtr.Zero,
out unused);
-
+
paramProps.Name = Marshal.PtrToStringUni(pString);
Marshal.FreeHGlobal(pString);
-
+
return paramProps;
}
-
+
public TypeDefProps FindTypeDefByName(string typeName, uint enclosingClassToken)
{
uint typeDefToken;
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/NativeMethods.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/NativeMethods.cs
similarity index 100%
rename from src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/NativeMethods.cs
rename to src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/NativeMethods.cs
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/_SECURITY_ATTRIBUTES.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/_SECURITY_ATTRIBUTES.cs
new file mode 100644
index 0000000000..d2e4117d47
--- /dev/null
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/_SECURITY_ATTRIBUTES.cs
@@ -0,0 +1,24 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+namespace Debugger.Wrappers.CorDebug
+{
+ using System;
+
+
+ public static class _SECURITY_ATTRIBUTES
+ {
+ public static Debugger.Interop.CorDebug._SECURITY_ATTRIBUTES Default;
+
+ static unsafe _SECURITY_ATTRIBUTES() {
+ Default = new Debugger.Interop.CorDebug._SECURITY_ATTRIBUTES();
+ Default.bInheritHandle = 0;
+ Default.lpSecurityDescriptor = IntPtr.Zero;
+ Default.nLength = (uint)sizeof(Debugger.Interop.CorDebug._SECURITY_ATTRIBUTES);
+ }
+ }
+}