public object GetValue (FieldInfoMirror field)
		{
			lock (locker) {
				if (results == null || fields.Count != results.Length)
					results = ((ObjectMirror)obj).GetValues (fields);
				return results [fields.IndexOf (field)];
			}
		}
 /*
  * Return the value of the [ThreadStatic] field FIELD on the thread THREAD.
  */
 public Value GetValue(FieldInfoMirror field, ThreadMirror thread)
 {
     if (thread == null)
     {
         throw new ArgumentNullException("thread");
     }
     CheckMirror(thread);
     return(GetValues(new FieldInfoMirror [] { field }, thread) [0]);
 }
        public InstanceValue(StructMirror instance, FieldInfoMirror[] fields)
        {
            Contract.Requires(instance != null);
            Contract.Requires(fields != null);

            Instance = instance;
            Type = instance.Type;

            Length += instance.Type.GetAllProperties().Count(p => p.ShouldDisplay());
            Length += instance.Type.GetAllFields().Count(f => f.ShouldDisplay());
        }
 public static void Set(ThreadMirror thread, VariableItem item, InstanceValue parent, FieldInfoMirror key, Value newValue)
 {
     if (key.IsStatic)
     {
         key.DeclaringType.SetValue(key, newValue);
     }
     else
     {
         var o = (ObjectMirror) parent.Instance;
         o.SetValue(key, newValue);
     }
 }
		internal FieldInfoMirror GetField (long id) {
			lock (fields_lock) {
				if (fields == null)
					fields = new Dictionary <long, FieldInfoMirror> ();
				FieldInfoMirror obj;
				if (id == 0)
					return null;
				if (!fields.TryGetValue (id, out obj)) {
					obj = new FieldInfoMirror (this, id);
					fields [id] = obj;
				}
				return obj;
			}
	    }
		public FieldValueReference (EvaluationContext ctx, FieldInfoMirror field, object obj, TypeMirror declaringType, string vname, ObjectValueFlags vflags): base (ctx)
		{
			this.field = field;
			this.obj = obj;
			this.declaringType = declaringType;
			this.vname = vname;
			flags = vflags;

			if (field.IsStatic)
				this.obj = null;

			flags |= GetFlags (field);

			if (obj is PrimitiveValue)
				flags |= ObjectValueFlags.ReadOnly;
		}
		internal static ObjectValueFlags GetFlags (FieldInfoMirror field)
		{
			var flags = ObjectValueFlags.Field;

			if (field.IsStatic)
				flags |= ObjectValueFlags.Global;

			if (field.IsPublic)
				flags |= ObjectValueFlags.Public;
			else if (field.IsPrivate)
				flags |= ObjectValueFlags.Private;
			else if (field.IsFamily)
				flags |= ObjectValueFlags.Protected;
			else if (field.IsFamilyAndAssembly)
				flags |= ObjectValueFlags.Internal;
			else if (field.IsFamilyOrAssembly)
				flags |= ObjectValueFlags.InternalProtected;

			return flags;
		}
		public FieldValueReference (EvaluationContext ctx, FieldInfoMirror field, object obj, TypeMirror declaringType, string vname, ObjectValueFlags vflags, FieldReferenceBatch batch = null): base (ctx)
		{
			this.field = field;
			this.obj = obj;
			this.declaringType = declaringType;
			this.vname = vname;
			this.batch = batch;
			flags = vflags;

			if (field.IsStatic)
				this.obj = null;

			var objectMirror = obj as ObjectMirror;
			if (objectMirror != null)
				EnsureContextHasDomain (objectMirror.Domain);

			flags |= GetFlags (field);

			if (obj is PrimitiveValue)
				flags |= ObjectValueFlags.ReadOnly;
		}
        public FieldInfoMirror[] GetFields()
        {
            if (fields != null)
            {
                return(fields);
            }

            string[] names;
            long[]   types;
            int[]    attrs;
            long[]   ids = vm.conn.Type_GetFields(id, out names, out types, out attrs);

            FieldInfoMirror[] res = new FieldInfoMirror [ids.Length];
            for (int i = 0; i < res.Length; ++i)
            {
                res [i] = new FieldInfoMirror(this, ids [i], names [i], vm.GetType(types [i]), (FieldAttributes)attrs [i]);
            }

            fields = res;
            return(fields);
        }
		public FieldValueReference (EvaluationContext ctx, FieldInfoMirror field, object obj, TypeMirror declaringType, string vname, ObjectValueFlags vflags): base (ctx)
		{
			this.field = field;
			this.obj = obj;
			this.declaringType = declaringType;
			this.vname = vname;
			flags = vflags;
			if (field.IsStatic) {
				flags |= ObjectValueFlags.Global;
				this.obj = null;
			}
			if (field.IsPublic)
				flags |= ObjectValueFlags.Public;
			else if (field.IsPrivate)
				flags |= ObjectValueFlags.Private;
			else if (field.IsFamily)
				flags |= ObjectValueFlags.Protected;
			else if (field.IsFamilyAndAssembly)
				flags |= ObjectValueFlags.Internal;
			else if (field.IsFamilyOrAssembly)
				flags |= ObjectValueFlags.InternalProtected;
			if (obj is PrimitiveValue)
				flags |= ObjectValueFlags.ReadOnly;
		}
 public Value GetValue(FieldInfoMirror field)
 {
     return(GetValues(new FieldInfoMirror [] { field }) [0]);
 }
		public FieldValueReference (EvaluationContext ctx, FieldInfoMirror field, object obj, TypeMirror declaringType)
			: this (ctx, field, obj, declaringType, null, ObjectValueFlags.Field)
		{
		}
Exemple #13
0
		public void SetValue (FieldInfoMirror field, Value value) {
			SetValues (new FieldInfoMirror [] { field }, new Value [] { value });
		}
Exemple #14
0
		public Value GetValue (FieldInfoMirror field) {
			return GetValues (new FieldInfoMirror [] { field }) [0];
		}
Exemple #15
0
		public FieldInfoMirror[] GetFields () {
			if (fields != null)
				return fields;

			string[] names;
			long[] types;
			int[] attrs;
			long[] ids = vm.conn.Type_GetFields (id, out names, out types, out attrs);

			FieldInfoMirror[] res = new FieldInfoMirror [ids.Length];
			for (int i = 0; i < res.Length; ++i)
				res [i] = new FieldInfoMirror (this, ids [i], names [i], vm.GetType (types [i]), (FieldAttributes)attrs [i]);

			fields = res;
			return fields;
		}
Exemple #16
0
		/*
		 * Return the value of the [ThreadStatic] field FIELD on the thread THREAD.
		 */
		public Value GetValue (FieldInfoMirror field, ThreadMirror thread) {
			if (thread == null)
				throw new ArgumentNullException ("thread");
			CheckMirror (thread);
			return GetValues (new FieldInfoMirror [] { field }, thread) [0];
		}
 internal CustomAttributeNamedArgumentMirror(PropertyInfoMirror prop, FieldInfoMirror field, CustomAttributeTypedArgumentMirror arg)
 {
     this.arg   = arg;
     this.prop  = prop;
     this.field = field;
 }
 public static TypeMirror GetType(object parent, FieldInfoMirror key)
 {
     return key.FieldType;
 }
		public void Add (FieldInfoMirror fieldVal)
		{
			lock (locker) {
				fields.Add (fieldVal);
			}
		}
Exemple #20
0
        public TraceRoots(IList<ThreadMirror> threads, FieldInfoMirror[] staticFields)
        {
            Contract.Requires(threads != null);

            m_threads = threads;
            m_staticFields = staticFields;
        }
		internal CustomAttributeNamedArgumentMirror (PropertyInfoMirror prop, FieldInfoMirror field, CustomAttributeTypedArgumentMirror arg)
		{
			this.arg = arg;
			this.prop = prop;
			this.field = field;
		}
Exemple #22
0
        private void DoWalkThreadStaticRoot(FieldInfoMirror field, List<Trace> roots, Func<string, object, bool> filter)
        {
            foreach (ThreadMirror thread in m_threads)
            {
                string name = string.Format("static {0} [thread {1}]", field.Name, ThreadsController.GetThreadName(thread));

                var root = new Trace(name, field.FieldType.FullName, field);
                Value v = field.DeclaringType.GetValue(field, thread);
                DoWalkValue(v, root, field.Name);
                if (DoFilter(root, filter, 0))
                    roots.Add(root);
            }
        }
Exemple #23
0
 private void DoWalkStaticRoot(FieldInfoMirror field, List<Trace> roots, Func<string, object, bool> filter)
 {
     var root = new Trace("static " + field.Name, field.FieldType.FullName, field);
     Value v = field.DeclaringType.GetValue(field);
     DoWalkValue(v, root, field.Name);
     if (DoFilter(root, filter, 0))
         roots.Add(root);
 }
 public void SetValue(FieldInfoMirror field, Value value)
 {
     SetValues(new FieldInfoMirror [] { field }, new Value [] { value });
 }
 public static void Set(ThreadMirror thread, VariableItem item, ObjectMirror parent, FieldInfoMirror key, Value newValue)
 {
     if (key.IsStatic)
         key.DeclaringType.SetValue(key, newValue);
     else
         parent.SetValue(key, newValue);
 }