Browse Source

Using methods instead of properties

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5137 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 16 years ago
parent
commit
0bec899af9
  1. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/AppDomain.cs
  2. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoint.cs
  3. 8
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Eval.cs
  4. 18
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs
  5. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackSwitch.cs
  6. 20
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.cs
  7. 15
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.cs
  8. 8
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/MetaDataWrapper.cs
  9. 22
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/MetaData/DebugMethodInfo.cs
  10. 24
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/MetaData/DebugType.cs
  11. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Module.cs
  12. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/NDebugger.cs
  13. 34
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/SourcecodeSegment.cs
  14. 23
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/StackFrame.cs
  15. 32
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Thread.cs
  16. 38
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Value.cs

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/AppDomain.cs

@ -23,7 +23,7 @@ namespace Debugger @@ -23,7 +23,7 @@ namespace Debugger
public uint ID {
get {
return corAppDomain.ID;
return corAppDomain.GetID();
}
}

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoint.cs

@ -128,7 +128,7 @@ namespace Debugger @@ -128,7 +128,7 @@ namespace Debugger
originalLocation = segment;
ICorDebugFunctionBreakpoint corBreakpoint = segment.CorFunction.ILCode.CreateBreakpoint((uint)segment.ILStart);
ICorDebugFunctionBreakpoint corBreakpoint = segment.CorFunction.GetILCode().CreateBreakpoint((uint)segment.ILStart);
corBreakpoint.Activate(enabled ? 1 : 0);
corBreakpoints.Add(corBreakpoint);

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

@ -178,7 +178,7 @@ namespace Debugger @@ -178,7 +178,7 @@ namespace Debugger
if (state == EvalState.EvaluatedTimeOut) {
return;
}
if (corEval.Result == null) {
if (corEval.GetResult() == null) {
state = EvalState.EvaluatedNoResult;
} else {
if (successful) {
@ -186,7 +186,7 @@ namespace Debugger @@ -186,7 +186,7 @@ namespace Debugger
} else {
state = EvalState.EvaluatedException;
}
result = new Value(AppDomain, corEval.Result);
result = new Value(AppDomain, corEval.GetResult());
}
}
@ -253,7 +253,7 @@ namespace Debugger @@ -253,7 +253,7 @@ namespace Debugger
public static Value CreateValue(AppDomain appDomain, object value)
{
if (value == null) {
ICorDebugClass corClass = appDomain.ObjectType.CorType.Class;
ICorDebugClass corClass = appDomain.ObjectType.CorType.GetClass();
ICorDebugEval corEval = CreateCorEval(appDomain);
ICorDebugValue corValue = corEval.CreateValue((uint)CorElementType.CLASS, corClass);
return new Value(appDomain, corValue);
@ -351,7 +351,7 @@ namespace Debugger @@ -351,7 +351,7 @@ namespace Debugger
debugType.AppDomain,
"New object: " + debugType.FullName,
delegate(Eval eval) {
eval.CorEval.CastTo<ICorDebugEval2>().NewParameterizedObjectNoConstructor(debugType.CorType.Class, (uint)debugType.GetGenericArguments().Length, debugType.GenericArgumentsAsCorDebugType);
eval.CorEval.CastTo<ICorDebugEval2>().NewParameterizedObjectNoConstructor(debugType.CorType.GetClass(), (uint)debugType.GetGenericArguments().Length, debugType.GenericArgumentsAsCorDebugType);
}
);
}

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

@ -73,12 +73,12 @@ namespace Debugger.Internal @@ -73,12 +73,12 @@ namespace Debugger.Internal
void EnterCallback(PausedReason pausedReason, string name, ICorDebugAppDomain pAppDomain)
{
EnterCallback(pausedReason, name, pAppDomain.Process);
EnterCallback(pausedReason, name, pAppDomain.GetProcess());
}
void EnterCallback(PausedReason pausedReason, string name, ICorDebugThread pThread)
{
EnterCallback(pausedReason, name, pThread.Process);
EnterCallback(pausedReason, name, pThread.GetProcess());
process.SelectedThread = process.Threads[pThread];
}
@ -297,7 +297,7 @@ namespace Debugger.Internal @@ -297,7 +297,7 @@ namespace Debugger.Internal
foreach (Module module in process.Modules) {
if (module.CorModule == pModule) {
process.TraceMessage("UpdateModuleSymbols: Found module: " + pModule.Name);
process.TraceMessage("UpdateModuleSymbols: Found module: " + pModule.GetName());
module.UpdateSymbolsFromStream(pSymbolStream);
process.Debugger.Breakpoints.SetInModule(module);
break;
@ -339,7 +339,7 @@ namespace Debugger.Internal @@ -339,7 +339,7 @@ namespace Debugger.Internal
public void LoadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule)
{
EnterCallback(PausedReason.Other, "LoadModule " + pModule.Name, pAppDomain);
EnterCallback(PausedReason.Other, "LoadModule " + pModule.GetName(), pAppDomain);
process.Modules.Add(new Module(process.AppDomains[pAppDomain], pModule));
@ -371,7 +371,7 @@ namespace Debugger.Internal @@ -371,7 +371,7 @@ namespace Debugger.Internal
{
// We can not use pThread since it has not been added yet
// and we continue from this callback anyway
EnterCallback(PausedReason.Other, "CreateThread " + pThread.ID, pAppDomain);
EnterCallback(PausedReason.Other, "CreateThread " + pThread.GetID(), pAppDomain);
process.Threads.Add(new Thread(process, pThread));
@ -416,14 +416,14 @@ namespace Debugger.Internal @@ -416,14 +416,14 @@ namespace Debugger.Internal
{
// ICorDebugThread is still not dead and can be used for some operations
if (process.Threads.Contains(pThread)) {
EnterCallback(PausedReason.Other, "ExitThread " + pThread.ID, pThread);
EnterCallback(PausedReason.Other, "ExitThread " + pThread.GetID(), pThread);
process.Threads[pThread].NotifyExited();
} else {
EnterCallback(PausedReason.Other, "ExitThread " + pThread.ID, process.CorProcess);
EnterCallback(PausedReason.Other, "ExitThread " + pThread.GetID(), process.CorProcess);
// TODO: Investigate
process.TraceMessage("ERROR: Thread does not exist " + pThread.ID);
process.TraceMessage("ERROR: Thread does not exist " + pThread.GetID());
}
try {
@ -484,7 +484,7 @@ namespace Debugger.Internal @@ -484,7 +484,7 @@ namespace Debugger.Internal
// Watch out for the zeros and null!
// Exception -> Exception2(pAppDomain, pThread, null, 0, exceptionType, 0);
process.SelectedThread.CurrentException = new Exception(new Value(process.AppDomains[pAppDomain], process.SelectedThread.CorThread.CurrentException));
process.SelectedThread.CurrentException = new Exception(new Value(process.AppDomains[pAppDomain], process.SelectedThread.CorThread.GetCurrentException()));
process.SelectedThread.CurrentException_DebuggeeState = process.DebuggeeState;
process.SelectedThread.CurrentExceptionType = (ExceptionType)exceptionType;
process.SelectedThread.CurrentExceptionIsUnhandled = (ExceptionType)exceptionType == ExceptionType.Unhandled;

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackSwitch.cs

@ -54,7 +54,7 @@ namespace Debugger.Internal @@ -54,7 +54,7 @@ namespace Debugger.Internal
{
ICorDebugProcess pProcess;
try {
pProcess = pThread.Process;
pProcess = pThread.GetProcess();
} catch (COMException e) {
debugger.TraceMessage("Ignoring callback \"" + name + "\": " + e.Message);
return null;
@ -66,7 +66,7 @@ namespace Debugger.Internal @@ -66,7 +66,7 @@ namespace Debugger.Internal
{
ICorDebugProcess pProcess;
try {
pProcess = pAppDomain.Process;
pProcess = pAppDomain.GetProcess();
} catch (COMException e) {
debugger.TraceMessage("Ignoring callback \"" + name + "\": " + e.Message);
return null;
@ -96,7 +96,7 @@ namespace Debugger.Internal @@ -96,7 +96,7 @@ namespace Debugger.Internal
}
// Check that the process is not exited
try {
int isRunning = process.CorProcess.IsRunning;
int isRunning = process.CorProcess.IsRunning();
} catch (COMException e) {
process.TraceMessage("Ignoring callback \"" + name + "\": " + e.Message);
return null;

20
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorDebugExtensionMethods.cs

@ -6,11 +6,31 @@ @@ -6,11 +6,31 @@
// </file>
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Debugger.Interop.CorDebug
{
public static partial class CorDebugExtensionMethods
{
// TODO: Remove
public static T CastTo<T>(this object obj)
{
return (T)obj;
}
// TODO: Remove
public static bool Is<T>(this object obj)
{
return obj is T;
}
// TODO: Remove
public static T As<T>(this object obj) where T:class
{
return obj as T;
}
// ICorDebugArrayValue
public static unsafe uint[] GetDimensions(this ICorDebugArrayValue corArray)

15
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/CorSymExtensionMethods.cs

@ -6,8 +6,9 @@ @@ -6,8 +6,9 @@
// </file>
using System;
using System.Runtime.InteropServices;
namespace Debugger.Interop.CorDebug
namespace Debugger.Interop.CorSym
{
public static partial class CorSymExtensionMethods
{
@ -146,12 +147,12 @@ namespace Debugger.Interop.CorDebug @@ -146,12 +147,12 @@ namespace Debugger.Interop.CorDebug
public class SequencePoint: IComparable<SequencePoint>
{
public ISymUnmanagedDocument Document { get; private set; }
public uint Offset { get; private set; }
public uint Line { get; private set; }
public uint Column { get; private set; }
public uint EndLine { get; private set; }
public uint EndColumn { get; private set; }
public ISymUnmanagedDocument Document { get; internal set; }
public uint Offset { get; internal set; }
public uint Line { get; internal set; }
public uint Column { get; internal set; }
public uint EndLine { get; internal set; }
public uint EndColumn { get; internal set; }
public int CompareTo(SequencePoint other)
{

8
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/MetaDataWrapper.cs

@ -34,17 +34,19 @@ namespace Debugger.Interop.MetaData @@ -34,17 +34,19 @@ namespace Debugger.Interop.MetaData
public ISymUnmanagedReader GetSymReader(string fullname, string searchPath)
{
try {
ISymUnmanagedBinder symBinder = new ISymUnmanagedBinder(new Debugger.Interop.CorSym.CorSymBinder_SxSClass());
// TODO: Track
ISymUnmanagedBinder symBinder = new Debugger.Interop.CorSym.CorSymBinder_SxSClass();
return symBinder.GetReaderForFile(metaData, fullname, searchPath);
} catch {
return null;
}
}
public ISymUnmanagedReader GetSymReader(Debugger.Interop.CorDebug.IStream stream)
public ISymUnmanagedReader GetSymReader(Debugger.Interop.CorSym.IStream stream)
{
try {
ISymUnmanagedBinder symBinder = new ISymUnmanagedBinder(new Debugger.Interop.CorSym.CorSymBinder_SxSClass());
// TODO: Track
ISymUnmanagedBinder symBinder = new Debugger.Interop.CorSym.CorSymBinder_SxSClass();
return symBinder.GetReaderFromStream(metaData, stream);
} catch {
return null;

22
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/MetaData/DebugMethodInfo.cs

@ -294,13 +294,13 @@ namespace Debugger.MetaData @@ -294,13 +294,13 @@ namespace Debugger.MetaData
ICorDebugCode corCode;
try {
corCode = this.CorFunction.ILCode;
corCode = this.CorFunction.GetILCode();
} catch {
return null;
}
if (corCode == null) return null;
if (corCode.Size != 7 && corCode.Size != 12 && corCode.Size != 11) return null;
if (corCode.GetSize() != 7 && corCode.GetSize() != 12 && corCode.GetSize() != 11) return null;
byte[] code = corCode.GetCode();
@ -396,7 +396,7 @@ namespace Debugger.MetaData @@ -396,7 +396,7 @@ namespace Debugger.MetaData
if (isSingleLine.HasValue) return isSingleLine.Value;
List<SequencePoint> seqPoints = new List<SequencePoint>(symMethod.SequencePoints);
List<SequencePoint> seqPoints = new List<SequencePoint>(symMethod.GetSequencePoints());
seqPoints.Sort();
// Remove initial "{"
@ -477,7 +477,7 @@ namespace Debugger.MetaData @@ -477,7 +477,7 @@ namespace Debugger.MetaData
if (localVariables != null) return localVariables;
localVariables = GetLocalVariablesInScope(this.SymMethod.RootScope);
localVariables = GetLocalVariablesInScope(this.SymMethod.GetRootScope());
if (declaringType.IsDisplayClass || declaringType.IsYieldEnumerator) {
// Get display class from self
AddCapturedLocalVariables(
@ -561,15 +561,15 @@ namespace Debugger.MetaData @@ -561,15 +561,15 @@ namespace Debugger.MetaData
List<DebugLocalVariableInfo> GetLocalVariablesInScope(ISymUnmanagedScope symScope)
{
List<DebugLocalVariableInfo> vars = new List<DebugLocalVariableInfo>();
foreach (ISymUnmanagedVariable symVar in symScope.Locals) {
foreach (ISymUnmanagedVariable symVar in symScope.GetLocals()) {
ISymUnmanagedVariable symVarCopy = symVar;
int start;
SignatureReader sigReader = new SignatureReader(symVar.Signature);
SignatureReader sigReader = new SignatureReader(symVar.GetSignature());
LocalVarSig.LocalVariable locVarSig = sigReader.ReadLocalVariable(sigReader.Blob, 0, out start);
DebugType locVarType = DebugType.CreateFromSignature(this.DebugModule, locVarSig.Type, declaringType);
// Compiler generated?
// NB: Display class does not have the compiler-generated flag
if ((symVar.Attributes & 1) == 1 || symVar.Name.StartsWith("CS$")) {
if ((symVar.GetAttributes() & 1) == 1 || symVar.GetName().StartsWith("CS$")) {
// Get display class from local variable
if (locVarType.IsDisplayClass) {
AddCapturedLocalVariables(
@ -582,8 +582,8 @@ namespace Debugger.MetaData @@ -582,8 +582,8 @@ namespace Debugger.MetaData
}
} else {
DebugLocalVariableInfo locVar = new DebugLocalVariableInfo(
symVar.Name,
(int)symVar.AddressField1,
symVar.GetName(),
(int)symVar.GetAddressField1(),
locVarType,
delegate(StackFrame context) {
return GetLocalVariableValue(context, symVarCopy);
@ -592,7 +592,7 @@ namespace Debugger.MetaData @@ -592,7 +592,7 @@ namespace Debugger.MetaData
vars.Add(locVar);
}
}
foreach(ISymUnmanagedScope childScope in symScope.Children) {
foreach(ISymUnmanagedScope childScope in symScope.GetChildren()) {
vars.AddRange(GetLocalVariablesInScope(childScope));
}
return vars;
@ -602,7 +602,7 @@ namespace Debugger.MetaData @@ -602,7 +602,7 @@ namespace Debugger.MetaData
{
ICorDebugValue corVal;
try {
corVal = context.CorILFrame.GetLocalVariable((uint)symVar.AddressField1);
corVal = context.CorILFrame.GetLocalVariable((uint)symVar.GetAddressField1());
} catch (COMException e) {
if ((uint)e.ErrorCode == 0x80131304) throw new GetValueException("Unavailable in optimized code");
throw;

24
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/MetaData/DebugType.cs

@ -169,7 +169,7 @@ namespace Debugger.MetaData @@ -169,7 +169,7 @@ namespace Debugger.MetaData
if (this.IsPointer || corElementType == CorElementType.VOID) {
return null;
}
ICorDebugType baseType = corType.Base;
ICorDebugType baseType = corType.GetBase();
if (baseType != null) {
return CreateFromCorType(this.AppDomain, baseType);
} else {
@ -225,7 +225,7 @@ namespace Debugger.MetaData @@ -225,7 +225,7 @@ namespace Debugger.MetaData
{
if (!IsArray) throw new ArgumentException("Type is not array");
return (int)corType.Rank;
return (int)corType.GetRank();
}
/// <inheritdoc/>
@ -915,10 +915,10 @@ namespace Debugger.MetaData @@ -915,10 +915,10 @@ namespace Debugger.MetaData
public static DebugType CreateFromCorClass(AppDomain appDomain, bool? valueType, ICorDebugClass corClass, DebugType[] genericArguments)
{
MetaDataImport metaData = appDomain.Process.Modules[corClass.Module].MetaData;
MetaDataImport metaData = appDomain.Process.Modules[corClass.GetModule()].MetaData;
if (valueType == null) {
uint superClassToken = metaData.GetTypeDefProps(corClass.Token).SuperClassToken;
uint superClassToken = metaData.GetTypeDefProps(corClass.GetToken()).SuperClassToken;
CorTokenType tkType = (CorTokenType)(superClassToken & 0xFF000000);
if (tkType == CorTokenType.TypeDef) {
valueType = metaData.GetTypeDefProps(superClassToken).Name == typeof(ValueType).FullName;
@ -932,10 +932,10 @@ namespace Debugger.MetaData @@ -932,10 +932,10 @@ namespace Debugger.MetaData
}
genericArguments = genericArguments ?? new DebugType[] {};
if (genericArguments.Length < metaData.GetGenericParamCount(corClass.Token)) {
if (genericArguments.Length < metaData.GetGenericParamCount(corClass.GetToken())) {
throw new DebuggerException("Not enough generic arguments");
}
Array.Resize(ref genericArguments, metaData.GetGenericParamCount(corClass.Token));
Array.Resize(ref genericArguments, metaData.GetGenericParamCount(corClass.GetToken()));
List<ICorDebugType> corGenArgs = new List<ICorDebugType>(genericArguments.Length);
foreach(DebugType genAgr in genericArguments) {
@ -951,7 +951,7 @@ namespace Debugger.MetaData @@ -951,7 +951,7 @@ namespace Debugger.MetaData
public static DebugType CreateFromCorType(AppDomain appDomain, ICorDebugType corType)
{
// Convert primitive type to class
CorElementType corElemType = (CorElementType)(corType.Type);
CorElementType corElemType = (CorElementType)(corType.GetType());
Type primitiveType = CorElementTypeToManagedType(corElemType);
if (primitiveType != null) {
corType = CreateFromType(appDomain.Mscorlib, primitiveType).CorType;
@ -971,7 +971,7 @@ namespace Debugger.MetaData @@ -971,7 +971,7 @@ namespace Debugger.MetaData
DateTime startTime = Util.HighPrecisionTimer.Now;
this.corType = corType;
this.corElementType = (CorElementType)corType.Type;
this.corElementType = (CorElementType)corType.GetType();
// Loading might access the type again
loadedTypes[corType] = this;
@ -982,7 +982,7 @@ namespace Debugger.MetaData @@ -982,7 +982,7 @@ namespace Debugger.MetaData
corElementType == CorElementType.PTR ||
corElementType == CorElementType.BYREF)
{
this.elementType = CreateFromCorType(appDomain, corType.FirstTypeParameter);
this.elementType = CreateFromCorType(appDomain, corType.GetFirstTypeParameter());
this.module = appDomain.Mscorlib;
this.classProps = new TypeDefProps();
// Get names
@ -1001,12 +1001,12 @@ namespace Debugger.MetaData @@ -1001,12 +1001,12 @@ namespace Debugger.MetaData
corElementType == CorElementType.VALUETYPE)
{
// Get generic arguments
foreach(ICorDebugType t in corType.EnumerateTypeParameters().Enumerator) {
foreach(ICorDebugType t in corType.EnumerateTypeParameters().GetEnumerator()) {
genericArguments.Add(DebugType.CreateFromCorType(appDomain, t));
}
// Get class props
this.module = appDomain.Process.Modules[corType.Class.Module];
this.classProps = module.MetaData.GetTypeDefProps(corType.Class.Token);
this.module = appDomain.Process.Modules[corType.GetClass().GetModule()];
this.classProps = module.MetaData.GetTypeDefProps(corType.GetClass().GetToken());
// Get the enclosing class
if (classProps.IsNested) {
uint enclosingTk = module.MetaData.GetNestedClassProps((uint)this.MetadataToken).EnclosingClass;

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

@ -89,25 +89,25 @@ namespace Debugger @@ -89,25 +89,25 @@ namespace Debugger
public ulong BaseAdress {
get {
return corModule.BaseAddress;
return corModule.GetBaseAddress();
}
}
public bool IsDynamic {
get {
return corModule.IsDynamic == 1;
return corModule.IsDynamic() == 1;
}
}
public bool IsInMemory {
get {
return corModule.IsInMemory == 1;
return corModule.IsInMemory() == 1;
}
}
internal uint AppDomainID {
get {
return this.CorModule.Assembly.AppDomain.ID;
return this.CorModule.GetAssembly().GetAppDomain().GetID();
}
}
@ -180,7 +180,7 @@ namespace Debugger @@ -180,7 +180,7 @@ namespace Debugger
metaData = new MetaDataImport(pModule);
fullPath = pModule.Name;
fullPath = pModule.GetName();
LoadSymbols(process.Options.SymbolsSearchPaths);

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

@ -125,7 +125,7 @@ namespace Debugger @@ -125,7 +125,7 @@ namespace Debugger
managedCallbackProxy = new ManagedCallbackProxy(this, managedCallbackSwitch);
corDebug.Initialize();
corDebug.SetManagedHandler(new ICorDebugManagedCallback(managedCallbackProxy));
corDebug.SetManagedHandler(managedCallbackProxy);
TraceMessage("ICorDebug initialized, debugee version " + debuggeeVersion);
}

34
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/SourcecodeSegment.cs

@ -89,7 +89,7 @@ namespace Debugger @@ -89,7 +89,7 @@ namespace Debugger
// "c:\project\file.cs" N/A
if (Path.IsPathRooted(filename) && checksum == null) {
foreach(ISymUnmanagedDocument symDoc in symDocs) {
if (symDoc.URL.ToLower() == filename) return symDoc;
if (symDoc.GetURL().ToLower() == filename) return symDoc;
}
return null; // Not found
}
@ -97,7 +97,7 @@ namespace Debugger @@ -97,7 +97,7 @@ namespace Debugger
// "c:\project\file.cs" 0123456789
if (Path.IsPathRooted(filename) && checksum != null) {
foreach(ISymUnmanagedDocument symDoc in symDocs) {
if (symDoc.URL.ToLower() == filename) return symDoc;
if (symDoc.GetURL().ToLower() == filename) return symDoc;
}
// Not found - try to find using checksum
filename = Path.GetFileName(filename);
@ -109,7 +109,7 @@ namespace Debugger @@ -109,7 +109,7 @@ namespace Debugger
filename = @"\" + filename;
}
foreach(ISymUnmanagedDocument symDoc in symDocs) {
if (symDoc.URL.ToLower().EndsWith(filename)) return symDoc;
if (symDoc.GetURL().ToLower().EndsWith(filename)) return symDoc;
}
return null; // Not found
}
@ -120,8 +120,8 @@ namespace Debugger @@ -120,8 +120,8 @@ namespace Debugger
filename = @"\" + filename;
}
foreach(ISymUnmanagedDocument symDoc in symDocs) {
if (!symDoc.URL.ToLower().EndsWith(filename)) continue;
byte[] symDocCheckSum = symDoc.CheckSum;
if (!symDoc.GetURL().ToLower().EndsWith(filename)) continue;
byte[] symDocCheckSum = symDoc.GetCheckSum();
if (symDocCheckSum.Length != checksum.Length) continue;
for (int i = 0; i < checksum.Length; i++) {
if (symDocCheckSum[i] != checksum[i]) continue;
@ -153,7 +153,7 @@ namespace Debugger @@ -153,7 +153,7 @@ namespace Debugger
return null; //Not found
}
SequencePoint[] seqPoints = symMethod.SequencePoints;
SequencePoint[] seqPoints = symMethod.GetSequencePoints();
Array.Sort(seqPoints);
if (seqPoints.Length == 0) return null;
if (line < seqPoints[0].Line) return null;
@ -163,13 +163,13 @@ namespace Debugger @@ -163,13 +163,13 @@ namespace Debugger
if (line < sqPoint.EndLine || (line == sqPoint.EndLine && column < sqPoint.EndColumn)) {
SourcecodeSegment segment = new SourcecodeSegment();
segment.module = module;
segment.filename = symDoc.URL;
segment.checkSum = symDoc.CheckSum;
segment.filename = symDoc.GetURL();
segment.checkSum = symDoc.GetCheckSum();
segment.startLine = (int)sqPoint.Line;
segment.startColumn = (int)sqPoint.Column;
segment.endLine = (int)sqPoint.EndLine;
segment.endColumn = (int)sqPoint.EndColumn;
segment.corFunction = module.CorModule.GetFunctionFromToken(symMethod.Token);
segment.corFunction = module.CorModule.GetFunctionFromToken(symMethod.GetToken());
segment.ilStart = (int)sqPoint.Offset;
segment.ilEnd = (int)sqPoint.Offset;
segment.stepRanges = null;
@ -181,7 +181,7 @@ namespace Debugger @@ -181,7 +181,7 @@ namespace Debugger
static string GetFilenameFromSymDocument(Module module, ISymUnmanagedDocument symDoc)
{
if (File.Exists(symDoc.URL)) return symDoc.URL;
if (File.Exists(symDoc.GetURL())) return symDoc.GetURL();
List<string> searchPaths = new List<string>();
@ -202,7 +202,7 @@ namespace Debugger @@ -202,7 +202,7 @@ namespace Debugger
}
List<string> filenames = new List<string>();
string filename = symDoc.URL;
string filename = symDoc.GetURL();
while (true) {
// Remove start of the path
int index = filename.IndexOf('\\');
@ -225,7 +225,7 @@ namespace Debugger @@ -225,7 +225,7 @@ namespace Debugger
}
}
return symDoc.URL;
return symDoc.GetURL();
}
/// <summary>
@ -239,7 +239,7 @@ namespace Debugger @@ -239,7 +239,7 @@ namespace Debugger
ISymUnmanagedMethod symMethod;
try {
symMethod = symReader.GetMethod(corFunction.Token);
symMethod = symReader.GetMethod(corFunction.GetToken());
} catch (COMException) {
// Can not find the method
// eg. Compiler generated constructors are not in symbol store
@ -247,15 +247,15 @@ namespace Debugger @@ -247,15 +247,15 @@ namespace Debugger
}
if (symMethod == null) return null;
uint sequencePointCount = symMethod.SequencePointCount;
SequencePoint[] sequencePoints = symMethod.SequencePoints;
uint sequencePointCount = symMethod.GetSequencePointCount();
SequencePoint[] sequencePoints = symMethod.GetSequencePoints();
// Get i for which: offsets[i] <= offset < offsets[i + 1]
// or fallback to first element if offset < offsets[0]
for (int i = (int)sequencePointCount - 1; i >= 0; i--) { // backwards
if (sequencePoints[i].Offset <= offset || i == 0) {
// Set inforamtion about current IL range
int codeSize = (int)corFunction.ILCode.Size;
int codeSize = (int)corFunction.GetILCode().GetSize();
int ilStart = (int)sequencePoints[i].Offset;
int ilEnd = (i + 1 < sequencePointCount) ? (int)sequencePoints[i+1].Offset : codeSize;
@ -302,7 +302,7 @@ namespace Debugger @@ -302,7 +302,7 @@ namespace Debugger
SourcecodeSegment segment = new SourcecodeSegment();
segment.module = module;
segment.filename = GetFilenameFromSymDocument(module, sequencePoints[i].Document);
segment.checkSum = sequencePoints[i].Document.CheckSum;
segment.checkSum = sequencePoints[i].Document.GetCheckSum();
segment.startLine = (int)sequencePoints[i].Line;
segment.startColumn = (int)sequencePoints[i].Column;
segment.endLine = (int)sequencePoints[i].EndLine;

23
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/StackFrame.cs

@ -88,15 +88,15 @@ namespace Debugger @@ -88,15 +88,15 @@ namespace Debugger
{
this.process = thread.Process;
this.thread = thread;
this.appDomain = process.AppDomains[corILFrame.Function.Class.Module.Assembly.AppDomain];
this.appDomain = process.AppDomains[corILFrame.GetFunction().GetClass().GetModule().GetAssembly().GetAppDomain()];
this.corILFrame = corILFrame;
this.corILFramePauseSession = process.PauseSession;
this.corFunction = corILFrame.Function;
this.corFunction = corILFrame.GetFunction();
this.chainIndex = chainIndex;
this.frameIndex = frameIndex;
MetaDataImport metaData = thread.Process.Modules[corFunction.Class.Module].MetaData;
int methodGenArgs = metaData.GetGenericParamCount(corFunction.Token);
MetaDataImport metaData = thread.Process.Modules[corFunction.GetClass().GetModule()].MetaData;
int methodGenArgs = metaData.GetGenericParamCount(corFunction.GetToken());
// Class parameters are first, then the method ones
List<ICorDebugType> corGenArgs = corILFrame.CastTo<ICorDebugILFrame2>().EnumerateTypeParameters().ToList();
// Remove method parametrs at the end
@ -109,10 +109,10 @@ namespace Debugger @@ -109,10 +109,10 @@ namespace Debugger
DebugType debugType = DebugType.CreateFromCorClass(
this.AppDomain,
null,
corFunction.Class,
corFunction.GetClass(),
genArgs.ToArray()
);
this.methodInfo = (DebugMethodInfo)debugType.GetMember(corFunction.Token);
this.methodInfo = (DebugMethodInfo)debugType.GetMember(corFunction.GetToken());
}
/// <summary> Returns diagnostic description of the frame </summary>
@ -137,7 +137,8 @@ namespace Debugger @@ -137,7 +137,8 @@ namespace Debugger
internal uint CorInstructionPtr {
get {
uint corInstructionPtr;
CorILFrame.GetIP(out corInstructionPtr);
CorDebugMappingResult mappingResult;
CorILFrame.GetIP(out corInstructionPtr, out mappingResult);
return corInstructionPtr;
}
}
@ -251,7 +252,7 @@ namespace Debugger @@ -251,7 +252,7 @@ namespace Debugger
SourcecodeSegment segment = SourcecodeSegment.Resolve(this.MethodInfo.DebugModule, filename, null, line, column);
if (segment != null && segment.CorFunction.Token == this.MethodInfo.MetadataToken) {
if (segment != null && segment.CorFunction.GetToken() == this.MethodInfo.MetadataToken) {
try {
if (simulate) {
CorILFrame.CanSetIP((uint)segment.ILStart);
@ -292,7 +293,7 @@ namespace Debugger @@ -292,7 +293,7 @@ namespace Debugger
throw;
}
// This can be 'by ref' for value types
if (corValue.Type == (uint)CorElementType.BYREF) {
if (corValue.GetType() == (uint)CorElementType.BYREF) {
corValue = corValue.CastTo<ICorDebugReferenceValue>().Dereference();
}
return corValue;
@ -302,7 +303,7 @@ namespace Debugger @@ -302,7 +303,7 @@ namespace Debugger
public int ArgumentCount {
get {
ICorDebugValueEnum argumentEnum = CorILFrame.EnumerateArguments();
uint argCount = argumentEnum.Count;
uint argCount = argumentEnum.GetCount();
if (!this.MethodInfo.IsStatic) {
argCount--; // Remove 'this' from count
}
@ -340,7 +341,7 @@ namespace Debugger @@ -340,7 +341,7 @@ namespace Debugger
throw;
}
// Method arguments can be passed 'by ref'
if (corValue.Type == (uint)CorElementType.BYREF) {
if (corValue.GetType() == (uint)CorElementType.BYREF) {
try {
corValue = corValue.CastTo<ICorDebugReferenceValue>().Dereference();
} catch (COMException e) {

32
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Thread.cs

@ -60,7 +60,7 @@ namespace Debugger @@ -60,7 +60,7 @@ namespace Debugger
public bool IsInValidState {
get {
try {
CorThread.UserState.ToString();
CorThread.GetUserState().ToString();
CorThread.EnumerateChains();
return true;
} catch (COMException e) {
@ -86,7 +86,7 @@ namespace Debugger @@ -86,7 +86,7 @@ namespace Debugger
{
this.process = process;
this.corThread = corThread;
this.id = CorThread.ID;
this.id = CorThread.GetID();
}
internal void NotifyExited()
@ -119,7 +119,7 @@ namespace Debugger @@ -119,7 +119,7 @@ namespace Debugger
if (!IsInValidState) return false;
return CorThread.UserState != CorDebugUserState.USER_UNSAFE_POINT;
return CorThread.GetUserState() != CorDebugUserState.USER_UNSAFE_POINT;
}
}
@ -130,7 +130,7 @@ namespace Debugger @@ -130,7 +130,7 @@ namespace Debugger
if (!IsInValidState) return false;
return (CorThread.DebugState == CorDebugThreadState.THREAD_SUSPEND);
return (CorThread.GetDebugState() == CorDebugThreadState.THREAD_SUSPEND);
}
set {
CorThread.SetDebugState((value==true) ? CorDebugThreadState.THREAD_SUSPEND : CorDebugThreadState.THREAD_RUN);
@ -158,8 +158,8 @@ namespace Debugger @@ -158,8 +158,8 @@ namespace Debugger
get {
process.AssertPaused();
ICorDebugValue corValue = this.CorThread.Object;
return new Value(process.AppDomains[this.CorThread.AppDomain], corValue);
ICorDebugValue corValue = this.CorThread.GetObject();
return new Value(process.AppDomains[this.CorThread.GetAppDomain()], corValue);
}
}
@ -222,7 +222,7 @@ namespace Debugger @@ -222,7 +222,7 @@ namespace Debugger
public bool InterceptCurrentException()
{
if (!this.CorThread.Is<ICorDebugThread2>()) return false; // Is the debuggee .NET 2.0?
if (this.CorThread.CurrentException == null) return false; // Is there any exception
if (this.CorThread.GetCurrentException() == null) return false; // Is there any exception
if (this.MostRecentStackFrame == null) return false; // Is frame available? It is not at StackOverflow
try {
@ -292,9 +292,9 @@ namespace Debugger @@ -292,9 +292,9 @@ namespace Debugger
yield break;
}
foreach(ICorDebugChain corChain in CorThread.EnumerateChains().Enumerator) {
if (corChain.IsManaged == 0) continue; // Only managed ones
foreach(ICorDebugFrame corFrame in corChain.EnumerateFrames().Enumerator) {
foreach(ICorDebugChain corChain in CorThread.EnumerateChains().GetEnumerator()) {
if (corChain.IsManaged() == 0) continue; // Only managed ones
foreach(ICorDebugFrame corFrame in corChain.EnumerateFrames().GetEnumerator()) {
if (!corFrame.Is<ICorDebugILFrame>()) continue; // Only IL frames
StackFrame stackFrame;
try {
@ -313,15 +313,15 @@ namespace Debugger @@ -313,15 +313,15 @@ namespace Debugger
process.AssertPaused();
ICorDebugChainEnum corChainEnum = CorThread.EnumerateChains();
if (chainIndex >= corChainEnum.Count) throw new DebuggerException("The requested chain index is too big");
corChainEnum.Skip(corChainEnum.Count - chainIndex - 1);
if (chainIndex >= corChainEnum.GetCount()) throw new DebuggerException("The requested chain index is too big");
corChainEnum.Skip(corChainEnum.GetCount() - chainIndex - 1);
ICorDebugChain corChain = corChainEnum.Next();
if (corChain.IsManaged == 0) throw new DebuggerException("The requested chain is not managed");
if (corChain.IsManaged() == 0) throw new DebuggerException("The requested chain is not managed");
ICorDebugFrameEnum corFrameEnum = corChain.EnumerateFrames();
if (frameIndex >= corFrameEnum.Count) throw new DebuggerException("The requested frame index is too big");
corFrameEnum.Skip(corFrameEnum.Count - frameIndex - 1);
if (frameIndex >= corFrameEnum.GetCount()) throw new DebuggerException("The requested frame index is too big");
corFrameEnum.Skip(corFrameEnum.GetCount() - frameIndex - 1);
ICorDebugFrame corFrame = corFrameEnum.Next();
if (!corFrame.Is<ICorDebugILFrame>()) throw new DebuggerException("The rquested frame is not IL frame");
@ -412,7 +412,7 @@ namespace Debugger @@ -412,7 +412,7 @@ namespace Debugger
get {
process.AssertPaused();
if (this.IsInValidState) {
return corThread.ActiveChain.IsManaged == 0;
return corThread.GetActiveChain().IsManaged() == 0;
} else {
return false;
}

38
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Value.cs

@ -64,7 +64,7 @@ namespace Debugger @@ -64,7 +64,7 @@ namespace Debugger
if (corValue.Is<ICorDebugReferenceValue>())
corValue = corValue.CastTo<ICorDebugReferenceValue>().Dereference();
if (corValue.Is<ICorDebugBoxValue>())
corValue = corValue.CastTo<ICorDebugBoxValue>().Object.CastTo<ICorDebugValue>();
corValue = corValue.CastTo<ICorDebugBoxValue>().GetObject().CastTo<ICorDebugValue>();
if (!corValue.Is<ICorDebugGenericValue>())
throw new DebuggerException("Value is not an generic value");
return corValue.CastTo<ICorDebugGenericValue>();
@ -89,7 +89,7 @@ namespace Debugger @@ -89,7 +89,7 @@ namespace Debugger
if (corValue.Is<ICorDebugReferenceValue>())
corValue = corValue.CastTo<ICorDebugReferenceValue>().Dereference();
if (corValue.Is<ICorDebugBoxValue>())
return corValue.CastTo<ICorDebugBoxValue>().Object;
return corValue.CastTo<ICorDebugBoxValue>().GetObject();
if (!corValue.Is<ICorDebugObjectValue>())
throw new DebuggerException("Value is not an object");
return corValue.CastTo<ICorDebugObjectValue>();
@ -122,7 +122,7 @@ namespace Debugger @@ -122,7 +122,7 @@ namespace Debugger
public bool IsNull {
get {
return this.CorValue.Is<ICorDebugReferenceValue>() &&
this.CorValue.CastTo<ICorDebugReferenceValue>().IsNull != 0;
this.CorValue.CastTo<ICorDebugReferenceValue>().IsNull() != 0;
}
}
@ -131,14 +131,14 @@ namespace Debugger @@ -131,14 +131,14 @@ namespace Debugger
/// </summary>
[Debugger.Tests.Ignore]
public ulong Address {
get { return corValue.Address; }
get { return corValue.GetAddress(); }
}
[Debugger.Tests.Ignore]
public ulong PointerAddress {
get {
if (!this.Type.IsPointer) throw new DebuggerException("Not a pointer");
return this.CorValue.CastTo<ICorDebugReferenceValue>().Value;
return this.CorValue.CastTo<ICorDebugReferenceValue>().GetValue();
}
}
@ -160,14 +160,14 @@ namespace Debugger @@ -160,14 +160,14 @@ namespace Debugger
this.corValue_pauseSession = this.Process.PauseSession;
if (corValue.Is<ICorDebugReferenceValue>() &&
corValue.CastTo<ICorDebugReferenceValue>().Value == 0 &&
corValue.CastTo<ICorDebugValue2>().ExactType == null)
corValue.CastTo<ICorDebugReferenceValue>().GetValue() == 0 &&
corValue.CastTo<ICorDebugValue2>().GetExactType() == null)
{
// We were passed null reference and no metadata description
// (happens during CreateThread callback for the thread object)
this.type = appDomain.ObjectType;
} else {
ICorDebugType exactType = this.CorValue.CastTo<ICorDebugValue2>().ExactType;
ICorDebugType exactType = this.CorValue.CastTo<ICorDebugValue2>().GetExactType();
this.type = DebugType.CreateFromCorType(appDomain, exactType);
}
}
@ -175,7 +175,7 @@ namespace Debugger @@ -175,7 +175,7 @@ namespace Debugger
// Box value type
public Value Box()
{
byte[] rawValue = this.CorGenericValue.RawValue;
byte[] rawValue = this.CorGenericValue.GetRawValue();
// The type must not be a primive type (always true in current design)
ICorDebugValue corValue = Eval.NewObjectNoConstructor(this.Type).CorValue;
// Make the reference to box permanent
@ -183,7 +183,7 @@ namespace Debugger @@ -183,7 +183,7 @@ namespace Debugger
// Create new value
Value newValue = new Value(appDomain, corValue);
// Copy the data inside the box
newValue.CorGenericValue.RawValue = rawValue;
newValue.CorGenericValue.SetRawValue(rawValue);
return newValue;
}
@ -205,7 +205,7 @@ namespace Debugger @@ -205,7 +205,7 @@ namespace Debugger
{
if (!this.Type.IsPointer) throw new DebuggerException("Not a pointer");
ICorDebugReferenceValue corRef = this.CorValue.CastTo<ICorDebugReferenceValue>();
if (corRef.Value == 0 || corRef.Dereference() == null) {
if (corRef.GetValue() == 0 || corRef.Dereference() == null) {
return null;
} else {
return new Value(this.AppDomain, corRef.Dereference());
@ -220,9 +220,9 @@ namespace Debugger @@ -220,9 +220,9 @@ namespace Debugger
if (this.CorValue.Is<ICorDebugReferenceValue>()) {
if (!newCorValue.Is<ICorDebugReferenceValue>())
newCorValue = newValue.Box().CorValue;
corValue.CastTo<ICorDebugReferenceValue>().SetValue(newCorValue.CastTo<ICorDebugReferenceValue>().Value);
corValue.CastTo<ICorDebugReferenceValue>().SetValue(newCorValue.CastTo<ICorDebugReferenceValue>().GetValue());
} else {
corValue.CastTo<ICorDebugGenericValue>().RawValue = newValue.CorGenericValue.RawValue;
corValue.CastTo<ICorDebugGenericValue>().SetRawValue(newValue.CorGenericValue.GetRawValue());
}
}
@ -238,7 +238,7 @@ namespace Debugger @@ -238,7 +238,7 @@ namespace Debugger
if (this.Type.PrimitiveType == null) throw new DebuggerException("Value is not a primitive type");
if (this.Type.FullName == typeof(string).FullName) {
if (this.IsNull) return null;
return this.CorReferenceValue.Dereference().CastTo<ICorDebugStringValue>().String;
return this.CorReferenceValue.Dereference().CastTo<ICorDebugStringValue>().GetString();
} else {
return CorGenericValue.GetValue(this.Type.PrimitiveType);
}
@ -274,7 +274,7 @@ namespace Debugger @@ -274,7 +274,7 @@ namespace Debugger
public int ArrayLength {
get {
if (!this.Type.IsArray) return 0;
return (int)CorArrayValue.Count;
return (int)CorArrayValue.GetCount();
}
}
@ -286,7 +286,7 @@ namespace Debugger @@ -286,7 +286,7 @@ namespace Debugger
public int ArrayRank {
get {
if (!this.Type.IsArray) return 0;
return (int)CorArrayValue.Rank;
return (int)CorArrayValue.GetRank();
}
}
@ -298,11 +298,11 @@ namespace Debugger @@ -298,11 +298,11 @@ namespace Debugger
int rank = this.ArrayRank;
uint[] baseIndicies;
if (CorArrayValue.HasBaseIndicies() == 1) {
baseIndicies = CorArrayValue.BaseIndicies;
baseIndicies = CorArrayValue.GetBaseIndicies();
} else {
baseIndicies = new uint[this.ArrayRank];
}
uint[] dimensionCounts = CorArrayValue.Dimensions;
uint[] dimensionCounts = CorArrayValue.GetDimensions();
List<ArrayDimension> dimensions = new List<ArrayDimension>();
for(int i = 0; i < rank; i++) {
@ -445,7 +445,7 @@ namespace Debugger @@ -445,7 +445,7 @@ namespace Debugger
if (fieldInfo.IsStatic) {
return ((DebugType)fieldInfo.DeclaringType).CorType.GetStaticFieldValue((uint)fieldInfo.MetadataToken, curFrame);
} else {
return objectInstance.CorObjectValue.GetFieldValue(((DebugType)fieldInfo.DeclaringType).CorType.Class, (uint)fieldInfo.MetadataToken);
return objectInstance.CorObjectValue.GetFieldValue(((DebugType)fieldInfo.DeclaringType).CorType.GetClass(), (uint)fieldInfo.MetadataToken);
}
} catch {
throw new GetValueException("Can not get value of field");

Loading…
Cancel
Save