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

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

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

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

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

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

@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
using System;
using System.Runtime.InteropServices;
using Debugger.Interop.CorDebug;
using Debugger.Wrappers.CorDebug;
namespace Debugger
{
@ -473,10 +473,10 @@ namespace Debugger @@ -473,10 +473,10 @@ namespace Debugger
public void MDANotification(ICorDebugController c, ICorDebugThread t, ICorDebugMDA mda)
{
if (c is ICorDebugAppDomain) {
EnterCallback("MDANotification", (ICorDebugAppDomain)c);
} else if (c is ICorDebugProcess){
EnterCallback("MDANotification", (ICorDebugProcess)c);
if (c.Is<ICorDebugAppDomain>()) {
EnterCallback("MDANotification", c.CastTo<ICorDebugAppDomain>());
} else if (c.Is<ICorDebugProcess>()){
EnterCallback("MDANotification", c.CastTo<ICorDebugProcess>());
} else {
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; @@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using Debugger.Interop.CorDebug;
using Debugger.Wrappers.CorDebug;
// Regular expresion:
// ^{\t*}{(:Ll| )*{:i} *\(((.# {:i}, |\))|())^6\)*}\n\t*\{(.|\n)@\t\}
@ -23,7 +23,7 @@ using Debugger.Interop.CorDebug; @@ -23,7 +23,7 @@ using Debugger.Interop.CorDebug;
namespace Debugger
{
class ManagedCallbackProxy :ICorDebugManagedCallback, ICorDebugManagedCallback2
class ManagedCallbackProxy : Debugger.Interop.CorDebug.ICorDebugManagedCallback, Debugger.Interop.CorDebug.ICorDebugManagedCallback2
{
NDebugger debugger;
ManagedCallback realCallback;
@ -52,7 +52,7 @@ namespace Debugger @@ -52,7 +52,7 @@ namespace Debugger
MTA2STA.MarshalIntPtrTo<ICorDebugAppDomain>(pAppDomain),
MTA2STA.MarshalIntPtrTo<ICorDebugThread>(pThread),
MTA2STA.MarshalIntPtrTo<ICorDebugStepper>(pStepper),
reason
(CorDebugStepReason)reason
);
});
}
@ -357,7 +357,7 @@ namespace Debugger @@ -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 {
realCallback.Exception2(
@ -365,19 +365,19 @@ namespace Debugger @@ -365,19 +365,19 @@ namespace Debugger
MTA2STA.MarshalIntPtrTo<ICorDebugThread>(pThread),
MTA2STA.MarshalIntPtrTo<ICorDebugFrame>(pFrame),
nOffset,
dwEventType,
(CorDebugExceptionCallbackType)dwEventType,
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 {
realCallback.ExceptionUnwind(
MTA2STA.MarshalIntPtrTo<ICorDebugAppDomain>(pAppDomain),
MTA2STA.MarshalIntPtrTo<ICorDebugThread>(pThread),
dwEventType,
(CorDebugExceptionUnwindCallbackType)dwEventType,
dwFlags
);
});

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

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

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

@ -11,7 +11,7 @@ using System.Runtime.InteropServices; @@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using Debugger.Interop.CorDebug;
using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData;
using System.Collections.Generic;
@ -105,13 +105,15 @@ namespace Debugger @@ -105,13 +105,15 @@ namespace Debugger
}
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);
managedCallbackProxy = new ManagedCallbackProxy(managedCallback);
corDebug.Initialize();
corDebug.SetManagedHandler(managedCallbackProxy);
corDebug.SetManagedHandler(new ICorDebugManagedCallback(managedCallbackProxy));
localVariables.Updating += OnUpdatingLocalVariables;

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

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

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

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

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

@ -10,7 +10,7 @@ using System.Diagnostics.SymbolStore; @@ -10,7 +10,7 @@ using System.Diagnostics.SymbolStore;
using System.Runtime.InteropServices;
using System.Threading;
using Debugger.Interop.CorDebug;
using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData;
using System.Collections.Generic;
@ -203,9 +203,9 @@ namespace Debugger @@ -203,9 +203,9 @@ namespace Debugger
if (stepIn) {
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 as ICorDebugStepper2).SetJMC(1 /* true */);
(stepper.CastTo<ICorDebugStepper2>()).SetJMC(1 /* true */);
}
fixed (int* ranges = nextSt.StepRanges) {
@ -220,9 +220,9 @@ namespace Debugger @@ -220,9 +220,9 @@ namespace Debugger
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 as ICorDebugStepper2).SetJMC(1 /* true */);
(stepper.CastTo<ICorDebugStepper2>()).SetJMC(1 /* true */);
}
fixed (int* ranges = nextSt.StepRanges) {

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

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

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

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

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

@ -10,7 +10,7 @@ using System.Collections.Generic; @@ -10,7 +10,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
using Debugger.Interop.CorDebug;
using Debugger.Wrappers.CorDebug;
using Debugger.Interop.MetaData;
namespace Debugger
@ -87,10 +87,10 @@ namespace Debugger @@ -87,10 +87,10 @@ namespace Debugger
{
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.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];
processStartupInfo[0] = sizeof(uint) * 17;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save