Browse Source

Implemented custom marshalling for new debugging API callbacks

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@64 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 21 years ago
parent
commit
50b9076cc8
  1. 75
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs
  2. 37
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallbackProxy.cs
  3. BIN
      src/AddIns/Misc/Debugger/Debugger.Core/RequiredLibraries/Debugger.Interop.dll
  4. 21
      src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/AssemblyInfo.il
  5. 36
      src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/DebuggerInterop.Core.il
  6. 1
      src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/compile.bat

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

@ -2,6 +2,13 @@ @@ -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;
@ -110,10 +117,10 @@ namespace DebuggerLibrary @@ -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);
@ -318,5 +325,65 @@ namespace DebuggerLibrary @@ -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
}
}

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

@ -10,10 +10,11 @@ using System.Windows.Forms; @@ -10,10 +10,11 @@ using System.Windows.Forms;
using DebuggerInterop.Core;
// Function finding regular expresion:
// 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,46 +167,48 @@ namespace DebuggerLibrary @@ -166,46 +167,48 @@ namespace DebuggerLibrary
CallbackReceived("UpdateModuleSymbols", new object[] {pAppDomain, pModule, pSymbolStream});
}
#region ICorDebugManagedCallback2 Members
public void ChangeConnection(ICorDebugProcess pProcess, uint dwConnectionId)
public void ChangeConnection(IntPtr pProcess, uint dwConnectionId)
{
throw new NotImplementedException();
CallbackReceived("ChangeConnection", new object[] {pProcess, dwConnectionId});
}
public void CreateConnection(ICorDebugProcess pProcess, uint dwConnectionId, ref ushort pConnName)
public void CreateConnection(IntPtr pProcess, uint dwConnectionId, ref ushort pConnName)
{
throw new NotImplementedException();
CallbackReceived("CreateConnection", new object[] {pProcess, dwConnectionId, pConnName});
}
public void DestroyConnection(ICorDebugProcess pProcess, uint dwConnectionId)
public void DestroyConnection(IntPtr pProcess, uint dwConnectionId)
{
throw new NotImplementedException();
CallbackReceived("DestroyConnection", new object[] {pProcess, dwConnectionId});
}
public void Exception(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, uint nOffset, CorDebugExceptionCallbackType dwEventType, uint dwFlags)
public void Exception(IntPtr pAppDomain, IntPtr pThread, IntPtr pFrame, uint nOffset, CorDebugExceptionCallbackType dwEventType, uint dwFlags)
{
pAppDomain.Continue(0);
CallbackReceived("Exception2", new object[] {pAppDomain, pThread, pFrame, nOffset, dwEventType, dwFlags});
}
public void ExceptionUnwind(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags)
public void ExceptionUnwind(IntPtr pAppDomain, IntPtr pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags)
{
throw new NotImplementedException();
CallbackReceived("ExceptionUnwind", new object[] {pAppDomain, pThread, dwEventType, dwFlags});
}
public void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
public void FunctionRemapComplete(IntPtr pAppDomain, IntPtr pThread, IntPtr pFunction)
{
throw new NotImplementedException();
CallbackReceived("FunctionRemapComplete", new object[] {pAppDomain, pThread, pFunction});
}
public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
public void FunctionRemapOpportunity(IntPtr pAppDomain, IntPtr pThread, IntPtr pOldFunction, IntPtr pNewFunction, uint oldILOffset)
{
throw new NotImplementedException();
CallbackReceived("FunctionRemapOpportunity", new object[] {pAppDomain, pThread, pOldFunction, pNewFunction, oldILOffset});
}
public void MDANotification(ICorDebugController c, ICorDebugThread t, ICorDebugMDA mda)
public void MDANotification(IntPtr pController, IntPtr pThread, IntPtr pMDA)
{
throw new NotImplementedException();
CallbackReceived("MDANotification", new object[] {pController, pThread, pMDA});
}
#endregion

BIN
src/AddIns/Misc/Debugger/Debugger.Core/RequiredLibraries/Debugger.Interop.dll

Binary file not shown.

21
src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/AssemblyInfo.il

@ -0,0 +1,21 @@ @@ -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

36
src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/DebuggerInterop.Core.il

@ -3221,37 +3221,37 @@ @@ -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 @@ @@ -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

1
src/AddIns/Misc/Debugger/Debugger.Interop/Project/Src/compile.bat

@ -0,0 +1 @@ @@ -0,0 +1 @@
ilasm /DLL /DEBUG /OUTPUT=Debugger.Interop.dll DebuggerInterop.Core.il DebuggerInterop.MetaData.il AssemblyInfo.il
Loading…
Cancel
Save