Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
        public static VariableItem GetChild(ThreadMirror thread, VariableItem parentItem, LiveStackFrame parent, int index)
        {
            VariableItem child;

            IList<LocalVariable> locals = parent.GetVisibleVariables();
            if (index < locals.Count)
            {
                LocalVariable local = locals[index];

                string name = local.Name;
                if (string.IsNullOrEmpty(name))
                    name = "$" + local.Index;			// temporary variable

                Value v = parent.GetValue(local);
                child = new VariableItem(thread, name, parentItem, local, v, index);
            }
            else
            {
                FieldInfoMirror[] fields = parent.Method.DeclaringType.GetAllFields().ToArray();
                Contract.Assert(fields.Length > 0);

                object v = null;
                string name = "this";
                if (parent.ThisPtr is ObjectMirror)
                {
                    v = new InstanceValue((ObjectMirror) parent.ThisPtr, fields);
                }
                else if (parent.ThisPtr is StructMirror)
                {
                    v = new InstanceValue((StructMirror) parent.ThisPtr, fields);
                }
                else if (parent.ThisPtr == null || parent.ThisPtr.IsNull())
                {
                    v = new TypeValue(parent.Method.DeclaringType);
                    name = "statics";
                }
                else
                {
                    Contract.Assert(false, parent.ThisPtr.TypeName() + " is bogus");
                }

                child = new VariableItem(thread, name, parentItem, index, v, index);
            }

            return child;
        }
Exemplo n.º 3
0
        public static void Set(ThreadMirror thread, VariableItem item, InstanceValue parent, int key, Value newValue)
        {
            FieldInfoMirror field = parent.Type.GetFields()[key];
            Contract.Assert(!field.IsStatic);

            ObjectMirror o = parent.Instance as ObjectMirror;
            if (o != null)
            {
                o.SetValue(field, newValue);
            }
            else
            {
                var s = (StructMirror) parent.Instance;
                s.Fields[key] = newValue;
                SetValue.Invoke(thread, item.Parent, item.Parent.Parent.Value, item.Parent.Key, s);
            }
        }
Exemplo n.º 4
0
 public static TypeMirror GetType(InstanceValue parent, int key)
 {
     return null;			// we don't have enough info to return a decent type
 }
Exemplo n.º 5
0
 public static VariableItem GetChild(ThreadMirror thread, VariableItem parentItem, InstanceValue parent, int index)
 {
     return parent.GetChild(thread, parentItem, index);
 }