diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj index 644d2c7b9e..9ca22a3340 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj @@ -220,14 +220,11 @@ - - - diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMemberInfo.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMemberInfo.cs deleted file mode 100644 index 5b15762a9e..0000000000 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMemberInfo.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Globalization; - -using Debugger.Wrappers.CorDebug; -using Debugger.Wrappers.MetaData; -using ICSharpCode.NRefactory.Ast; -using Mono.Cecil.Signatures; - -namespace Debugger.MetaData2 -{ - using System.Reflection; - public class DebugMemberInfo: System.Reflection.MemberInfo - { - public override Type DeclaringType { - get { - throw new NotSupportedException(); - } - } - - public override MemberTypes MemberType { - get { - throw new NotSupportedException(); - } - } - - // public virtual int MetadataToken { get; } - // internal virtual int MetadataTokenInternal { get; } - // public virtual Module Module { get; } - - public override string Name { - get { - throw new NotSupportedException(); - } - } - - public override Type ReflectedType { - get { - throw new NotSupportedException(); - } - } - - - // internal virtual bool CacheEquals(object o); - - public override object[] GetCustomAttributes(bool inherit) - { - throw new NotSupportedException(); - } - - public override object[] GetCustomAttributes(Type attributeType, bool inherit) - { - throw new NotSupportedException(); - } - - public override bool IsDefined(Type attributeType, bool inherit) - { - throw new NotSupportedException(); - } - } -} diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMethodInfo.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMethodInfo.cs deleted file mode 100644 index f6b1ab9fe5..0000000000 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMethodInfo.cs +++ /dev/null @@ -1,135 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Globalization; - -using Debugger.Wrappers.CorDebug; -using Debugger.Wrappers.MetaData; -using ICSharpCode.NRefactory.Ast; -using Mono.Cecil.Signatures; - -namespace Debugger.MetaData2 -{ - using System.Reflection; - public class DebugMethodInfo: System.Reflection.MethodInfo - { - public override Type DeclaringType { - get { - throw new NotSupportedException(); - } - } - - public override MemberTypes MemberType { - get { - throw new NotSupportedException(); - } - } - - // public virtual int MetadataToken { get; } - // internal virtual int MetadataTokenInternal { get; } - // public virtual Module Module { get; } - - public override string Name { - get { - throw new NotSupportedException(); - } - } - - public override Type ReflectedType { - get { - throw new NotSupportedException(); - } - } - - - // internal virtual bool CacheEquals(object o); - - public override object[] GetCustomAttributes(bool inherit) - { - throw new NotSupportedException(); - } - - public override object[] GetCustomAttributes(Type attributeType, bool inherit) - { - throw new NotSupportedException(); - } - - public override bool IsDefined(Type attributeType, bool inherit) - { - throw new NotSupportedException(); - } - - // public virtual Type[] GetGenericArguments(); - // public virtual MethodBody GetMethodBody(); - // internal virtual RuntimeMethodHandle GetMethodHandle(); - - public override MethodImplAttributes GetMethodImplementationFlags() - { - throw new NotSupportedException(); - } - - // internal virtual uint GetOneTimeFlags(); - // internal virtual uint GetOneTimeSpecificFlags(); - - public override ParameterInfo[] GetParameters() - { - throw new NotSupportedException(); - } - - // internal virtual ParameterInfo[] GetParametersNoCopy(); - // internal virtual Type[] GetParameterTypes(); - // internal virtual Type GetReturnType(); - - public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) - { - throw new NotSupportedException(); - } - - public override MethodAttributes Attributes { - get { - throw new NotSupportedException(); - } - } - - // public virtual CallingConventions CallingConvention { get; } - // public virtual bool ContainsGenericParameters { get; } - // public virtual bool IsGenericMethod { get; } - // public virtual bool IsGenericMethodDefinition { get; } - // internal virtual bool IsOverloaded { get; } - - public override RuntimeMethodHandle MethodHandle { - get { - throw new NotSupportedException(); - } - } - - public override MethodInfo GetBaseDefinition() - { - throw new NotSupportedException(); - } - - // public override Type[] GetGenericArguments(); - // public virtual MethodInfo GetGenericMethodDefinition(); - // internal virtual MethodInfo GetParentDefinition(); - // internal override Type GetReturnType(); - // public virtual MethodInfo MakeGenericMethod(params Type[] typeArguments); - // public override bool ContainsGenericParameters { get; } - // public override bool IsGenericMethod { get; } - // public override bool IsGenericMethodDefinition { get; } - // public override MemberTypes MemberType { get; } - // public virtual ParameterInfo ReturnParameter { get; } - // public virtual Type ReturnType { get; } - - public override ICustomAttributeProvider ReturnTypeCustomAttributes { - get { - throw new NotSupportedException(); - } - } - } -} diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugParameterInfo.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugParameterInfo.cs index e6af3967be..e1a05080ea 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugParameterInfo.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugParameterInfo.cs @@ -8,29 +8,29 @@ using System; using System.Collections.Generic; using System.Globalization; - +using System.Reflection; using Debugger.Wrappers.CorDebug; using Debugger.Wrappers.MetaData; using ICSharpCode.NRefactory.Ast; using Mono.Cecil.Signatures; -namespace Debugger.MetaData2 +namespace Debugger.MetaData { - using System.Reflection; public class DebugParameterInfo : System.Reflection.ParameterInfo { - // public virtual ParameterAttributes Attributes { get; } - // public virtual object DefaultValue { get; } - // public virtual MemberInfo Member { get; } - // public virtual string Name { get; } - // public virtual Type ParameterType { get; } - // public virtual int Position { get; } - // public virtual object RawDefaultValue { get; } - // - // public virtual object[] GetCustomAttributes(bool inherit); - // public virtual object[] GetCustomAttributes(Type attributeType, bool inherit); - // public virtual Type[] GetOptionalCustomModifiers(); - // public virtual Type[] GetRequiredCustomModifiers(); - // public virtual bool IsDefined(Type attributeType, bool inherit); + public override MemberInfo Member { get; internal set; } + public override string Name { get; internal set; } + public override Type ParameterType { get; internal set; } + public override int Position { get; internal set; } + + // public virtual ParameterAttributes Attributes { get; } + // public virtual object DefaultValue { get; } + // public virtual object RawDefaultValue { get; } + // + // public virtual object[] GetCustomAttributes(bool inherit); + // public virtual object[] GetCustomAttributes(Type attributeType, bool inherit); + // public virtual Type[] GetOptionalCustomModifiers(); + // public virtual Type[] GetRequiredCustomModifiers(); + // public virtual bool IsDefined(Type attributeType, bool inherit); } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/MemberInfo.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/MemberInfo.cs deleted file mode 100644 index 8fd179cf7b..0000000000 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/MemberInfo.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using Debugger.Wrappers.CorDebug; -using Debugger.Wrappers.MetaData; - -namespace Debugger.MetaData -{ - /// - /// Provides information about a member of some class - /// (eg. a field or a method). - /// - public abstract class MemberInfo: DebuggerObject - { - DebugType declaringType; - - /// Gets the process in which the type was loaded - [Debugger.Tests.Ignore] - public AppDomain AppDomain { - get { return declaringType.AppDomain; } - } - - [Debugger.Tests.Ignore] - public Process Process { - get { return this.AppDomain.Process; } - } - - /// Gets the name of this member - public abstract string Name { get; } - - /// Gets name of the method including the full name of the declaring type - public string FullName { - get { - return this.DeclaringType.FullName + "." + this.Name; - } - } - - /// Gets the module in which this member is defined - public Module Module { - get { - return declaringType.Module; - } - } - - /// Gets the type that declares this member element - public DebugType DeclaringType { - get { - return declaringType; - } - } - - /// Gets a value indicating whether this member has the private access modifier - public abstract bool IsPrivate { get; } - - /// Gets a value indicating whether this member has the internal access modifier - public abstract bool IsInternal { get; } - - /// Gets a value indicating whether this member has the protected access modifier - public abstract bool IsProtected { get; } - - /// Gets a value indicating whether this member has the public access modifier - public abstract bool IsPublic { get; } - - /// Gets a value indicating whether this member is static - public abstract bool IsStatic { get; } - - /// Gets the metadata token associated with this member - [Debugger.Tests.Ignore] - public abstract uint MetadataToken { get; } - - internal MemberInfo(DebugType declaringType) - { - this.declaringType = declaringType; - } - - public override string ToString() - { - return this.Name; - } - } -} diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/MethodInfo.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/MethodInfo.cs index 45b04ee16a..24e85de125 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/MethodInfo.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/MethodInfo.cs @@ -7,70 +7,131 @@ using System; using System.Collections.Generic; +using System.Globalization; +using System.Reflection; +using System.Runtime.InteropServices; + using Debugger.Wrappers.CorDebug; using Debugger.Wrappers.CorSym; using Debugger.Wrappers.MetaData; using ICSharpCode.NRefactory.Ast; using Mono.Cecil.Signatures; -using System.Runtime.InteropServices; namespace Debugger.MetaData { - /// - /// Provides information about a method in a class - /// - public class MethodInfo: MemberInfo + public class DebugMethodInfo: System.Reflection.MethodInfo { + DebugType declaringType; MethodProps methodProps; - /// Gets the name of this method + internal DebugMethodInfo(DebugType declaringType, MethodProps methodProps) + { + this.declaringType = declaringType; + this.methodProps = methodProps; + } + + public override Type DeclaringType { + get { + return declaringType; + } + } + + public override uint MetadataToken { + get { + return methodProps.Token; + } + } + // public virtual Module Module { get; } + public override string Name { get { return methodProps.Name; } } - /// Gets a value indicating whether this member has the private access modifier - public override bool IsPrivate { - get { return methodProps.IsPrivate; } + public override Type ReflectedType { + get { + throw new NotSupportedException(); + } } - /// Gets a value indicating whether this member has the internal access modifier - public override bool IsInternal { - get { return methodProps.IsInternal; } + public override object[] GetCustomAttributes(bool inherit) + { + throw new NotSupportedException(); } - /// Gets a value indicating whether this member has the protected access modifier - public override bool IsProtected { - get { return methodProps.IsProtected; } + public override object[] GetCustomAttributes(Type attributeType, bool inherit) + { + throw new NotSupportedException(); + } + + public override bool IsDefined(Type attributeType, bool inherit) + { + throw new NotSupportedException(); + } + + // public virtual Type[] GetGenericArguments(); + // public virtual MethodBody GetMethodBody(); + // internal virtual RuntimeMethodHandle GetMethodHandle(); + + public override MethodImplAttributes GetMethodImplementationFlags() + { + return methodProps.ImplFlags; } - /// Gets a value indicating whether this member has the public access modifier - public override bool IsPublic { - get { return methodProps.IsPublic; } + // internal virtual uint GetOneTimeFlags(); + // internal virtual uint GetOneTimeSpecificFlags(); + + public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) + { + throw new NotSupportedException(); } - /// Gets a value indicating whether the name of this method - /// is marked as specail. - /// For example, property accessors are marked as special - public bool IsSpecialName { + public override MethodAttributes Attributes { get { - return methodProps.HasSpecialName; + return (MethodAttributes)methodProps.Flags; } } - /// Gets a value indicating whether this method is static - public override bool IsStatic { + // public virtual CallingConventions CallingConvention { get; } + // public virtual bool ContainsGenericParameters { get; } + // public virtual bool IsGenericMethod { get; } + // public virtual bool IsGenericMethodDefinition { get; } + // internal virtual bool IsOverloaded { get; } + + public override RuntimeMethodHandle MethodHandle { get { - return methodProps.IsStatic; + throw new NotSupportedException(); } } - /// Gets the metadata token associated with this method - [Debugger.Tests.Ignore] - public override uint MetadataToken { + public override MethodInfo GetBaseDefinition() + { + throw new NotSupportedException(); + } + + // public override Type[] GetGenericArguments(); + // public virtual MethodInfo GetGenericMethodDefinition(); + // internal virtual MethodInfo GetParentDefinition(); + // internal override Type GetReturnType(); + // public virtual MethodInfo MakeGenericMethod(params Type[] typeArguments); + // public override bool ContainsGenericParameters { get; } + // public override bool IsGenericMethod { get; } + // public override bool IsGenericMethodDefinition { get; } + // public virtual ParameterInfo ReturnParameter { get; } + + public override Type GetReturnType() + { + if (this.MethodDefSig.RetType.Void) return null; + if (returnType == null) { + returnType = DebugType.CreateFromSignature(this.Module, this.MethodDefSig.RetType.Type, this.DeclaringType); + } + return returnType; + } + + public override ICustomAttributeProvider ReturnTypeCustomAttributes { get { - return methodProps.Token; + throw new NotSupportedException(); } } @@ -88,31 +149,28 @@ namespace Debugger.MetaData DebugType returnType; - /// The type of the return value as specified in the method signature - /// Null if the return type is Void - public DebugType ReturnType { - get { - if (this.MethodDefSig.RetType.Void) return null; - if (returnType == null) { - returnType = DebugType.CreateFromSignature(this.Module, this.MethodDefSig.RetType.Type, this.DeclaringType); - } - return returnType; - } - } + ParameterInfo[] parameters; - /// - /// Gets the types of the parameters of the method - /// - public DebugType[] ParameterTypes { - get { - List types = new List(); - foreach(Param param in this.methodDefSig.Parameters) { - types.Add(DebugType.CreateFromSignature(this.Module, param.Type, this.DeclaringType)); + public override ParameterInfo[] GetParameters() + { + if (parameters == null) { + parameters = new ParameterInfo[this.MethodDefSig.ParamCount]; + for(int i = 0; i < parameters.Length; i++) { + parameters[i] = + new DebugParameterInfo() { + Member = this, + Name = this.GetParameterName(i), + Position = i, + ParameterType = DebugType.CreateFromSignature(this.Module, this.MethodDefSig.Parameters[i].Type, this.DeclaringType), + }; } - return types.ToArray(); } + return parameters; } + // internal virtual Type[] GetParameterTypes(); + // internal virtual ParameterInfo[] GetParametersNoCopy(); + internal ICorDebugFunction CorFunction { get { return this.Module.CorModule.GetFunctionFromToken(this.MetadataToken); @@ -143,11 +201,6 @@ namespace Debugger.MetaData } } - internal MethodInfo(DebugType declaringType, MethodProps methodProps):base (declaringType) - { - this.methodProps = methodProps; - } - // TODO: More accurate bool IsProperty { get { @@ -412,7 +465,6 @@ namespace Debugger.MetaData } /// Get names of all parameters in order - [Tests.Ignore] public string[] ParameterNames { get { List names = new List(); @@ -423,7 +475,6 @@ namespace Debugger.MetaData } } - [Debugger.Tests.Ignore] public List LocalVariables { get { if (this.SymMethod != null) { // TODO: Is this needed?