Browse Source

Fixing some syntax errors (still work in progress)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5104 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 17 years ago
parent
commit
e144544cd4
  1. 11
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Eval.cs
  2. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/StackFrame.cs
  3. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Expressions/ExpressionEvaluator.cs
  4. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Expressions/ExpressionExtensionMethods.cs
  5. 18
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugFieldInfo.cs
  6. 52
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMethodInfo.cs
  7. 32
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugParameterInfo.cs
  8. 16
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugPropertyInfo.cs
  9. 84
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs
  10. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs

11
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Eval.cs

@ -121,6 +121,7 @@ namespace Debugger
{ {
appDomain.Process.AssertPaused(); appDomain.Process.AssertPaused();
// TODO: Select thread in the correct AppDomain
Thread targetThread = appDomain.Process.SelectedThread; Thread targetThread = appDomain.Process.SelectedThread;
if (targetThread == null) { if (targetThread == null) {
@ -195,13 +196,13 @@ namespace Debugger
/// <summary> Synchronously calls a function and returns its return value </summary> /// <summary> Synchronously calls a function and returns its return value </summary>
public static Value InvokeMethod(AppDomain appDomain, System.Type type, string name, Value thisValue, Value[] args) public static Value InvokeMethod(AppDomain appDomain, System.Type type, string name, Value thisValue, Value[] args)
{ {
return InvokeMethod(MethodInfo.GetFromName(appDomain, type, name, args.Length), thisValue, args); return InvokeMethod(DebugMethodInfo.GetFromName(appDomain, type, name, args.Length), thisValue, args);
} }
#endregion #endregion
/// <summary> Synchronously calls a function and returns its return value </summary> /// <summary> Synchronously calls a function and returns its return value </summary>
public static Value InvokeMethod(MethodInfo method, Value thisValue, Value[] args) public static Value InvokeMethod(DebugMethodInfo method, Value thisValue, Value[] args)
{ {
if (method.BackingField != null) { if (method.BackingField != null) {
method.Process.TraceMessage("Using backing field for " + method.FullName); method.Process.TraceMessage("Using backing field for " + method.FullName);
@ -210,7 +211,7 @@ namespace Debugger
return AsyncInvokeMethod(method, thisValue, args).WaitForResult(); return AsyncInvokeMethod(method, thisValue, args).WaitForResult();
} }
public static Eval AsyncInvokeMethod(MethodInfo method, Value thisValue, Value[] args) public static Eval AsyncInvokeMethod(DebugMethodInfo method, Value thisValue, Value[] args)
{ {
return new Eval( return new Eval(
method.AppDomain, method.AppDomain,
@ -222,7 +223,7 @@ namespace Debugger
} }
/// <exception cref="GetValueException"><c>GetValueException</c>.</exception> /// <exception cref="GetValueException"><c>GetValueException</c>.</exception>
static void MethodInvokeStarter(Eval eval, MethodInfo method, Value thisValue, Value[] args) static void MethodInvokeStarter(Eval eval, DebugMethodInfo method, Value thisValue, Value[] args)
{ {
List<ICorDebugValue> corArgs = new List<ICorDebugValue>(); List<ICorDebugValue> corArgs = new List<ICorDebugValue>();
args = args ?? new Value[0]; args = args ?? new Value[0];
@ -337,7 +338,7 @@ namespace Debugger
public static Eval AsyncNewObject(DebugType debugType, Value[] constructorArguments, DebugType[] constructorArgumentsTypes) public static Eval AsyncNewObject(DebugType debugType, Value[] constructorArguments, DebugType[] constructorArgumentsTypes)
{ {
ICorDebugValue[] constructorArgsCorDebug = ValuesAsCorDebug(constructorArguments); ICorDebugValue[] constructorArgsCorDebug = ValuesAsCorDebug(constructorArguments);
MethodInfo constructor = debugType.GetMethod(".ctor", constructorArgumentsTypes); DebugMethodInfo constructor = debugType.GetMethod(".ctor", constructorArgumentsTypes);
if (constructor == null) { if (constructor == null) {
throw new DebuggerException(string.Format("Type {0} has no constructor overload with given argument types.", debugType.FullName)); throw new DebuggerException(string.Format("Type {0} has no constructor overload with given argument types.", debugType.FullName));
} }

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/StackFrame.cs

@ -32,7 +32,7 @@ namespace Debugger
object corILFramePauseSession; object corILFramePauseSession;
ICorDebugFunction corFunction; ICorDebugFunction corFunction;
MethodInfo methodInfo; DebugMethodInfo methodInfo;
uint chainIndex; uint chainIndex;
uint frameIndex; uint frameIndex;
@ -48,7 +48,7 @@ namespace Debugger
} }
/// <summary> Get the method which this stack frame is executing </summary> /// <summary> Get the method which this stack frame is executing </summary>
public MethodInfo MethodInfo { public DebugMethodInfo MethodInfo {
get { return methodInfo; } get { return methodInfo; }
} }

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Expressions/ExpressionEvaluator.cs

@ -405,7 +405,7 @@ namespace Debugger
public override object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) public override object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data)
{ {
// This is needed so that captured 'this' is supported // This is needed so that captured 'this' is supported
foreach(LocalVariableInfo locVar in context.MethodInfo.LocalVariables) { foreach(DebugLocalVariableInfo locVar in context.MethodInfo.LocalVariables) {
if (locVar.IsThis) if (locVar.IsThis)
return locVar.GetValue(context); return locVar.GetValue(context);
} }

3
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Expressions/ExpressionExtensionMethods.cs

@ -4,11 +4,12 @@
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/> // <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
using ICSharpCode.NRefactory.PrettyPrinter;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Debugger.MetaData; using Debugger.MetaData;
using ICSharpCode.NRefactory.Ast; using ICSharpCode.NRefactory.Ast;
using ICSharpCode.NRefactory.PrettyPrinter;
using System.Reflection;
namespace Debugger namespace Debugger
{ {

18
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugFieldInfo.cs

@ -29,7 +29,21 @@ namespace Debugger.MetaData
public override Type DeclaringType { public override Type DeclaringType {
get { get {
throw new NotSupportedException(); return declaringType;
}
}
/// <summary> The AppDomain in which this member is loaded </summary>
public AppDomain AppDomain {
get {
return declaringType.AppDomain;
}
}
/// <summary> The Process in which this member is loaded </summary>
public Process Process {
get {
return declaringType.Process;
} }
} }
@ -85,7 +99,7 @@ namespace Debugger.MetaData
get { get {
SignatureReader sigReader = new SignatureReader(fieldProps.SigBlob.GetData()); SignatureReader sigReader = new SignatureReader(fieldProps.SigBlob.GetData());
FieldSig fieldSig = sigReader.GetFieldSig(0); FieldSig fieldSig = sigReader.GetFieldSig(0);
return DebugType.CreateFromSignature(this.Module, fieldSig.Type, this.DeclaringType); return DebugType.CreateFromSignature(this.Module, fieldSig.Type, declaringType);
} }
} }

52
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMethodInfo.cs

@ -36,13 +36,33 @@ namespace Debugger.MetaData
} }
} }
public override uint MetadataToken { /// <summary> The AppDomain in which this member is loaded </summary>
public AppDomain AppDomain {
get { get {
return methodProps.Token; return declaringType.AppDomain;
}
}
/// <summary> The Process in which this member is loaded </summary>
public Process Process {
get {
return declaringType.Process;
}
}
public override int MetadataToken {
get {
return (int)methodProps.Token;
} }
} }
// public virtual Module Module { get; } // public virtual Module Module { get; }
public string FullName {
get {
return this.DeclaringType.FullName + "." + this.Name;
}
}
public override string Name { public override string Name {
get { get {
return methodProps.Name; return methodProps.Name;
@ -76,7 +96,7 @@ namespace Debugger.MetaData
public override MethodImplAttributes GetMethodImplementationFlags() public override MethodImplAttributes GetMethodImplementationFlags()
{ {
return methodProps.ImplFlags; return (MethodImplAttributes)methodProps.ImplFlags;
} }
// internal virtual uint GetOneTimeFlags(); // internal virtual uint GetOneTimeFlags();
@ -120,11 +140,11 @@ namespace Debugger.MetaData
// public override bool IsGenericMethodDefinition { get; } // public override bool IsGenericMethodDefinition { get; }
// public virtual ParameterInfo ReturnParameter { get; } // public virtual ParameterInfo ReturnParameter { get; }
public override Type GetReturnType() public Type GetReturnType()
{ {
if (this.MethodDefSig.RetType.Void) return null; if (this.MethodDefSig.RetType.Void) return null;
if (returnType == null) { if (returnType == null) {
returnType = DebugType.CreateFromSignature(this.Module, this.MethodDefSig.RetType.Type, this.DeclaringType); returnType = DebugType.CreateFromSignature(this.Module, this.MethodDefSig.RetType.Type, declaringType);
} }
return returnType; return returnType;
} }
@ -157,12 +177,12 @@ namespace Debugger.MetaData
parameters = new ParameterInfo[this.MethodDefSig.ParamCount]; parameters = new ParameterInfo[this.MethodDefSig.ParamCount];
for(int i = 0; i < parameters.Length; i++) { for(int i = 0; i < parameters.Length; i++) {
parameters[i] = parameters[i] =
new DebugParameterInfo() { new DebugParameterInfo(
Member = this, this,
Name = this.GetParameterName(i), this.GetParameterName(i),
Position = i, DebugType.CreateFromSignature(this.Module, this.MethodDefSig.Parameters[i].Type, declaringType),
ParameterType = DebugType.CreateFromSignature(this.Module, this.MethodDefSig.Parameters[i].Type, this.DeclaringType), i
}; );
} }
} }
return parameters; return parameters;
@ -373,7 +393,7 @@ namespace Debugger.MetaData
typeof(System.Diagnostics.DebuggerHiddenAttribute)) typeof(System.Diagnostics.DebuggerHiddenAttribute))
|| ||
// Look on the type // Look on the type
HasAnyAttribute(this.Module.MetaData, this.DeclaringType.Token, HasAnyAttribute(this.Module.MetaData, (uint)this.DeclaringType.MetadataToken,
typeof(System.Diagnostics.DebuggerStepThroughAttribute), typeof(System.Diagnostics.DebuggerStepThroughAttribute),
typeof(System.Diagnostics.DebuggerNonUserCodeAttribute), typeof(System.Diagnostics.DebuggerNonUserCodeAttribute),
typeof(System.Diagnostics.DebuggerHiddenAttribute)); typeof(System.Diagnostics.DebuggerHiddenAttribute));
@ -504,14 +524,14 @@ namespace Debugger.MetaData
if (localVariables != null) return localVariables; if (localVariables != null) return localVariables;
localVariables = GetLocalVariablesInScope(this.SymMethod.RootScope); localVariables = GetLocalVariablesInScope(this.SymMethod.RootScope);
if (this.DeclaringType.IsDisplayClass || this.DeclaringType.IsYieldEnumerator) { if (declaringType.IsDisplayClass || declaringType.IsYieldEnumerator) {
// Get display class from self // Get display class from self
AddCapturedLocalVariables( AddCapturedLocalVariables(
localVariables, localVariables,
delegate(StackFrame context) { delegate(StackFrame context) {
return context.GetThisValue(); return context.GetThisValue();
}, },
this.DeclaringType declaringType
); );
// Get dispaly classes from fields // Get dispaly classes from fields
foreach(DebugFieldInfo fieldInfo in this.DeclaringType.GetFields()) { foreach(DebugFieldInfo fieldInfo in this.DeclaringType.GetFields()) {
@ -522,7 +542,7 @@ namespace Debugger.MetaData
delegate(StackFrame context) { delegate(StackFrame context) {
return context.GetThisValue().GetFieldValue(fieldInfoCopy); return context.GetThisValue().GetFieldValue(fieldInfoCopy);
}, },
fieldInfo.FieldType (DebugType)fieldInfo.FieldType
); );
} }
} }
@ -590,7 +610,7 @@ namespace Debugger.MetaData
int start; int start;
SignatureReader sigReader = new SignatureReader(symVar.Signature); SignatureReader sigReader = new SignatureReader(symVar.Signature);
LocalVarSig.LocalVariable locVarSig = sigReader.ReadLocalVariable(sigReader.Blob, 0, out start); LocalVarSig.LocalVariable locVarSig = sigReader.ReadLocalVariable(sigReader.Blob, 0, out start);
DebugType locVarType = DebugType.CreateFromSignature(this.Module, locVarSig.Type, this.DeclaringType); DebugType locVarType = DebugType.CreateFromSignature(this.Module, locVarSig.Type, declaringType);
// Compiler generated? // Compiler generated?
// NB: Display class does not have the compiler-generated flag // NB: Display class does not have the compiler-generated flag
if ((symVar.Attributes & 1) == 1 || symVar.Name.StartsWith("CS$")) { if ((symVar.Attributes & 1) == 1 || symVar.Name.StartsWith("CS$")) {

32
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugParameterInfo.cs

@ -18,10 +18,34 @@ namespace Debugger.MetaData
{ {
public class DebugParameterInfo : System.Reflection.ParameterInfo public class DebugParameterInfo : System.Reflection.ParameterInfo
{ {
public override MemberInfo Member { get; internal set; } public MemberInfo member;
public override string Name { get; internal set; } public string name;
public override Type ParameterType { get; internal set; } public Type parameterType;
public override int Position { get; internal set; } public int position;
public override MemberInfo Member {
get { return member; }
}
public override string Name {
get { return name; }
}
public override Type ParameterType {
get { return parameterType; }
}
public override int Position {
get { return position; }
}
public DebugParameterInfo(MemberInfo member, string name, Type parameterType, int position)
{
this.member = member;
this.name = name;
this.parameterType = parameterType;
this.position = position;
}
// public virtual ParameterAttributes Attributes { get; } // public virtual ParameterAttributes Attributes { get; }
// public virtual object DefaultValue { get; } // public virtual object DefaultValue { get; }

16
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugPropertyInfo.cs

@ -36,7 +36,21 @@ namespace Debugger.MetaData
} }
} }
public override uint MetadataToken { /// <summary> The AppDomain in which this member is loaded </summary>
public AppDomain AppDomain {
get {
return declaringType.AppDomain;
}
}
/// <summary> The Process in which this member is loaded </summary>
public Process Process {
get {
return declaringType.Process;
}
}
public override int MetadataToken {
get { get {
return (getMethod ?? setMethod).MetadataToken; return (getMethod ?? setMethod).MetadataToken;
} }

84
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs

@ -29,6 +29,9 @@ namespace Debugger.MetaData
/// </remarks> /// </remarks>
public class DebugType: System.Type public class DebugType: System.Type
{ {
const BindingFlags BindingFlagsAll = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance;
const BindingFlags BindingFlagsAllDeclared = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance;
AppDomain appDomain; AppDomain appDomain;
Process process; Process process;
ICorDebugType corType; ICorDebugType corType;
@ -59,7 +62,7 @@ namespace Debugger.MetaData
public override int MetadataToken { public override int MetadataToken {
get { get {
AssertClassOrValueType(); AssertClassOrValueType();
return classProps.Token; return (int)classProps.Token;
} }
} }
@ -155,7 +158,7 @@ namespace Debugger.MetaData
// internal virtual bool IsSzArray { get; } // internal virtual bool IsSzArray { get; }
// public override MemberTypes MemberType { get; } // public override MemberTypes MemberType { get; }
public override Module Module { public override System.Reflection.Module Module {
get { get {
AssertClassOrValueType(); AssertClassOrValueType();
return module; return module;
@ -215,7 +218,7 @@ namespace Debugger.MetaData
public T GetMember<T>(string name, BindingFlags bindingFlags, Predicate<T> filter) where T:MemberInfo public T GetMember<T>(string name, BindingFlags bindingFlags, Predicate<T> filter) where T:MemberInfo
{ {
T[] res = GetMembersImpl<T>(name, bindingFlags, filter); T[] res = GetMembers<T>(name, bindingFlags, filter);
if (res.Length > 0) { if (res.Length > 0) {
return res[0]; return res[0];
} else { } else {
@ -293,7 +296,7 @@ namespace Debugger.MetaData
// Do not include static types // Do not include static types
bindingFlags = bindingFlags & ~BindingFlags.Static; bindingFlags = bindingFlags & ~BindingFlags.Static;
} }
List<T> superResults = this.BaseType.QueryMembers<T>(bindingFlags, name, token); List<T> superResults = this.BaseType.GetMembers<T>(name, bindingFlags, filter);
results.AddRange(superResults); results.AddRange(superResults);
} }
@ -328,7 +331,16 @@ namespace Debugger.MetaData
public override Type GetInterface(string name, bool ignoreCase) public override Type GetInterface(string name, bool ignoreCase)
{ {
throw new NotSupportedException(); foreach(DebugType inter in this.Interfaces) {
if (string.Equals(inter.FullName, fullName, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal)) {
return inter;
}
}
if (BaseType != null) {
return BaseType.GetInterface(fullName);
} else {
return null;
}
} }
// public virtual InterfaceMapping GetInterfaceMap(Type interfaceType); // public virtual InterfaceMapping GetInterfaceMap(Type interfaceType);
@ -375,7 +387,7 @@ namespace Debugger.MetaData
protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] paramTypes, ParameterModifier[] modifiers) protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] paramTypes, ParameterModifier[] modifiers)
{ {
// TODO: Finish // TODO: Finish
foreach(MethodInfo candidate in GetMembers<MethodInfo>(name, bindingAttr, null))) { foreach(DebugMethodInfo candidate in GetMembers<DebugMethodInfo>(name, bindingAttr, null)) {
if (paramTypes == null) if (paramTypes == null)
return candidate; return candidate;
if (candidate.ParameterCount == paramTypes.Length) { if (candidate.ParameterCount == paramTypes.Length) {
@ -482,7 +494,7 @@ namespace Debugger.MetaData
return base.IsSubclassOf(superType); return base.IsSubclassOf(superType);
} }
protected virtual bool IsValueTypeImpl() protected override bool IsValueTypeImpl()
{ {
return this.Kind == DebugTypeKind.ValueType; return this.Kind == DebugTypeKind.ValueType;
} }
@ -514,22 +526,6 @@ namespace Debugger.MetaData
get { return interfaces; } get { return interfaces; }
} }
/// <summary> Return an interface with the given name </summary>
/// <returns> Null if not found </returns>
public DebugType GetInterface(string fullName)
{
foreach(DebugType inter in this.Interfaces) {
if (inter.FullName == fullName) {
return inter;
}
}
if (BaseType != null) {
return BaseType.GetInterface(fullName);
} else {
return null;
}
}
/// <summary> Get an element type for array or pointer. </summary> /// <summary> Get an element type for array or pointer. </summary>
public DebugType ElementType { public DebugType ElementType {
get { get {
@ -749,7 +745,7 @@ namespace Debugger.MetaData
if (module.AppDomain == appDomain) { if (module.AppDomain == appDomain) {
uint token; uint token;
try { try {
token = module.MetaData.FindTypeDefPropsByName(typeName, enclosingType == null ? 0 : enclosingType.Token).Token; token = module.MetaData.FindTypeDefPropsByName(typeName, enclosingType == null ? 0 : enclosingType.MetadataToken).Token;
} catch { } catch {
continue; continue;
} }
@ -788,10 +784,10 @@ namespace Debugger.MetaData
} }
DebugType type = CreateFromName(appDomain, typeRef.Type, genArgs.ToArray()); DebugType type = CreateFromName(appDomain, typeRef.Type, genArgs.ToArray());
for(int i = 0; i < typeRef.PointerNestingLevel; i++) { for(int i = 0; i < typeRef.PointerNestingLevel; i++) {
type = MakePointerType(type); type = (DebugType)type.MakePointerType();
} }
for(int i = typeRef.RankSpecifier.Length - 1; i >= 0; i--) { for(int i = typeRef.RankSpecifier.Length - 1; i >= 0; i--) {
type = MakeArrayType(type, typeRef.RankSpecifier[i] + 1); type = (DebugType)type.MakeArrayType(typeRef.RankSpecifier[i] + 1);
} }
return type; return type;
} }
@ -848,13 +844,13 @@ namespace Debugger.MetaData
if (sigType is ARRAY) { if (sigType is ARRAY) {
ARRAY arraySig = (ARRAY)sigType; ARRAY arraySig = (ARRAY)sigType;
DebugType elementType = CreateFromSignature(module, arraySig.Type, declaringType); DebugType elementType = CreateFromSignature(module, arraySig.Type, declaringType);
return MakeArrayType(elementType, arraySig.Shape.Rank); return (DebugType)elementType.MakeArrayType(arraySig.Shape.Rank);
} }
if (sigType is SZARRAY) { if (sigType is SZARRAY) {
SZARRAY arraySig = (SZARRAY)sigType; SZARRAY arraySig = (SZARRAY)sigType;
DebugType elementType = CreateFromSignature(module, arraySig.Type, declaringType); DebugType elementType = CreateFromSignature(module, arraySig.Type, declaringType);
return MakeArrayType(elementType); return (DebugType)elementType.MakeArrayType();
} }
if (sigType is PTR) { if (sigType is PTR) {
@ -865,7 +861,7 @@ namespace Debugger.MetaData
} else { } else {
elementType = CreateFromSignature(module, ptrSig.PtrType, declaringType); elementType = CreateFromSignature(module, ptrSig.PtrType, declaringType);
} }
return MakePointerType(elementType); return (DebugType)elementType.MakePointerType();
} }
if (sigType is FNPTR) { if (sigType is FNPTR) {
@ -879,26 +875,26 @@ namespace Debugger.MetaData
public override Type MakeArrayType(int rank) public override Type MakeArrayType(int rank)
{ {
ICorDebugType res = elementType.AppDomain.CorAppDomain.CastTo<ICorDebugAppDomain2>().GetArrayOrPointerType((uint)CorElementType.ARRAY, (uint)rank, elementType.CorType); ICorDebugType res = this.AppDomain.CorAppDomain.CastTo<ICorDebugAppDomain2>().GetArrayOrPointerType((uint)CorElementType.ARRAY, (uint)rank, this.CorType);
return CreateFromCorType(elementType.AppDomain, res); return CreateFromCorType(this.AppDomain, res);
} }
public override Type MakeArrayType() public override Type MakeArrayType()
{ {
ICorDebugType res = elementType.AppDomain.CorAppDomain.CastTo<ICorDebugAppDomain2>().GetArrayOrPointerType((uint)CorElementType.SZARRAY, 1, elementType.CorType); ICorDebugType res = this.AppDomain.CorAppDomain.CastTo<ICorDebugAppDomain2>().GetArrayOrPointerType((uint)CorElementType.SZARRAY, 1, this.CorType);
return CreateFromCorType(elementType.AppDomain, res); return CreateFromCorType(this.AppDomain, res);
} }
public override Type MakePointerType() public override Type MakePointerType()
{ {
ICorDebugType res = elementType.AppDomain.CorAppDomain.CastTo<ICorDebugAppDomain2>().GetArrayOrPointerType((uint)CorElementType.PTR, 0, elementType.CorType); ICorDebugType res = this.AppDomain.CorAppDomain.CastTo<ICorDebugAppDomain2>().GetArrayOrPointerType((uint)CorElementType.PTR, 0, this.CorType);
return CreateFromCorType(elementType.AppDomain, res); return CreateFromCorType(this.AppDomain, res);
} }
public override Type MakeByRefType() public override Type MakeByRefType()
{ {
ICorDebugType res = elementType.AppDomain.CorAppDomain.CastTo<ICorDebugAppDomain2>().GetArrayOrPointerType((uint)CorElementType.BYREF, 0, elementType.CorType); ICorDebugType res = this.AppDomain.CorAppDomain.CastTo<ICorDebugAppDomain2>().GetArrayOrPointerType((uint)CorElementType.BYREF, 0, this.CorType);
return CreateFromCorType(elementType.AppDomain, res); return CreateFromCorType(this.AppDomain, res);
} }
public static DebugType CreateFromCorClass(AppDomain appDomain, bool? valueType, ICorDebugClass corClass, DebugType[] genericArguments) public static DebugType CreateFromCorClass(AppDomain appDomain, bool? valueType, ICorDebugClass corClass, DebugType[] genericArguments)
@ -1041,7 +1037,7 @@ namespace Debugger.MetaData
void LoadMemberInfo() void LoadMemberInfo()
{ {
// Load interfaces // Load interfaces
foreach(InterfaceImplProps implProps in module.MetaData.EnumInterfaceImplProps(this.Token)) { foreach(InterfaceImplProps implProps in module.MetaData.EnumInterfaceImplProps((uint)this.MetadataToken)) {
CorTokenType tkType = (CorTokenType)(implProps.Interface & 0xFF000000); CorTokenType tkType = (CorTokenType)(implProps.Interface & 0xFF000000);
if (tkType == CorTokenType.TypeDef || tkType == CorTokenType.TypeRef) { if (tkType == CorTokenType.TypeDef || tkType == CorTokenType.TypeRef) {
this.interfaces.Add(DebugType.CreateFromTypeDefOrRef(module, false, implProps.Interface, null)); this.interfaces.Add(DebugType.CreateFromTypeDefOrRef(module, false, implProps.Interface, null));
@ -1053,14 +1049,14 @@ namespace Debugger.MetaData
} }
// Load fields // Load fields
foreach(FieldProps field in module.MetaData.EnumFieldProps(this.Token)) { foreach(FieldProps field in module.MetaData.EnumFieldProps((uint)this.MetadataToken)) {
if (field.IsStatic && field.IsLiteral) continue; // Skip static literals TODO: Why? if (field.IsStatic && field.IsLiteral) continue; // Skip static literals TODO: Why?
AddMember(new DebugFieldInfo(this, field)); AddMember(new DebugFieldInfo(this, field));
}; };
// Load methods // Load methods
foreach(MethodProps m in module.MetaData.EnumMethodProps(this.Token)) { foreach(MethodProps m in module.MetaData.EnumMethodProps((uint)this.MetadataToken)) {
AddMember(new MethodInfo(this, m)); AddMember(new DebugMethodInfo(this, m));
} }
// Load properties // Load properties
@ -1069,7 +1065,7 @@ namespace Debugger.MetaData
// Collect data // Collect data
Dictionary<string, MethodInfo> accessors = new Dictionary<string, MethodInfo>(); Dictionary<string, MethodInfo> accessors = new Dictionary<string, MethodInfo>();
Dictionary<string, object> propertyNames = new Dictionary<string, object>(); Dictionary<string, object> propertyNames = new Dictionary<string, object>();
foreach(MethodInfo method in this.GetMethods(BindingFlags.AllInThisType)) { foreach(MethodInfo method in this.GetMethods(BindingFlagsAllDeclared)) {
if (method.IsSpecialName && (method.Name.StartsWith("get_") || method.Name.StartsWith("set_"))) { if (method.IsSpecialName && (method.Name.StartsWith("get_") || method.Name.StartsWith("set_"))) {
// There can be many get_Items // There can be many get_Items
// TODO: This returns only last, return all // TODO: This returns only last, return all
@ -1083,7 +1079,7 @@ namespace Debugger.MetaData
MethodInfo setter = null; MethodInfo setter = null;
accessors.TryGetValue("get_" + kvp.Key, out getter); accessors.TryGetValue("get_" + kvp.Key, out getter);
accessors.TryGetValue("set_" + kvp.Key, out setter); accessors.TryGetValue("set_" + kvp.Key, out setter);
AddMember(new PropertyInfo(this, getter, setter)); AddMember(new DebugPropertyInfo(this, getter, setter));
} }
} }
@ -1097,7 +1093,7 @@ namespace Debugger.MetaData
public bool IsCompilerGenerated { public bool IsCompilerGenerated {
get { get {
if (this.IsClass || this.IsValueType) { if (this.IsClass || this.IsValueType) {
return MethodInfo.HasAnyAttribute(this.Module.MetaData, this.Token, typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute)); return MethodInfo.HasAnyAttribute(this.Module.MetaData, this.MetadataToken, typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute));
} else { } else {
return false; return false;
} }

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs

@ -251,7 +251,7 @@ namespace Debugger
return this.GetPropertyValue((PropertyInfo)memberInfo); return this.GetPropertyValue((PropertyInfo)memberInfo);
} }
} }
currentType = currentType.BaseType; currentType = (DebugType)currentType.BaseType;
} }
return null; return null;
} }

Loading…
Cancel
Save