Exemplo n.º 1
0
        internal MonoFunctionType(IMonoStructType klass, Cecil.MethodDefinition mdef)
            : base(klass.File.MonoLanguage)
        {
            this.klass       = klass;
            this.method_info = mdef;
            this.token       = MonoDebuggerSupport.GetMethodToken(mdef);
            this.name        = GetMethodName(mdef) + MonoSymbolFile.GetMethodSignature(mdef);

            Cecil.TypeReference rtype;
            if (mdef.IsConstructor)
            {
                rtype           = mdef.DeclaringType;
                has_return_type = true;
            }
            else
            {
                rtype           = mdef.ReturnType;
                has_return_type = rtype.FullName != "System.Void";
            }
            return_type = klass.File.MonoLanguage.LookupMonoType(rtype);

            parameter_types = new TargetType [mdef.Parameters.Count];
            for (int i = 0; i < mdef.Parameters.Count; i++)
            {
                parameter_types [i] = klass.File.MonoLanguage.LookupMonoType(
                    mdef.Parameters[i].ParameterType);
            }
        }
Exemplo n.º 2
0
 private MonoMethodInfo(IMonoStructType klass, int index, Cecil.MethodDefinition minfo,
                        MonoFunctionType type)
     : base(type, MonoFunctionType.GetMethodName(minfo), index,
            minfo.IsStatic, GetAccessibility(minfo), type.FullName)
 {
     FunctionType = type;
 }
Exemplo n.º 3
0
        internal static MonoPropertyInfo Create(IMonoStructType klass, int index,
                                                Cecil.PropertyDefinition pinfo)
        {
            TargetType type = klass.File.MonoLanguage.LookupMonoType(pinfo.PropertyType);

            bool                      is_static = false;
            MonoFunctionType          getter, setter;
            TargetMemberAccessibility accessibility = TargetMemberAccessibility.Private;

            if (pinfo.SetMethod != null)
            {
                setter        = klass.LookupFunction(pinfo.SetMethod);
                is_static     = pinfo.SetMethod.IsStatic;
                accessibility = MonoMethodInfo.GetAccessibility(pinfo.SetMethod);
            }
            else
            {
                setter = null;
            }

            if (pinfo.GetMethod != null)
            {
                getter        = klass.LookupFunction(pinfo.GetMethod);
                is_static     = pinfo.GetMethod.IsStatic;
                accessibility = MonoMethodInfo.GetAccessibility(pinfo.GetMethod);
            }
            else
            {
                getter = null;
            }

            return(new MonoPropertyInfo(
                       type, klass, index, is_static, pinfo, accessibility, getter, setter));
        }
Exemplo n.º 4
0
        internal static MonoEventInfo Create(IMonoStructType klass, int index,
						      Cecil.EventDefinition einfo)
        {
            TargetType type = klass.File.MonoLanguage.LookupMonoType (einfo.EventType);

            bool is_static = false;
            MonoFunctionType add, remove, raise;

            TargetMemberAccessibility accessibility = TargetMemberAccessibility.Private;
            if (einfo.AddMethod != null) {
                add = klass.LookupFunction (einfo.AddMethod);
                is_static = einfo.AddMethod.IsStatic;
                accessibility = MonoMethodInfo.GetAccessibility (einfo.AddMethod);
            } else
                add = null;

            if (einfo.RemoveMethod != null) {
                remove = klass.LookupFunction (einfo.RemoveMethod);
                is_static = einfo.RemoveMethod.IsStatic;
                accessibility = MonoMethodInfo.GetAccessibility (einfo.RemoveMethod);
            } else
                remove = null;

            if (einfo.InvokeMethod != null) {
                raise = klass.LookupFunction (einfo.InvokeMethod);
                is_static = einfo.InvokeMethod.IsStatic;
                accessibility = MonoMethodInfo.GetAccessibility (einfo.InvokeMethod);
            } else
                raise = null;

            return new MonoEventInfo (
                klass, index, einfo, type, is_static, accessibility, add, remove, raise);
        }
Exemplo n.º 5
0
        internal static MonoMethodInfo Create(IMonoStructType klass, int index,
                                              Cecil.MethodDefinition minfo)
        {
            MonoFunctionType type = klass.LookupFunction(minfo);

            return(new MonoMethodInfo(klass, index, minfo, type));
        }
Exemplo n.º 6
0
 private MonoEventInfo(IMonoStructType klass, int index, Cecil.EventDefinition einfo,
                       TargetType type, bool is_static,
                       TargetMemberAccessibility accessibility, MonoFunctionType add,
                       MonoFunctionType remove, MonoFunctionType raise)
     : base(type, einfo.Name, index, is_static, accessibility, add, remove, raise)
 {
     this.Klass      = klass;
     this.AddType    = add;
     this.RemoveType = remove;
     this.RaiseType  = raise;
 }
Exemplo n.º 7
0
        private MonoEventInfo(IMonoStructType klass, int index, Cecil.EventDefinition einfo,
				       TargetType type, bool is_static,
				       TargetMemberAccessibility accessibility, MonoFunctionType add,
				       MonoFunctionType remove, MonoFunctionType raise)
            : base(type, einfo.Name, index, is_static, accessibility, add, remove, raise)
        {
            this.Klass = klass;
            this.AddType = add;
            this.RemoveType = remove;
            this.RaiseType = raise;
        }
Exemplo n.º 8
0
        public MonoFieldInfo(IMonoStructType type, TargetType field_type, int pos,
                             Cecil.FieldDefinition finfo)
            : base(field_type, finfo.Name, pos, finfo.IsStatic,
                   GetAccessibility(finfo), pos, 0, finfo.HasConstant)
        {
            FieldInfo = finfo;

            DebuggerTypeProxyAttribute type_proxy;

            MonoSymbolFile.CheckCustomAttributes(finfo,
                                                 out browsable_state,
                                                 out debugger_display,
                                                 out type_proxy,
                                                 out is_compiler_generated);
        }
Exemplo n.º 9
0
        public MonoClassInfo ResolveClass(TargetMemoryAccess target, bool fail)
        {
            if (resolved)
            {
                return(class_info);
            }

            if (class_info == null)
            {
                if (class_ptr.IsNull)
                {
                    return(null);
                }

                TargetAddress klass = target.ReadAddress(class_ptr);
                if (klass.IsNull)
                {
                    return(null);
                }

                class_info = File.MonoLanguage.ReadClassInfo(target, klass);
            }

            if (class_info == null)
            {
                if (!fail)
                {
                    return(null);
                }

                throw new TargetException(TargetError.ClassNotInitialized,
                                          "Class `{0}' not initialized yet.", Name);
            }

            if (class_info.HasParent)
            {
                MonoClassInfo parent_info = class_info.GetParent(target);
                parent_type           = (IMonoStructType)parent_info.Type;
                parent_type.ClassInfo = parent_info;
                if (parent_type.ResolveClass(target, fail) == null)
                {
                    return(null);
                }
            }

            resolved = true;
            return(class_info);
        }
Exemplo n.º 10
0
        internal static MonoEventInfo Create(IMonoStructType klass, int index,
                                             Cecil.EventDefinition einfo)
        {
            TargetType type = klass.File.MonoLanguage.LookupMonoType(einfo.EventType);

            bool             is_static = false;
            MonoFunctionType add, remove, raise;

            TargetMemberAccessibility accessibility = TargetMemberAccessibility.Private;

            if (einfo.AddMethod != null)
            {
                add           = klass.LookupFunction(einfo.AddMethod);
                is_static     = einfo.AddMethod.IsStatic;
                accessibility = MonoMethodInfo.GetAccessibility(einfo.AddMethod);
            }
            else
            {
                add = null;
            }

            if (einfo.RemoveMethod != null)
            {
                remove        = klass.LookupFunction(einfo.RemoveMethod);
                is_static     = einfo.RemoveMethod.IsStatic;
                accessibility = MonoMethodInfo.GetAccessibility(einfo.RemoveMethod);
            }
            else
            {
                remove = null;
            }

            if (einfo.InvokeMethod != null)
            {
                raise         = klass.LookupFunction(einfo.InvokeMethod);
                is_static     = einfo.InvokeMethod.IsStatic;
                accessibility = MonoMethodInfo.GetAccessibility(einfo.InvokeMethod);
            }
            else
            {
                raise = null;
            }

            return(new MonoEventInfo(
                       klass, index, einfo, type, is_static, accessibility, add, remove, raise));
        }
Exemplo n.º 11
0
        private MonoPropertyInfo(TargetType type, IMonoStructType klass, int index,
                                 bool is_static, Cecil.PropertyDefinition pinfo,
                                 TargetMemberAccessibility accessibility,
                                 MonoFunctionType getter, MonoFunctionType setter)
            : base(type, pinfo.Name, index, is_static, accessibility, getter, setter)
        {
            this.Klass      = klass;
            this.GetterType = getter;
            this.SetterType = setter;

            bool is_compiler_generated;
            DebuggerTypeProxyAttribute type_proxy;

            MonoSymbolFile.CheckCustomAttributes(pinfo,
                                                 out browsable_state,
                                                 out debugger_display,
                                                 out type_proxy,
                                                 out is_compiler_generated);
        }
Exemplo n.º 12
0
        public MonoClassInfo ResolveClass(TargetMemoryAccess target, bool fail)
        {
            if (resolved)
            {
                return(class_info);
            }

            if (class_info == null)
            {
                int token = type.MetadataToken.ToInt32();
                class_info = file.LookupClassInfo(target, token);
            }

            if (class_info == null)
            {
                if (!fail)
                {
                    return(null);
                }

                throw new TargetException(TargetError.ClassNotInitialized,
                                          "Class `{0}' not initialized yet.", Name);
            }

            if (class_info.HasParent)
            {
                MonoClassInfo parent_info = class_info.GetParent(target);
                parent_type           = (IMonoStructType)parent_info.Type;
                parent_type.ClassInfo = parent_info;
                if (parent_type.ResolveClass(target, fail) == null)
                {
                    return(null);
                }
            }

            resolved = true;
            return(class_info);
        }
Exemplo n.º 13
0
        internal MonoFunctionType(IMonoStructType klass, Cecil.MethodDefinition mdef)
            : base(klass.File.MonoLanguage)
        {
            this.klass = klass;
            this.method_info = mdef;
            this.token = MonoDebuggerSupport.GetMethodToken (mdef);
            this.name = GetMethodName (mdef) + MonoSymbolFile.GetMethodSignature (mdef);

            Cecil.TypeReference rtype;
            if (mdef.IsConstructor) {
                rtype = mdef.DeclaringType;
                has_return_type = true;
            } else {
                rtype = mdef.ReturnType.ReturnType;
                has_return_type = rtype.FullName != "System.Void";
            }
            return_type = klass.File.MonoLanguage.LookupMonoType (rtype);

            parameter_types = new TargetType [mdef.Parameters.Count];
            for (int i = 0; i < mdef.Parameters.Count; i++)
                parameter_types [i] = klass.File.MonoLanguage.LookupMonoType (
                    mdef.Parameters[i].ParameterType);
        }
Exemplo n.º 14
0
        internal override int GetElementSize(TargetMemoryAccess target)
        {
            TargetType element_type;

            if (ElementType is MonoEnumType)
            {
                element_type = ((MonoEnumType)ElementType).ClassType;
            }
            else
            {
                element_type = ElementType;
            }

            IMonoStructType stype = element_type as IMonoStructType;

            if ((stype == null) || stype.Type.IsByRef)
            {
                return(base.GetElementSize(target));
            }

            MonoClassInfo cinfo = stype.ResolveClass(target, true);

            return(cinfo.GetInstanceSize(target));
        }
Exemplo n.º 15
0
        public MonoClassInfo ResolveClass(TargetMemoryAccess target, bool fail)
        {
            if (resolved)
                return class_info;

            if (class_info == null) {
                if (class_ptr.IsNull)
                    return null;

                TargetAddress klass = target.ReadAddress (class_ptr);
                if (klass.IsNull)
                    return null;

                class_info = File.MonoLanguage.ReadClassInfo (target, klass);
            }

            if (class_info == null) {
                if (!fail)
                    return null;

                throw new TargetException (TargetError.ClassNotInitialized,
                               "Class `{0}' not initialized yet.", Name);
            }

            if (class_info.HasParent) {
                MonoClassInfo parent_info = class_info.GetParent (target);
                parent_type = (IMonoStructType) parent_info.Type;
                parent_type.ClassInfo = parent_info;
                if (parent_type.ResolveClass (target, fail) == null)
                    return null;
            }

            resolved = true;
            return class_info;
        }
Exemplo n.º 16
0
        internal static MonoPropertyInfo Create(IMonoStructType klass, int index,
							 Cecil.PropertyDefinition pinfo)
        {
            TargetType type = klass.File.MonoLanguage.LookupMonoType (pinfo.PropertyType);

            bool is_static = false;
            MonoFunctionType getter, setter;
            TargetMemberAccessibility accessibility = TargetMemberAccessibility.Private;
            if (pinfo.SetMethod != null) {
                setter = klass.LookupFunction (pinfo.SetMethod);
                is_static = pinfo.SetMethod.IsStatic;
                accessibility = MonoMethodInfo.GetAccessibility (pinfo.SetMethod);
            } else
                setter = null;

            if (pinfo.GetMethod != null) {
                getter = klass.LookupFunction (pinfo.GetMethod);
                is_static = pinfo.GetMethod.IsStatic;
                accessibility = MonoMethodInfo.GetAccessibility (pinfo.GetMethod);
            } else
                getter = null;

            return new MonoPropertyInfo (
                type, klass, index, is_static, pinfo, accessibility, getter, setter);
        }
Exemplo n.º 17
0
        private MonoPropertyInfo(TargetType type, IMonoStructType klass, int index,
					  bool is_static, Cecil.PropertyDefinition pinfo,
					  TargetMemberAccessibility accessibility,
					  MonoFunctionType getter, MonoFunctionType setter)
            : base(type, pinfo.Name, index, is_static, accessibility, getter, setter)
        {
            this.Klass = klass;
            this.GetterType = getter;
            this.SetterType = setter;

            bool is_compiler_generated;
            DebuggerTypeProxyAttribute type_proxy;
            MonoSymbolFile.CheckCustomAttributes (pinfo,
                                  out browsable_state,
                                  out debugger_display,
                                  out type_proxy,
                                  out is_compiler_generated);
        }
Exemplo n.º 18
0
        public MonoClassInfo ResolveClass(TargetMemoryAccess target, bool fail)
        {
            if (resolved)
                return class_info;

            if (class_info == null) {
                int token = type.MetadataToken.ToInt32 ();
                class_info = file.LookupClassInfo (target, token);
            }

            if (class_info == null) {
                if (!fail)
                    return null;

                throw new TargetException (TargetError.ClassNotInitialized,
                               "Class `{0}' not initialized yet.", Name);
            }

            if (class_info.HasParent) {
                MonoClassInfo parent_info = class_info.GetParent (target);
                parent_type = (IMonoStructType) parent_info.Type;
                parent_type.ClassInfo = parent_info;
                if (parent_type.ResolveClass (target, fail) == null)
                    return null;
            }

            resolved = true;
            return class_info;
        }
Exemplo n.º 19
0
        public MonoFieldInfo(IMonoStructType type, TargetType field_type, int pos,
				      Cecil.FieldDefinition finfo)
            : base(field_type, finfo.Name, pos, finfo.IsStatic,
				GetAccessibility (finfo), pos, 0, finfo.HasConstant)
        {
            FieldInfo = finfo;

            DebuggerTypeProxyAttribute type_proxy;
            MonoSymbolFile.CheckCustomAttributes (finfo,
                                  out browsable_state,
                                  out debugger_display,
                                  out type_proxy,
                                  out is_compiler_generated);
        }
Exemplo n.º 20
0
        private MonoMethodInfo(IMonoStructType klass, int index, Cecil.MethodDefinition minfo,
					MonoFunctionType type)
            : base(type, MonoFunctionType.GetMethodName (minfo), index,
				minfo.IsStatic, GetAccessibility (minfo), type.FullName)
        {
            FunctionType = type;
        }
Exemplo n.º 21
0
        internal static MonoMethodInfo Create(IMonoStructType klass, int index,
						       Cecil.MethodDefinition minfo)
        {
            MonoFunctionType type = klass.LookupFunction (minfo);
            return new MonoMethodInfo (klass, index, minfo, type);
        }