public ObjectValue[] GetChildren (ObjectPath path, int index, int count, EvaluationOptions options)
		{
			EvaluationContext cctx = ctx.WithOptions (options);
			var names = new ObjectValueNameTracker (cctx);
			object tdataType = null;
			TypeDisplayData tdata = null;
			List<ObjectValue> list = new List<ObjectValue> ();
			foreach (ValueReference val in cctx.Adapter.GetMembersSorted (cctx, objectSource, type, obj, bindingFlags)) {
				object decType = val.DeclaringType;
				if (decType != null && decType != tdataType) {
					tdataType = decType;
					tdata = cctx.Adapter.GetTypeDisplayData (cctx, decType);
				}
				DebuggerBrowsableState state = tdata.GetMemberBrowsableState (val.Name);
				if (state == DebuggerBrowsableState.Never)
					continue;
				ObjectValue oval = val.CreateObjectValue (options);
				names.FixName (val, oval);
				list.Add (oval);
			}
			if ((bindingFlags & BindingFlags.NonPublic) == 0) {
				BindingFlags newFlags = bindingFlags | BindingFlags.NonPublic;
				newFlags &= ~BindingFlags.Public;
				list.Add (CreateNonPublicsNode (cctx, objectSource, type, obj, newFlags));
			}
			return list.ToArray ();
		}
		static ObjectValue Create (IObjectValueSource source, ObjectPath path, string typeName)
		{
			ObjectValue ob = new ObjectValue ();
			ob.source = source;
			ob.path = path;
			ob.typeName = typeName;
			return ob;
		}
		static ObjectValue Create (IObjectValueSource source, ObjectPath path, string typeName)
		{
			var val = new ObjectValue ();
			val.typeName = typeName;
			val.source = source;
			val.path = path;
			return val;
		}
		public ObjectValue CreateElementValue (ArrayElementGroup grp, ObjectPath path, int[] indices)
		{
			if (array != null) {
				CorValRef elem = (CorValRef) GetElement (indices);
				return ctx.Adapter.CreateObjectValue (ctx, grp, path, elem, ObjectValueFlags.ArrayElement);
			}
			else
				return ObjectValue.CreateUnknown ("?");
		}
Ejemplo n.º 5
0
		public ObjectValue CreateObjectValue (EvaluationContext ctx, IObjectValueSource source, ObjectPath path, object obj, ObjectValueFlags flags)
		{
			try {
				return CreateObjectValueImpl (ctx, source, path, obj, flags);
			} catch (Exception ex) {
				ctx.WriteDebuggerError (ex);
				return ObjectValue.CreateFatalError (path.LastName, ex.Message, flags);
			}
		}
		public static ObjectValue CreateObject (IObjectValueSource source, ObjectPath path, string typeName, EvaluationResult value, ObjectValueFlags flags, ObjectValue[] children)
		{
			ObjectValue ob = Create (source, path, typeName);
			ob.path = path;
			ob.flags = flags | ObjectValueFlags.Object;
			ob.value = value.Value;
			ob.displayValue = value.DisplayValue;
			if (children != null) {
				ob.children = new List<ObjectValue> ();
				ob.children.AddRange (children);
			}
			return ob;
		}
        public ObjectValue[] GetChildren(ObjectPath path, int index, int count, EvaluationOptions options)
        {
            List<ObjectValue> children = new List<ObjectValue>();
            session.SelectThread(threadId);

            if (Engine.Symbols.ScopeLocalSymbols == null)
                return children.ToArray();

            DEW.DebugScopedSymbol parent = null;

            for (uint i = 0; i < Engine.Symbols.ScopeLocalSymbols.Symbols.Length; i++)
            {
                DEW.DebugScopedSymbol symbol = Engine.Symbols.ScopeLocalSymbols.Symbols[i];
                if (symbol.Name == path.LastName)
                {
                    parent = symbol;
                    break;
                }
            }

            if (parent == null || parent.ChildrenCount == 0)
                return children.ToArray();

            for (uint i = 0; i < parent.ChildrenCount; i++)
            {

                DEW.DebugScopedSymbol child = parent.Children[i];

                string name = child.Name;
                string typename = child.TypeName;
                string val = child.TextValue;
                ulong offset = child.Offset;

                ObjectValue ov = symbolResolver.Resolve(offset, name, typename, val, child.Parent);
                if (ov == null)
                {
                    ObjectValueFlags flags = ObjectValueFlags.Variable;
                    ov = ObjectValue.CreatePrimitive(this, new ObjectPath(name), typename, new EvaluationResult(val), flags);
                }

                if (ov != null)
                    children.Add(ov);
            }

            return children.ToArray();
        }
		public ObjectValue[] GetChildren (ObjectPath path, int index, int count, EvaluationOptions options)
		{
			var node = cacheRoot [path];

			if(node == null)
				return Backtrace.GetChildren(path, index, count, options);

			ObjectValue[] children;
			var t = node.NodeType;

			if (t is ArrayType)
				children = GetArrayChildren (node, path, index, count, options);
			else if (t is ClassType || t is StructType)
				children = GetClassInstanceChildren (node, path, options);
			else
				children = new ObjectValue[0];

			return children;
		}
Ejemplo n.º 9
0
        public ObjectValue[] GetChildren(ObjectPath path, int index, int count, EvaluationOptions options)
        {
            List<ObjectValue> children = new List<ObjectValue> ();
            session.SelectThread (threadId);
            return children.ToArray();

            /*
            DDebugCommandResult res = session.RunCommand("-var-list-children", "2", path.Join("."));
            ResultData cdata = res.GetObject ("children");

            // The response may not contain the "children" list at all.
            if (cdata == null)
                return children.ToArray ();

            if (index == -1) {
                index = 0;
                count = cdata.Count;
            }

            for (int n=index; n<cdata.Count && n<index+count; n++) {
                ResultData data = cdata.GetObject (n);
                ResultData child = data.GetObject ("child");

                string name = child.GetValue ("exp");
                if (name.Length > 0 && char.IsNumber (name [0]))
                    name = "[" + name + "]";

                // C++ structures may contain typeless children named
                // "public", "private" and "protected".
                if (child.GetValue("type") == null) {
                    ObjectPath childPath = new ObjectPath (child.GetValue ("name").Split ('.'));
                    ObjectValue[] subchildren = GetChildren (childPath, -1, -1, options);
                    children.AddRange(subchildren);
                } else {
                    ObjectValue val = CreateObjectValue (name, child);
                    children.Add (val);
                }
            }
            return children.ToArray ();
             */
        }
		public bool HasChildren (ObjectPath path, EvaluationOptions options)
		{
			EvaluationContext cctx = ctx.WithOptions (options);
			TypeDisplayData tdata = null;
			object tdataType = null;

			foreach (ValueReference val in cctx.Adapter.GetMembersSorted (cctx, objectSource, type, obj, bindingFlags)) {
				object decType = val.DeclaringType;
				if (decType != null && decType != tdataType) {
					tdataType = decType;
					tdata = cctx.Adapter.GetTypeDisplayData (cctx, decType);
				}

				DebuggerBrowsableState state = tdata.GetMemberBrowsableState (val.Name);
				if (state == DebuggerBrowsableState.Never)
					continue;

				return true;
			}

			return false;
		}
        public ObjectValue[] GetChildren(ObjectPath path, int index, int count, EvaluationOptions options)
        {
            List<ObjectValue> children = new List<ObjectValue>();
            session.SelectThread(threadId);

            string expression = path.Join(".");

            if (expression.Trim().Length == 0)
                return children.ToArray();

            List<DebugScopedSymbol> childSymbols = this.session.SymbolResolver.GetChildSymbols(expression);
            if (childSymbols.Count == 0)
                return children.ToArray();

            for (int i = 0; i < childSymbols.Count; i++)
            {
                DebugScopedSymbol child = childSymbols[i];

                ObjectValue ov = CreateObjectValue(child);
                children.Add(ov);
            }

            return children.ToArray();
        }
Ejemplo n.º 12
0
		public static ObjectValue CreateObject (IObjectValueSource source, ObjectPath path, string typeName, string value, ObjectValueFlags flags, ObjectValue[] children)
		{
			return CreateObject (source, path, typeName, new EvaluationResult (value), flags, children);
		}
Ejemplo n.º 13
0
		internal void UpdateFrom (ObjectValue val, bool notify)
		{
			lock (this) {
				arrayCount = val.arrayCount;
				if (val.name != null)
					name = val.name;
				value = val.value;
				displayValue = val.displayValue;
				typeName = val.typeName;
				flags = val.flags;
				source = val.source;
				children = val.children;
				path = val.path;
				updater = val.updater;
				ConnectCallbacks (parentFrame, this);
				if (evaluatedEvent != null)
					evaluatedEvent.Set ();
				if (notify && valueChanged != null)
					valueChanged (this, EventArgs.Empty);
			}
		}
Ejemplo n.º 14
0
 public static ObjectValue CreateImplicitNotSupported(IObjectValueSource source, ObjectPath path, string typeName, ObjectValueFlags flags)
 {
     return(CreateNotSupported(source, path, typeName, "Implicit evaluation is disabled", flags));
 }
Ejemplo n.º 15
0
		public static ObjectValue CreateEvaluating (IObjectValueUpdater updater, ObjectPath path, ObjectValueFlags flags)
		{
			ObjectValue ob = Create (null, path, null);
			ob.updater = updater;
			ob.path = path;
			ob.flags = flags | ObjectValueFlags.Evaluating;
			return ob;
		}
Ejemplo n.º 16
0
		public static ObjectValue CreateNotSupported (IObjectValueSource source, ObjectPath path, string typeName, string message, ObjectValueFlags flags)
		{
			ObjectValue ob = Create (source, path, typeName);
			ob.flags = flags | ObjectValueFlags.NotSupported;
			ob.value = message;
			return ob;
		}
Ejemplo n.º 17
0
 public static ObjectValue CreateObject(IObjectValueSource source, ObjectPath path, string typeName, string value, ObjectValueFlags flags, ObjectValue[] children)
 {
     return(CreateObject(source, path, typeName, new EvaluationResult(value), flags, children));
 }
Ejemplo n.º 18
0
		public override void SetRawValue (ObjectPath path, object value, EvaluationOptions options)
		{
			if (value is RawValue || value is RawValueArray || value is Array) {
				base.SetRawValue (path, value, options);
				return;
			}
			
			AppDomainMirror domain = null;
			if (null != obj && obj is ObjectMirror)
				domain = ((ObjectMirror)obj).Domain;
			Value = ((SoftDebuggerAdaptor)Context.Adapter).CreateValue (Context, value, domain);
		}
Ejemplo n.º 19
0
        public static ObjectValue CreateImplicitNotSupported(IObjectValueSource source, ObjectPath path, string typeName, ObjectValueFlags flags)
        {
            var val = Create(source, path, typeName);

            val.flags = flags | ObjectValueFlags.ImplicitNotSupported;
            val.value = "Implicit evaluation is disabled";
            return(val);
        }
Ejemplo n.º 20
0
		public ObjectCacheNode this[ObjectPath path]
		{
			get{
				ObjectCacheNode n= this;

				for(int i = 0; i < path.Length; i++)
					if ((n = n [path[i]]) == null)
						break;
				return n;
			}
		}
		public ObjectValue GetValue (ObjectPath path, EvaluationOptions options)
		{
			throw new NotSupportedException();
		}
		public ObjectValue[] GetChildren (ObjectPath path, int index, int count, EvaluationOptions options)
		{
			EvaluationContext cctx = ctx.WithOptions (options);
			return cctx.Adapter.GetObjectValueChildren (cctx, objectSource, type, obj, index, count, false);
		}
Ejemplo n.º 23
0
		public EvaluationResult SetValue (ObjectPath path, string value, EvaluationOptions options)
		{
			return MtaThread.Run (() => source.SetValue (path, value, options));
		}
Ejemplo n.º 24
0
 public override ObjectValue[] GetChildren(Mono.Debugging.Client.ObjectPath path, int index, int count, EvaluationOptions options)
 {
     return(new ObjectValue [0]);
 }
Ejemplo n.º 25
0
        public static ObjectValue CreateEvaluationException(EvaluationContext ctx, IObjectValueSource source, ObjectPath path, EvaluatorExceptionThrownException exception,
                                                            ObjectValueFlags flags = ObjectValueFlags.None)
        {
            var error = CreateError(source, path, exception.ExceptionTypeName, "Exception was thrown", flags);
            var exceptionReference = LiteralValueReference.CreateTargetObjectLiteral(ctx, "Exception", exception.Exception);
            var exceptionValue     = exceptionReference.CreateObjectValue(ctx.Options);

            error.children = new List <ObjectValue> {
                exceptionValue
            };
            return(error);
        }
Ejemplo n.º 26
0
		public static ObjectValue CreateNullObject (IObjectValueSource source, ObjectPath path, string typeName, ObjectValueFlags flags)
		{
			ObjectValue ob = Create (source, path, typeName);
			ob.flags = flags | ObjectValueFlags.Object;
			ob.value = "(null)";
			ob.isNull = true;
			return ob;
		}
Ejemplo n.º 27
0
		public static ObjectValue CreateError (IObjectValueSource source, ObjectPath path, string typeName, string value, ObjectValueFlags flags)
		{
			ObjectValue ob = Create (source, path, typeName);
			ob.flags = flags | ObjectValueFlags.Error;
			ob.value = value;
			return ob;
		}
		public override ObjectValue[] GetChildren (ObjectPath path, int index, int count, EvaluationOptions options)
		{
			EvaluationContext ctx = GetContext (options);
			try {
				List<ObjectValue> list = new List<ObjectValue> ();
				BindingFlags flattenFlag = options.FlattenHierarchy ? (BindingFlags)0 : BindingFlags.DeclaredOnly;
				BindingFlags flags = BindingFlags.Static | BindingFlags.Public | flattenFlag;
				bool groupPrivateMembers = options.GroupPrivateMembers && (options.GroupUserPrivateMembers || ctx.Adapter.IsExternalType (ctx, type));
				if (!groupPrivateMembers)
					flags |= BindingFlags.NonPublic;
				
				ObjectValueNameTracker names = new ObjectValueNameTracker (ctx);
				
				TypeDisplayData tdata = ctx.Adapter.GetTypeDisplayData (ctx, type);
				object tdataType = type;
				
				foreach (ValueReference val in ctx.Adapter.GetMembersSorted (ctx, this, type, null, flags)) {
					object decType = val.DeclaringType;
					if (decType != null && decType != tdataType) {
						tdataType = decType;
						tdata = ctx.Adapter.GetTypeDisplayData (ctx, decType);
					}
					DebuggerBrowsableState state = tdata.GetMemberBrowsableState (val.Name);
					if (state == DebuggerBrowsableState.Never)
						continue;

					ObjectValue oval = val.CreateObjectValue (options);
					names.FixName (val, oval);
					list.Add (oval);
				}
				
				List<ObjectValue> nestedTypes = new List<ObjectValue> ();
				foreach (object t in ctx.Adapter.GetNestedTypes (ctx, type))
					nestedTypes.Add (new TypeValueReference (ctx, t).CreateObjectValue (options));
				
				nestedTypes.Sort (delegate (ObjectValue v1, ObjectValue v2) {
					return v1.Name.CompareTo (v2.Name);
				});
				
				list.AddRange (nestedTypes);
				
				if (groupPrivateMembers)
					list.Add (FilteredMembersSource.CreateNonPublicsNode (ctx, this, type, null, BindingFlags.NonPublic | BindingFlags.Static | flattenFlag));
				
				if (!options.FlattenHierarchy) {
					object baseType = ctx.Adapter.GetBaseType (ctx, type, false);
					if (baseType != null) {
						TypeValueReference baseRef = new TypeValueReference (ctx, baseType);
						ObjectValue baseVal = baseRef.CreateObjectValue (false);
						baseVal.Name = "base";
						list.Insert (0, baseVal);
					}
				}
				
				return list.ToArray ();
			}
			catch (Exception ex) {
				Console.WriteLine (ex);
				ctx.WriteDebuggerOutput (ex.Message);
				return new ObjectValue [0];
			}
		}
Ejemplo n.º 29
0
		public static ObjectValue CreateImplicitNotSupported (IObjectValueSource source, ObjectPath path, string typeName, ObjectValueFlags flags)
		{
			return CreateNotSupported (source, path, typeName, "Implicit evaluation is disabled", flags);
		}
		public EvaluationResult SetValue (ObjectPath path, string value, EvaluationOptions options)
		{
			throw new NotSupportedException();
		}
Ejemplo n.º 31
0
		public static ObjectValue CreatePrimitive (IObjectValueSource source, ObjectPath path, string typeName, EvaluationResult value, ObjectValueFlags flags)
		{
			ObjectValue ob = Create (source, path, typeName);
			ob.flags = flags | ObjectValueFlags.Primitive;
			ob.value = value.Value;
			ob.displayValue = value.DisplayValue;
			return ob;
		}
		public void SetRawValue (ObjectPath path, object value, EvaluationOptions options)
		{
			throw new System.NotImplementedException ();
		}
Ejemplo n.º 33
0
		public static ObjectValue CreateArray (IObjectValueSource source, ObjectPath path, string typeName, int arrayCount, ObjectValueFlags flags, ObjectValue[] children)
		{
			ObjectValue ob = Create (source, path, typeName);
			ob.arrayCount = arrayCount;
			ob.flags = flags | ObjectValueFlags.Array;
			ob.value = "[" + arrayCount + "]";
			if (children != null && children.Length > 0) {
				ob.children = new List<ObjectValue> ();
				ob.children.AddRange (children);
			}
			return ob;
		}
Ejemplo n.º 34
0
		protected virtual ObjectValue CreateObjectValueImpl (EvaluationContext ctx, Mono.Debugging.Backend.IObjectValueSource source, ObjectPath path, object obj, ObjectValueFlags flags)
		{
			string typeName = obj != null ? GetValueTypeName (ctx, obj) : "";

			if (obj == null || IsNull (ctx, obj)) {
				return ObjectValue.CreateNullObject (source, path, GetDisplayTypeName (typeName), flags);
			}
			else if (IsPrimitive (ctx, obj) || IsEnum (ctx,obj)) {
				return ObjectValue.CreatePrimitive (source, path, GetDisplayTypeName (typeName), ctx.Evaluator.TargetObjectToExpression (ctx, obj), flags);
			}
			else if (IsArray (ctx, obj)) {
				return ObjectValue.CreateObject (source, path, GetDisplayTypeName (typeName), ctx.Evaluator.TargetObjectToExpression (ctx, obj), flags, null);
			}
			else {
				TypeDisplayData tdata = GetTypeDisplayData (ctx, GetValueType (ctx, obj));
				
				EvaluationResult tvalue;
				if (!string.IsNullOrEmpty (tdata.ValueDisplayString) && ctx.Options.AllowDisplayStringEvaluation)
					tvalue = new EvaluationResult (EvaluateDisplayString (ctx, obj, tdata.ValueDisplayString));
				else
					tvalue = ctx.Evaluator.TargetObjectToExpression (ctx, obj);
				
				string tname;
				if (!string.IsNullOrEmpty (tdata.TypeDisplayString) && ctx.Options.AllowDisplayStringEvaluation)
					tname = EvaluateDisplayString (ctx, obj, tdata.TypeDisplayString);
				else
					tname = GetDisplayTypeName (typeName);
				
				ObjectValue oval = ObjectValue.CreateObject (source, path, tname, tvalue, flags, null);
				if (!string.IsNullOrEmpty (tdata.NameDisplayString) && ctx.Options.AllowDisplayStringEvaluation)
					oval.Name = EvaluateDisplayString (ctx, obj, tdata.NameDisplayString);
				return oval;
			}
		}
Ejemplo n.º 35
0
		public static ObjectValue CreateUnknown (IObjectValueSource source, ObjectPath path, string typeName)
		{
			ObjectValue ob = Create (source, path, typeName);
			ob.flags = ObjectValueFlags.Unknown | ObjectValueFlags.ReadOnly;
			return ob;
		}