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 49d58e78ea..57dfb9efeb 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 @@ -2,6 +2,13 @@ // <owner name="David Srbeck�" email="dsrbecky@post.cz"/> // </file> +// Regular expresion: +// ^{\t*}{(:Ll| )*{:i} *\(((.# {:i}, |\))|())^6\)*}\n\t*\{(.|\n)@\} +// Output: \1 - intention \2 - declaration \3 - function name \4-9 parameters + +// Replace with: +// \1\2\n\1{\n\1\tEnterCallback("\3");\n\1\t\n\1\tExitCallback_Continue(pAppDomain);\n\1} + using System; using System.Runtime.InteropServices; @@ -43,10 +50,10 @@ namespace DebuggerLibrary void ExitCallback_Paused(PausedReason reason) { - if (reason != PausedReason.EvalComplete) { - NDebugger.OnDebuggingPaused(reason); - NDebugger.OnIsProcessRunningChanged(); - } + if (reason != PausedReason.EvalComplete) { + NDebugger.OnDebuggingPaused(reason); + NDebugger.OnIsProcessRunningChanged(); + } handlingCallback = false; } @@ -64,7 +71,7 @@ namespace DebuggerLibrary NDebugger.StepOut(); return; } - + ExitCallback_Paused(PausedReason.StepComplete); } @@ -110,10 +117,10 @@ namespace DebuggerLibrary { EnterCallback("Exception"); - //if (!NDebugger.CatchHandledExceptions && (unhandled == 0)) { - // ExitCallback_Continue(); - // return; - //} + if (!NDebugger.CatchHandledExceptions && (unhandled == 0)) { + ExitCallback_Continue(); + return; + } NDebugger.CurrentThread = NDebugger.Instance.GetThread(pThread); NDebugger.CurrentThread.CurrentExceptionIsHandled = (unhandled == 0); @@ -170,7 +177,7 @@ namespace DebuggerLibrary { EnterCallback("DebuggerError"); - System.Windows.Forms.MessageBox.Show("Debugger error: \nHR = " + errorHR.ToString() + "\nCode = " + errorCode.ToString()); + System.Windows.Forms.MessageBox.Show("Debugger error: \nHR = " + errorHR.ToString() + "\nCode = " + errorCode.ToString()); ExitCallback_Paused(PausedReason.DebuggerError); } @@ -318,5 +325,65 @@ namespace DebuggerLibrary } #endregion + + #region ICorDebugManagedCallback2 Members + + public void ChangeConnection(ICorDebugProcess pProcess, uint dwConnectionId) + { + EnterCallback("ChangeConnection"); + + ExitCallback_Continue(); + } + + public void CreateConnection(ICorDebugProcess pProcess, uint dwConnectionId, ref ushort pConnName) + { + EnterCallback("CreateConnection"); + + ExitCallback_Continue(); + } + + public void DestroyConnection(ICorDebugProcess pProcess, uint dwConnectionId) + { + EnterCallback("DestroyConnection"); + + ExitCallback_Continue(); + } + + public void Exception2(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, uint nOffset, CorDebugExceptionCallbackType dwEventType, uint dwFlags) + { + EnterCallback("Exception2"); + + ExitCallback_Continue(pAppDomain); + } + + public void ExceptionUnwind(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags) + { + EnterCallback("ExceptionUnwind"); + + ExitCallback_Continue(pAppDomain); + } + + public void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction) + { + EnterCallback("FunctionRemapComplete"); + + ExitCallback_Continue(pAppDomain); + } + + public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset) + { + EnterCallback("FunctionRemapOpportunity"); + + ExitCallback_Continue(pAppDomain); + } + + public void MDANotification(ICorDebugController c, ICorDebugThread t, ICorDebugMDA mda) + { + EnterCallback("MDANotification"); + + ExitCallback_Continue(); + } + + #endregion } } 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 72fc25eed1..25fc79712a 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 @@ -10,10 +10,11 @@ using System.Windows.Forms; using DebuggerInterop.Core; -// Function finding regular expresion: -// ^{\t*}{(:Ll| )*{:i} *\(((.# {:i}, |\))|())^6\)*}\n\t*\{(.|\n)@\} +// Regular expresion: +// ^{\t*}{(:Ll| )*{:i} *\(((.# {:i}, |\))|())^6\)*}\n\t*\{(.|\n)@\} // Output: \1 - intention \2 - declaration \3 - function name \4-9 parameters +// Replace with: // \1\2\n\1{\n\1\tCallbackReceived("\3", new object[] {\4, \5, \6, \7, \8, \9});\n\1} namespace DebuggerLibrary @@ -166,49 +167,51 @@ namespace DebuggerLibrary CallbackReceived("UpdateModuleSymbols", new object[] {pAppDomain, pModule, pSymbolStream}); } - #region ICorDebugManagedCallback2 Members - public void ChangeConnection(ICorDebugProcess pProcess, uint dwConnectionId) - { - throw new NotImplementedException(); - } - public void CreateConnection(ICorDebugProcess pProcess, uint dwConnectionId, ref ushort pConnName) - { - throw new NotImplementedException(); - } + #region ICorDebugManagedCallback2 Members - public void DestroyConnection(ICorDebugProcess pProcess, uint dwConnectionId) - { - throw new NotImplementedException(); - } + public void ChangeConnection(IntPtr pProcess, uint dwConnectionId) + { + CallbackReceived("ChangeConnection", new object[] {pProcess, dwConnectionId}); + } + + public void CreateConnection(IntPtr pProcess, uint dwConnectionId, ref ushort pConnName) + { + CallbackReceived("CreateConnection", new object[] {pProcess, dwConnectionId, pConnName}); + } - public void Exception(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, uint nOffset, CorDebugExceptionCallbackType dwEventType, uint dwFlags) - { - pAppDomain.Continue(0); - } + public void DestroyConnection(IntPtr pProcess, uint dwConnectionId) + { + CallbackReceived("DestroyConnection", new object[] {pProcess, dwConnectionId}); + } + + public void Exception(IntPtr pAppDomain, IntPtr pThread, IntPtr pFrame, uint nOffset, CorDebugExceptionCallbackType dwEventType, uint dwFlags) + { + CallbackReceived("Exception2", new object[] {pAppDomain, pThread, pFrame, nOffset, dwEventType, dwFlags}); + } - public void ExceptionUnwind(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags) - { - throw new NotImplementedException(); - } + public void ExceptionUnwind(IntPtr pAppDomain, IntPtr pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags) + { + CallbackReceived("ExceptionUnwind", new object[] {pAppDomain, pThread, dwEventType, dwFlags}); + } - public void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction) - { - throw new NotImplementedException(); - } + public void FunctionRemapComplete(IntPtr pAppDomain, IntPtr pThread, IntPtr pFunction) + { + CallbackReceived("FunctionRemapComplete", new object[] {pAppDomain, pThread, pFunction}); + } - public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset) - { - throw new NotImplementedException(); - } + public void FunctionRemapOpportunity(IntPtr pAppDomain, IntPtr pThread, IntPtr pOldFunction, IntPtr pNewFunction, uint oldILOffset) + { + CallbackReceived("FunctionRemapOpportunity", new object[] {pAppDomain, pThread, pOldFunction, pNewFunction, oldILOffset}); + } - public void MDANotification(ICorDebugController c, ICorDebugThread t, ICorDebugMDA mda) - { - throw new NotImplementedException(); - } + public void MDANotification(IntPtr pController, IntPtr pThread, IntPtr pMDA) + { + CallbackReceived("MDANotification", new object[] {pController, pThread, pMDA}); + } - #endregion + #endregion } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/RequiredLibraries/Debugger.Interop.dll b/src/AddIns/Misc/Debugger/Debugger.Core/RequiredLibraries/Debugger.Interop.dll index f0fe4282c7..c9fd99edea 100644 Binary files a/src/AddIns/Misc/Debugger/Debugger.Core/RequiredLibraries/Debugger.Interop.dll and b/src/AddIns/Misc/Debugger/Debugger.Core/RequiredLibraries/Debugger.Interop.dll differ diff --git a/src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/AssemblyInfo.il b/src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/AssemblyInfo.il new file mode 100644 index 0000000000..0fda4ccbcf --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/AssemblyInfo.il @@ -0,0 +1,21 @@ +// <file> +// <owner name="David Srbeck�" email="dsrbecky@post.cz"/> +// </file> + +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 1:0:5000:0 +} + +.assembly Debugger.Interop +{ + .ver 1:0:0:0 +} + +.module Debugger.Interop +// MVID: {D99DDAB7-C9D5-462D-9019-F632E9BAF060} +.imagebase 0x00400000 +.subsystem 0x00000003 +.file alignment 4096 +.corflags 0x00000001 diff --git a/src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/DebuggerInterop.Core.il b/src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/DebuggerInterop.Core.il index 4b919135fb..e698b73e6f 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/DebuggerInterop.Core.il +++ b/src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/DebuggerInterop.Core.il @@ -3221,37 +3221,37 @@ 31 32 45 33 32 30 33 00 00 ) // 12E3203.. .custom instance void [mscorlib]System.Runtime.InteropServices.InterfaceTypeAttribute::.ctor(int16) = ( 01 00 01 00 00 00 ) .method public hidebysig newslot abstract virtual - instance void FunctionRemapOpportunity([in] class DebuggerInterop.Core.ICorDebugAppDomain marshal( interface) pAppDomain, - [in] class DebuggerInterop.Core.ICorDebugThread marshal( interface) pThread, - [in] class DebuggerInterop.Core.ICorDebugFunction marshal( interface) pOldFunction, - [in] class DebuggerInterop.Core.ICorDebugFunction marshal( interface) pNewFunction, + instance void FunctionRemapOpportunity([in] native int pAppDomain, + [in] native int pThread, + [in] native int pOldFunction, + [in] native int pNewFunction, [in] uint32 oldILOffset) runtime managed internalcall { } // end of method ICorDebugManagedCallback2::FunctionRemapOpportunity .method public hidebysig newslot abstract virtual - instance void CreateConnection([in] class DebuggerInterop.Core.ICorDebugProcess marshal( interface) pProcess, + instance void CreateConnection([in] native int pProcess, [in] uint32 dwConnectionId, [in] uint16& pConnName) runtime managed internalcall { } // end of method ICorDebugManagedCallback2::CreateConnection .method public hidebysig newslot abstract virtual - instance void ChangeConnection([in] class DebuggerInterop.Core.ICorDebugProcess marshal( interface) pProcess, + instance void ChangeConnection([in] native int pProcess, [in] uint32 dwConnectionId) runtime managed internalcall { } // end of method ICorDebugManagedCallback2::ChangeConnection .method public hidebysig newslot abstract virtual - instance void DestroyConnection([in] class DebuggerInterop.Core.ICorDebugProcess marshal( interface) pProcess, + instance void DestroyConnection([in] native int pProcess, [in] uint32 dwConnectionId) runtime managed internalcall { } // end of method ICorDebugManagedCallback2::DestroyConnection .method public hidebysig newslot abstract virtual - instance void Exception([in] class DebuggerInterop.Core.ICorDebugAppDomain marshal( interface) pAppDomain, - [in] class DebuggerInterop.Core.ICorDebugThread marshal( interface) pThread, - [in] class DebuggerInterop.Core.ICorDebugFrame marshal( interface) pFrame, + instance void Exception([in] native int pAppDomain, + [in] native int pThread, + [in] native int pFrame, [in] uint32 nOffset, [in] valuetype DebuggerInterop.Core.CorDebugExceptionCallbackType dwEventType, [in] uint32 dwFlags) runtime managed internalcall @@ -3259,24 +3259,24 @@ } // end of method ICorDebugManagedCallback2::Exception .method public hidebysig newslot abstract virtual - instance void ExceptionUnwind([in] class DebuggerInterop.Core.ICorDebugAppDomain marshal( interface) pAppDomain, - [in] class DebuggerInterop.Core.ICorDebugThread marshal( interface) pThread, + instance void ExceptionUnwind([in] native int pAppDomain, + [in] native int pThread, [in] valuetype DebuggerInterop.Core.CorDebugExceptionUnwindCallbackType dwEventType, [in] uint32 dwFlags) runtime managed internalcall { } // end of method ICorDebugManagedCallback2::ExceptionUnwind .method public hidebysig newslot abstract virtual - instance void FunctionRemapComplete([in] class DebuggerInterop.Core.ICorDebugAppDomain marshal( interface) pAppDomain, - [in] class DebuggerInterop.Core.ICorDebugThread marshal( interface) pThread, - [in] class DebuggerInterop.Core.ICorDebugFunction marshal( interface) pFunction) runtime managed internalcall + instance void FunctionRemapComplete([in] native int pAppDomain, + [in] native int pThread, + [in] native int pFunction) runtime managed internalcall { } // end of method ICorDebugManagedCallback2::FunctionRemapComplete .method public hidebysig newslot abstract virtual - instance void MDANotification([in] class DebuggerInterop.Core.ICorDebugController marshal( interface) pController, - [in] class DebuggerInterop.Core.ICorDebugThread marshal( interface) pThread, - [in] class DebuggerInterop.Core.ICorDebugMDA marshal( interface) pMDA) runtime managed internalcall + instance void MDANotification([in] native int pController, + [in] native int pThread, + [in] native int pMDA) runtime managed internalcall { } // end of method ICorDebugManagedCallback2::MDANotification diff --git a/src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/compile.bat b/src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/compile.bat new file mode 100644 index 0000000000..31ced43ea0 --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/compile.bat @@ -0,0 +1 @@ +ilasm /DLL /DEBUG /OUTPUT=Debugger.Interop.dll DebuggerInterop.Core.il DebuggerInterop.MetaData.il AssemblyInfo.il \ No newline at end of file