Esempio n. 1
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;
        }
Esempio n. 2
0
 public static void Set(ThreadMirror thread, VariableItem item, LiveStackFrame parent, int key, Value newValue)
 {
     LocalVariable local = parent.GetVisibleVariables()[key];
     parent.SetValue(local, newValue);
 }