Browse Source

CorDebugger wrapper used by the debugger

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@930 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
ab87777e1c
  1. 7
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs
  2. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs
  3. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/MTA2STA.cs
  4. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs
  5. 14
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallbackProxy.cs
  6. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs
  7. 8
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
  8. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs
  9. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/NDebugger-Modules.cs
  10. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs
  11. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  12. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Processes.cs
  13. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Threads.cs
  14. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs
  15. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs
  16. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Stepper.cs
  17. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs
  18. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ArrayValue.cs
  19. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs
  20. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/NDebugger-Evals.cs
  21. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/NullValue.cs
  22. 12
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectValue.cs
  23. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/PrimitiveValue.cs
  24. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/PropertyVariable.cs
  25. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/UnavailableValue.cs
  26. 14
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs
  27. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs
  28. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

7
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs

@ -10,7 +10,7 @@ using System.Diagnostics.SymbolStore;
using System.Collections; using System.Collections;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {
@ -100,7 +100,7 @@ namespace Debugger
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
return base.Equals(obj) || corBreakpoint == obj; return base.Equals(obj) || corBreakpoint == (obj as ICorDebugFunctionBreakpoint);
} }
public override int GetHashCode() public override int GetHashCode()
@ -134,7 +134,8 @@ namespace Debugger
hadBeenSet = true; hadBeenSet = true;
corBreakpoint.Activate(enabled?1:0); corBreakpoint.Activate(enabled?1:0);
pBreakpoint = Marshal.GetComInterfaceForObject(corBreakpoint, typeof(ICorDebugFunctionBreakpoint)); pBreakpoint = Marshal.GetComInterfaceForObject(corBreakpoint.WrappedObject, typeof(Debugger.Interop.CorDebug.ICorDebugFunctionBreakpoint));
OnBreakpointStateChanged(); OnBreakpointStateChanged();
return true; return true;

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs

@ -9,7 +9,7 @@ using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Collections.Generic; using System.Collections.Generic;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData; using Debugger.Interop.MetaData;
namespace Debugger namespace Debugger
@ -60,7 +60,7 @@ namespace Debugger
internal Breakpoint GetBreakpoint(ICorDebugBreakpoint corBreakpoint) internal Breakpoint GetBreakpoint(ICorDebugBreakpoint corBreakpoint)
{ {
foreach(Breakpoint breakpoint in breakpointCollection) { foreach(Breakpoint breakpoint in breakpointCollection) {
if (breakpoint == corBreakpoint) { if (breakpoint.Equals(corBreakpoint)) {
return breakpoint; return breakpoint;
} }
} }

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

@ -185,7 +185,8 @@ namespace Debugger
return Marshal.PtrToStringAuto((IntPtr)param); return Marshal.PtrToStringAuto((IntPtr)param);
} }
// Marshal a COM object // Marshal a COM object
return Marshal.GetTypedObjectForIUnknown((IntPtr)param, outputType); object comObject = Marshal.GetObjectForIUnknown(param);
return Activator.CreateInstance(outputType, comObject);
} }
/// <summary> /// <summary>

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

@ -15,7 +15,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {
@ -473,10 +473,10 @@ namespace Debugger
public void MDANotification(ICorDebugController c, ICorDebugThread t, ICorDebugMDA mda) public void MDANotification(ICorDebugController c, ICorDebugThread t, ICorDebugMDA mda)
{ {
if (c is ICorDebugAppDomain) { if (c.Is<ICorDebugAppDomain>()) {
EnterCallback("MDANotification", (ICorDebugAppDomain)c); EnterCallback("MDANotification", c.CastTo<ICorDebugAppDomain>());
} else if (c is ICorDebugProcess){ } else if (c.Is<ICorDebugProcess>()){
EnterCallback("MDANotification", (ICorDebugProcess)c); EnterCallback("MDANotification", c.CastTo<ICorDebugProcess>());
} else { } else {
throw new System.Exception("Unknown callback argument"); throw new System.Exception("Unknown callback argument");
} }

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

@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
// Regular expresion: // Regular expresion:
// ^{\t*}{(:Ll| )*{:i} *\(((.# {:i}, |\))|())^6\)*}\n\t*\{(.|\n)@\t\} // ^{\t*}{(:Ll| )*{:i} *\(((.# {:i}, |\))|())^6\)*}\n\t*\{(.|\n)@\t\}
@ -23,7 +23,7 @@ using Debugger.Interop.CorDebug;
namespace Debugger namespace Debugger
{ {
class ManagedCallbackProxy :ICorDebugManagedCallback, ICorDebugManagedCallback2 class ManagedCallbackProxy : Debugger.Interop.CorDebug.ICorDebugManagedCallback, Debugger.Interop.CorDebug.ICorDebugManagedCallback2
{ {
NDebugger debugger; NDebugger debugger;
ManagedCallback realCallback; ManagedCallback realCallback;
@ -52,7 +52,7 @@ namespace Debugger
MTA2STA.MarshalIntPtrTo<ICorDebugAppDomain>(pAppDomain), MTA2STA.MarshalIntPtrTo<ICorDebugAppDomain>(pAppDomain),
MTA2STA.MarshalIntPtrTo<ICorDebugThread>(pThread), MTA2STA.MarshalIntPtrTo<ICorDebugThread>(pThread),
MTA2STA.MarshalIntPtrTo<ICorDebugStepper>(pStepper), MTA2STA.MarshalIntPtrTo<ICorDebugStepper>(pStepper),
reason (CorDebugStepReason)reason
); );
}); });
} }
@ -357,7 +357,7 @@ namespace Debugger
}); });
} }
public void Exception(IntPtr pAppDomain, IntPtr pThread, IntPtr pFrame, uint nOffset, CorDebugExceptionCallbackType dwEventType, uint dwFlags) public void Exception(IntPtr pAppDomain, IntPtr pThread, IntPtr pFrame, uint nOffset, Debugger.Interop.CorDebug.CorDebugExceptionCallbackType dwEventType, uint dwFlags)
{ {
Call(delegate { Call(delegate {
realCallback.Exception2( realCallback.Exception2(
@ -365,19 +365,19 @@ namespace Debugger
MTA2STA.MarshalIntPtrTo<ICorDebugThread>(pThread), MTA2STA.MarshalIntPtrTo<ICorDebugThread>(pThread),
MTA2STA.MarshalIntPtrTo<ICorDebugFrame>(pFrame), MTA2STA.MarshalIntPtrTo<ICorDebugFrame>(pFrame),
nOffset, nOffset,
dwEventType, (CorDebugExceptionCallbackType)dwEventType,
dwFlags dwFlags
); );
}); });
} }
public void ExceptionUnwind(IntPtr pAppDomain, IntPtr pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags) public void ExceptionUnwind(IntPtr pAppDomain, IntPtr pThread, Debugger.Interop.CorDebug.CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags)
{ {
Call(delegate { Call(delegate {
realCallback.ExceptionUnwind( realCallback.ExceptionUnwind(
MTA2STA.MarshalIntPtrTo<ICorDebugAppDomain>(pAppDomain), MTA2STA.MarshalIntPtrTo<ICorDebugAppDomain>(pAppDomain),
MTA2STA.MarshalIntPtrTo<ICorDebugThread>(pThread), MTA2STA.MarshalIntPtrTo<ICorDebugThread>(pThread),
dwEventType, (CorDebugExceptionUnwindCallbackType)dwEventType,
dwFlags dwFlags
); );
}); });

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs

@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData; using Debugger.Interop.MetaData;
using System.Collections.Generic; using System.Collections.Generic;

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

@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData; using Debugger.Interop.MetaData;
using System.Collections.Generic; using System.Collections.Generic;
@ -105,13 +105,15 @@ namespace Debugger
} }
this.debuggeeVersion = version; this.debuggeeVersion = version;
NativeMethods.CreateDebuggingInterfaceFromVersion(3, version, out corDebug); Debugger.Interop.CorDebug.ICorDebug rawCorDebug;
NativeMethods.CreateDebuggingInterfaceFromVersion(3, version, out rawCorDebug);
corDebug = new ICorDebug(rawCorDebug);
managedCallback = new ManagedCallback(this); managedCallback = new ManagedCallback(this);
managedCallbackProxy = new ManagedCallbackProxy(managedCallback); managedCallbackProxy = new ManagedCallbackProxy(managedCallback);
corDebug.Initialize(); corDebug.Initialize();
corDebug.SetManagedHandler(managedCallbackProxy); corDebug.SetManagedHandler(new ICorDebugManagedCallback(managedCallbackProxy));
localVariables.Updating += OnUpdatingLocalVariables; localVariables.Updating += OnUpdatingLocalVariables;

10
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs

@ -10,7 +10,7 @@ using System.IO;
using System.Diagnostics.SymbolStore; using System.Diagnostics.SymbolStore;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData; using Debugger.Interop.MetaData;
namespace Debugger namespace Debugger
@ -117,8 +117,8 @@ namespace Debugger
public bool JMCStatus { public bool JMCStatus {
set { set {
uint unused = 0; uint unused = 0;
if (corModule is ICorDebugModule2) { // Is the debuggee .NET 2.0? if (corModule.Is<ICorDebugModule2>()) { // Is the debuggee .NET 2.0?
((ICorDebugModule2)corModule).SetJMCStatus(value?1:0, 0, ref unused); (corModule.CastTo<ICorDebugModule2>()).SetJMCStatus(value?1:0, 0, ref unused);
} }
} }
} }
@ -186,8 +186,8 @@ namespace Debugger
public void ApplyChanges(byte[] metadata, byte[] il) public void ApplyChanges(byte[] metadata, byte[] il)
{ {
if (corModule is ICorDebugModule2) { // Is the debuggee .NET 2.0? if (corModule.Is<ICorDebugModule2>()) { // Is the debuggee .NET 2.0?
(corModule as ICorDebugModule2).ApplyChanges((uint)metadata.Length, metadata, (uint)il.Length, il); (corModule.CastTo<ICorDebugModule2>()).ApplyChanges((uint)metadata.Length, metadata, (uint)il.Length, il);
} }
} }

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/NDebugger-Modules.cs

@ -8,7 +8,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs

@ -10,7 +10,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData; using Debugger.Interop.MetaData;
namespace Debugger namespace Debugger

10
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

@ -10,7 +10,7 @@ using System.Diagnostics.SymbolStore;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData; using Debugger.Interop.MetaData;
using System.Collections.Generic; using System.Collections.Generic;
@ -203,9 +203,9 @@ namespace Debugger
if (stepIn) { if (stepIn) {
CorILFrame.CreateStepper(out stepper); CorILFrame.CreateStepper(out stepper);
if (stepper is ICorDebugStepper2) { // Is the debuggee .NET 2.0? if (stepper.Is<ICorDebugStepper2>()) { // Is the debuggee .NET 2.0?
stepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE); stepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE);
(stepper as ICorDebugStepper2).SetJMC(1 /* true */); (stepper.CastTo<ICorDebugStepper2>()).SetJMC(1 /* true */);
} }
fixed (int* ranges = nextSt.StepRanges) { fixed (int* ranges = nextSt.StepRanges) {
@ -220,9 +220,9 @@ namespace Debugger
CorILFrame.CreateStepper(out stepper); CorILFrame.CreateStepper(out stepper);
if (stepper is ICorDebugStepper2) { // Is the debuggee .NET 2.0? if (stepper.Is<ICorDebugStepper2>()) { // Is the debuggee .NET 2.0?
stepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE); stepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE);
(stepper as ICorDebugStepper2).SetJMC(1 /* true */); (stepper.CastTo<ICorDebugStepper2>()).SetJMC(1 /* true */);
} }
fixed (int* ranges = nextSt.StepRanges) { fixed (int* ranges = nextSt.StepRanges) {

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Processes.cs

@ -9,7 +9,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Threads.cs

@ -8,7 +8,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs

@ -10,7 +10,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData; using Debugger.Interop.MetaData;
namespace Debugger namespace Debugger
@ -87,10 +87,10 @@ namespace Debugger
{ {
debugger.TraceMessage("Executing " + filename); debugger.TraceMessage("Executing " + filename);
_SECURITY_ATTRIBUTES secAttr = new _SECURITY_ATTRIBUTES(); Debugger.Interop.CorDebug._SECURITY_ATTRIBUTES secAttr = new Debugger.Interop.CorDebug._SECURITY_ATTRIBUTES();
secAttr.bInheritHandle = 0; secAttr.bInheritHandle = 0;
secAttr.lpSecurityDescriptor = IntPtr.Zero; secAttr.lpSecurityDescriptor = IntPtr.Zero;
secAttr.nLength = (uint)sizeof(_SECURITY_ATTRIBUTES); //=12? secAttr.nLength = (uint)sizeof(Debugger.Interop.CorDebug._SECURITY_ATTRIBUTES); //=12?
uint[] processStartupInfo = new uint[17]; uint[] processStartupInfo = new uint[17];
processStartupInfo[0] = sizeof(uint) * 17; processStartupInfo[0] = sizeof(uint) * 17;

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs

@ -8,7 +8,7 @@
using System; using System;
using System.Diagnostics.SymbolStore; using System.Diagnostics.SymbolStore;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Stepper.cs

@ -7,7 +7,7 @@
using System; using System;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {

10
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs

@ -10,7 +10,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData; using Debugger.Interop.MetaData;
namespace Debugger namespace Debugger
@ -141,8 +141,8 @@ namespace Debugger
public void InterceptCurrentException() public void InterceptCurrentException()
{ {
if (corThread is ICorDebugThread2) { // Is the debuggee .NET 2.0? if (corThread.Is<ICorDebugThread2>()) { // Is the debuggee .NET 2.0?
((ICorDebugThread2)corThread).InterceptCurrentException(LastFunction.CorILFrame); corThread.CastTo<ICorDebugThread2>().InterceptCurrentException(LastFunction.CorILFrame.CastTo<ICorDebugFrame>());
} }
process.Continue(); process.Continue();
} }
@ -297,8 +297,8 @@ namespace Debugger
Function function = null; Function function = null;
try { try {
if (corFrames[0] is ICorDebugILFrame) { if (corFrames[0].Is<ICorDebugILFrame>()) {
function = new Function(this, chainIndex, frameIndex, (ICorDebugILFrame)corFrames[0]); function = new Function(this, chainIndex, frameIndex, corFrames[0].CastTo<ICorDebugILFrame>());
} }
} catch (COMException) { } catch (COMException) {
// TODO // TODO

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ArrayValue.cs

@ -10,7 +10,7 @@ using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
//TODO: Support for lower bound //TODO: Support for lower bound
@ -57,7 +57,7 @@ namespace Debugger
internal unsafe ArrayValue(NDebugger debugger, ICorDebugValue corValue):base(debugger, corValue) internal unsafe ArrayValue(NDebugger debugger, ICorDebugValue corValue):base(debugger, corValue)
{ {
corArrayValue = (ICorDebugArrayValue)this.corValue; corArrayValue = this.corValue.CastTo<ICorDebugArrayValue>();
uint corElementTypeRaw; uint corElementTypeRaw;
corArrayValue.GetElementType(out corElementTypeRaw); corArrayValue.GetElementType(out corElementTypeRaw);
corElementType = (CorElementType)corElementTypeRaw; corElementType = (CorElementType)corElementTypeRaw;

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs

@ -10,7 +10,7 @@ using System.Collections;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Debugger; using Debugger;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData; using Debugger.Interop.MetaData;
namespace Debugger namespace Debugger

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/NDebugger-Evals.cs

@ -8,7 +8,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/NullValue.cs

@ -8,7 +8,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {

12
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectValue.cs

@ -11,7 +11,7 @@ using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData; using Debugger.Interop.MetaData;
namespace Debugger namespace Debugger
@ -69,7 +69,7 @@ namespace Debugger
internal ICorDebugHandleValue SoftReference { internal ICorDebugHandleValue SoftReference {
get { get {
ICorDebugHeapValue2 heapValue = this.CorValue as ICorDebugHeapValue2; ICorDebugHeapValue2 heapValue = this.CorValue.As<ICorDebugHeapValue2>();
if (heapValue == null) { // TODO: Investigate if (heapValue == null) { // TODO: Investigate
return null; return null;
} }
@ -99,7 +99,7 @@ namespace Debugger
internal unsafe ObjectValue(NDebugger debugger, ICorDebugValue corValue):base(debugger, corValue) internal unsafe ObjectValue(NDebugger debugger, ICorDebugValue corValue):base(debugger, corValue)
{ {
((ICorDebugObjectValue)this.corValue).GetClass(out corClass); this.corValue.CastTo<ICorDebugObjectValue>().GetClass(out corClass);
InitObjectVariable(); InitObjectVariable();
} }
@ -195,7 +195,7 @@ namespace Debugger
if (method.IsStatic) { if (method.IsStatic) {
return new ICorDebugValue[] {}; return new ICorDebugValue[] {};
} else { } else {
return new ICorDebugValue[] {((ObjectValue)getter()).SoftReference}; return new ICorDebugValue[] {((ObjectValue)getter()).SoftReference.CastTo<ICorDebugValue>()};
} }
}); });
} }
@ -212,7 +212,7 @@ namespace Debugger
// Current frame is used to resolve context specific static values (eg. ThreadStatic) // Current frame is used to resolve context specific static values (eg. ThreadStatic)
ICorDebugFrame curFrame = null; ICorDebugFrame curFrame = null;
if (debugger.CurrentThread != null && debugger.CurrentThread.LastFunction != null && debugger.CurrentThread.LastFunction.CorILFrame != null) { if (debugger.CurrentThread != null && debugger.CurrentThread.LastFunction != null && debugger.CurrentThread.LastFunction.CorILFrame != null) {
curFrame = debugger.CurrentThread.LastFunction.CorILFrame; curFrame = debugger.CurrentThread.LastFunction.CorILFrame.CastTo<ICorDebugFrame>();
} }
try { try {
@ -220,7 +220,7 @@ namespace Debugger
if (field.IsStatic) { if (field.IsStatic) {
corClass.GetStaticFieldValue(field.Token, curFrame, out fieldValue); corClass.GetStaticFieldValue(field.Token, curFrame, out fieldValue);
} else { } else {
((ICorDebugObjectValue)val.CorValue).GetFieldValue(corClass, field.Token, out fieldValue); (val.CorValue.CastTo<ICorDebugObjectValue>()).GetFieldValue(corClass, field.Token, out fieldValue);
} }
return Value.CreateValue(debugger, fieldValue); return Value.CreateValue(debugger, fieldValue);
} catch { } catch {

10
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/PrimitiveValue.cs

@ -9,7 +9,7 @@ using System;
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {
@ -32,7 +32,7 @@ namespace Debugger
IntPtr pString = Marshal.AllocHGlobal(2); IntPtr pString = Marshal.AllocHGlobal(2);
// For some reason this function does not accept IntPtr.Zero // For some reason this function does not accept IntPtr.Zero
((ICorDebugStringValue)corValue).GetString(pStringLenght, (corValue.CastTo<ICorDebugStringValue>()).GetString(pStringLenght,
out pStringLenght, out pStringLenght,
pString); pString);
// Re-allocate string buffer // Re-allocate string buffer
@ -41,7 +41,7 @@ namespace Debugger
pStringLenght++; pStringLenght++;
pString = Marshal.AllocHGlobal((int)pStringLenght * 2); pString = Marshal.AllocHGlobal((int)pStringLenght * 2);
((ICorDebugStringValue)corValue).GetString(pStringLenght, (corValue.CastTo<ICorDebugStringValue>()).GetString(pStringLenght,
out pStringLenght, out pStringLenght,
pString); pString);
@ -53,7 +53,7 @@ namespace Debugger
object retValue; object retValue;
IntPtr pValue = Marshal.AllocHGlobal(8); IntPtr pValue = Marshal.AllocHGlobal(8);
((ICorDebugGenericValue)corValue).GetValue(pValue); (corValue.CastTo<ICorDebugGenericValue>()).GetValue(pValue);
switch(CorType) switch(CorType)
{ {
case CorElementType.BOOLEAN: retValue = *((System.Boolean*)pValue); break; case CorElementType.BOOLEAN: retValue = *((System.Boolean*)pValue); break;
@ -107,7 +107,7 @@ namespace Debugger
case CorElementType.U: *((uint*)pValue) = (uint)newValue; break; case CorElementType.U: *((uint*)pValue) = (uint)newValue; break;
default: throw new NotSupportedException(); default: throw new NotSupportedException();
} }
((ICorDebugGenericValue)corValue).SetValue(pValue); (corValue.CastTo<ICorDebugGenericValue>()).SetValue(pValue);
Marshal.FreeHGlobal(pValue); Marshal.FreeHGlobal(pValue);
} }
OnValueChanged(); OnValueChanged();

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/PropertyVariable.cs

@ -7,7 +7,7 @@
using System; using System;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/UnavailableValue.cs

@ -8,7 +8,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {

14
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs

@ -9,7 +9,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {
@ -160,13 +160,13 @@ namespace Debugger
internal static ICorDebugValue DereferenceUnbox(ICorDebugValue corValue) internal static ICorDebugValue DereferenceUnbox(ICorDebugValue corValue)
{ {
if (corValue is ICorDebugReferenceValue) { if (corValue.Is<ICorDebugReferenceValue>()) {
int isNull; int isNull;
((ICorDebugReferenceValue)corValue).IsNull(out isNull); (corValue.CastTo<ICorDebugReferenceValue>()).IsNull(out isNull);
if (isNull == 0) { if (isNull == 0) {
ICorDebugValue dereferencedValue; ICorDebugValue dereferencedValue;
try { try {
((ICorDebugReferenceValue)corValue).Dereference(out dereferencedValue); (corValue.CastTo<ICorDebugReferenceValue>()).Dereference(out dereferencedValue);
} catch { } catch {
// Error during dereferencing // Error during dereferencing
return null; return null;
@ -177,10 +177,10 @@ namespace Debugger
} }
} }
if (corValue is ICorDebugBoxValue) { if (corValue.Is<ICorDebugBoxValue>()) {
ICorDebugObjectValue corUnboxedValue; ICorDebugObjectValue corUnboxedValue;
((ICorDebugBoxValue)corValue).GetObject(out corUnboxedValue); (corValue.CastTo<ICorDebugBoxValue>()).GetObject(out corUnboxedValue);
return DereferenceUnbox(corUnboxedValue); // Try again return DereferenceUnbox(corUnboxedValue.CastTo<ICorDebugValue>()); // Try again
} }
return corValue; return corValue;

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs

@ -7,7 +7,7 @@
using System; using System;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

@ -9,7 +9,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Debugger.Interop.CorDebug; using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {

Loading…
Cancel
Save