public MonoDSymbolResolver(IObjectValueSource objectValueSource, DEW.DBGEngine engine)
 {
     this.ObjectValueSource = objectValueSource;
     this.Engine = engine;
 }
Beispiel #2
0
        public static ObjectValue CreateUnknown(IObjectValueSource source, ObjectPath path, string typeName)
        {
            var val = Create(source, path, typeName);

            val.flags = ObjectValueFlags.Unknown | ObjectValueFlags.ReadOnly;
            return(val);
        }
Beispiel #3
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);
        }
Beispiel #4
0
 internal void UpdateFrom(ObjectValue val, bool notify)
 {
     lock (mutex) {
         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);
         }
     }
 }
Beispiel #5
0
        public static ObjectValue CreateNullObject(IObjectValueSource source, string name, string typeName, ObjectValueFlags flags)
        {
            ObjectValue ob = Create(source, new ObjectPath(name), typeName);

            ob.flags = flags | ObjectValueFlags.Object;
            ob.value = "(null)";
            return(ob);
        }
Beispiel #6
0
        public static ObjectValue CreateError(IObjectValueSource source, ObjectPath path, string typeName, string value, ObjectValueFlags flags)
        {
            var val = Create(source, path, typeName);

            val.flags = flags | ObjectValueFlags.Error;
            val.value = value;
            return(val);
        }
Beispiel #7
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);
        }
Beispiel #8
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);
        }
Beispiel #9
0
        public static ObjectValue CreateNotSupported(IObjectValueSource source, ObjectPath path, string typeName, string message, ObjectValueFlags flags)
        {
            var val = Create(source, path, typeName);

            val.flags = flags | ObjectValueFlags.NotSupported;
            val.value = message;
            return(val);
        }
		static ObjectValue Create (IObjectValueSource source, ObjectPath path, string typeName)
		{
			var val = new ObjectValue ();
			val.typeName = typeName;
			val.source = source;
			val.path = path;
			return val;
		}
		static ObjectValue Create (IObjectValueSource source, ObjectPath path, string typeName)
		{
			ObjectValue ob = new ObjectValue ();
			ob.source = source;
			ob.path = path;
			ob.typeName = typeName;
			return ob;
		}
Beispiel #12
0
        static ObjectValue Create(IObjectValueSource source, ObjectPath path, string typeName)
        {
            ObjectValue ob = new ObjectValue();

            ob.source   = source;
            ob.path     = path;
            ob.typeName = typeName;
            return(ob);
        }
        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);
        }
		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);
			}
		}
Beispiel #15
0
        public static ObjectValue CreateNullObject(IObjectValueSource source, ObjectPath path, string typeName, ObjectValueFlags flags)
        {
            var val = Create(source, path, typeName);

            val.flags  = flags | ObjectValueFlags.Object;
            val.value  = "(null)";
            val.isNull = true;
            return(val);
        }
Beispiel #16
0
        static ObjectValue Create(IObjectValueSource source, ObjectPath path, string typeName)
        {
            var val = new ObjectValue();

            val.typeName = typeName;
            val.source   = source;
            val.path     = path;
            return(val);
        }
Beispiel #17
0
        public static ObjectValue CreatePrimitive(IObjectValueSource source, ObjectPath path, string typeName, EvaluationResult value, ObjectValueFlags flags)
        {
            var val = Create(source, path, typeName);

            val.flags        = flags | ObjectValueFlags.Primitive;
            val.displayValue = value.DisplayValue;
            val.value        = value.Value;
            return(val);
        }
Beispiel #18
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) {
         Console.WriteLine(ex);
         return(ObjectValue.CreateFatalError(path.LastName, ex.Message, flags));
     }
 }
Beispiel #19
0
        private static ObjectValue InitialiseObjectValues(IObjectValueSource objectValueSource)
        {
            // ReSharper disable ArgumentsStyleNamedExpression
            // Displayed in the debugger as "objectValueSource.Name = {typeName} value"
            var objectValue = ObjectValue.CreateObject(objectValueSource, new ObjectPath(objectValueSource.Name),
                                                       typeDisplayName: string.Empty, string.Empty, string.Empty,
                                                       ObjectValueFlags.Group | ObjectValueFlags.ReadOnly | ObjectValueFlags.NoRefresh, null);

            objectValue.ChildSelector = string.Empty;
            return(objectValue);
        }
Beispiel #20
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);
        }
		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;
		}
Beispiel #22
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);
        }
Beispiel #23
0
        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 static ObjectValue CreateNullObject (IObjectValueSource source, string name, string typeName, ObjectValueFlags flags)
		{
			return CreateNullObject (source, new ObjectPath (name), typeName, flags);
		}
		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);
		}
		protected override ObjectValue CreateObjectValueImpl (EvaluationContext gctx, IObjectValueSource source, ObjectPath path, object vobj, ObjectValueFlags flags)
		{
			MdbEvaluationContext ctx = (MdbEvaluationContext) gctx;
			TargetObject obj = ctx.GetRealObject (vobj);
			
			if (obj == null)
				return ObjectValue.CreateObject (null, path, "", "", flags | ObjectValueFlags.ReadOnly, null);

			if (obj.HasAddress && obj.GetAddress (ctx.Thread).IsNull)
				return ObjectValue.CreateObject (null, path, obj.TypeName, ctx.Evaluator.ToExpression (ctx, null), flags, null);
			
			switch (obj.Kind) {
				
				case TargetObjectKind.Struct:
				case TargetObjectKind.GenericInstance:
				case TargetObjectKind.Class:
				case TargetObjectKind.Array:
				case TargetObjectKind.Fundamental:
				case TargetObjectKind.Enum:
					return base.CreateObjectValueImpl (gctx, source, path, vobj, flags);
					
				case TargetObjectKind.Object:
					TargetObjectObject oob = obj as TargetObjectObject;
					if (oob == null)
						return ObjectValue.CreateUnknown (path.LastName);
					else
						return ObjectValue.CreateObject (source, path, obj.TypeName, Server.Instance.Evaluator.TargetObjectToExpression (ctx, obj), flags, null);
					
				case TargetObjectKind.Pointer:
					return ObjectValue.CreateObject (source, path, obj.TypeName, Server.Instance.Evaluator.TargetObjectToExpression (ctx, obj), flags, null);
					
				case TargetObjectKind.Nullable:
					TargetNullableObject tn = (TargetNullableObject) obj;
					if (tn.HasValue (ctx.Thread)) {
						ObjectValue val = CreateObjectValue (ctx, source, path, tn.GetValue (ctx.Thread), flags);
						val.TypeName = obj.TypeName;
						return val;
					}
					else {
						flags |= ObjectValueFlags.Primitive;
						return ObjectValue.CreateObject (source, path, obj.TypeName, ctx.Evaluator.ToExpression (ctx, null), flags, new ObjectValue [0]);
					}
				default:
					return ObjectValue.CreateFatalError (path.LastName, "Unknown value type: " + obj.Kind, flags);
			}
		}
Beispiel #27
0
 public static ObjectValue CreateNullObject(IObjectValueSource source, string name, string typeName, ObjectValueFlags flags)
 {
     return(CreateNullObject(source, new ObjectPath(name), typeName, flags));
 }
Beispiel #28
0
 public static ObjectValue CreateNullObject(IObjectValueSource source, ObjectPath path, string typeName, ObjectValueFlags flags)
 {
     var val = Create (source, path, typeName);
     val.flags = flags | ObjectValueFlags.Object;
     val.value = "(null)";
     val.isNull = true;
     return val;
 }
Beispiel #29
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));
 }
		public MtaObjectValueSource (IObjectValueSource s)
		{
			source = s;
		}
        protected virtual ObjectValue CreateObjectValueImpl(EvaluationContext ctx, IObjectValueSource source, ObjectPath path, object obj, ObjectValueFlags flags)
        {
            object type = obj != null ? GetValueType (ctx, obj) : null;
            string typeName = type != null ? GetTypeName (ctx, type) : "";

            if (obj == null || IsNull (ctx, obj))
                return ObjectValue.CreateNullObject (source, path, GetDisplayTypeName (typeName), flags);

            if (IsPrimitive (ctx, obj) || IsEnum (ctx,obj))
                return ObjectValue.CreatePrimitive (source, path, GetDisplayTypeName (typeName), ctx.Evaluator.TargetObjectToExpression (ctx, obj), flags);

            if (IsArray (ctx, obj))
                return ObjectValue.CreateObject (source, path, GetDisplayTypeName (typeName), ctx.Evaluator.TargetObjectToExpression (ctx, obj), flags, null);

            EvaluationResult tvalue = null;
            TypeDisplayData tdata = null;
            string tname;

            if (IsNullableType (ctx, type)) {
                if (NullableHasValue (ctx, type, obj)) {
                    ValueReference value = NullableGetValue (ctx, type, obj);

                    tdata = GetTypeDisplayData (ctx, value.Type);
                    obj = value.Value;
                } else {
                    tdata = GetTypeDisplayData (ctx, type);
                    tvalue = new EvaluationResult ("null");
                }

                tname = GetDisplayTypeName (typeName);
            } else {
                tdata = GetTypeDisplayData (ctx, type);

                if (!string.IsNullOrEmpty (tdata.TypeDisplayString) && ctx.Options.AllowDisplayStringEvaluation)
                    tname = EvaluateDisplayString (ctx, obj, tdata.TypeDisplayString);
                else
                    tname = GetDisplayTypeName (typeName);
            }

            if (tvalue == null) {
                if (!string.IsNullOrEmpty (tdata.ValueDisplayString) && ctx.Options.AllowDisplayStringEvaluation)
                    tvalue = new EvaluationResult (EvaluateDisplayString (ctx, obj, tdata.ValueDisplayString));
                else
                    tvalue = ctx.Evaluator.TargetObjectToExpression (ctx, obj);
            }

            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;
        }
		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;
		}
Beispiel #33
0
		public static ObjectValue CreateNullObject (IObjectValueSource source, string name, string typeName, ObjectValueFlags flags)
		{
			ObjectValue ob = Create (source, new ObjectPath (name), typeName);
			ob.flags = flags | ObjectValueFlags.Object;
			ob.value = "(null)";
			return ob;
		}
		public static ObjectValue CreateUnknown (IObjectValueSource source, ObjectPath path, string typeName)
		{
			ObjectValue ob = Create (source, path, typeName);
			ob.flags = ObjectValueFlags.Unknown | ObjectValueFlags.ReadOnly;
			return ob;
		}
Beispiel #35
0
 public static ObjectValue CreateUnknown(IObjectValueSource source, ObjectPath path, string typeName)
 {
     var val = Create (source, path, typeName);
     val.flags = ObjectValueFlags.Unknown | ObjectValueFlags.ReadOnly;
     return val;
 }
Beispiel #36
0
 public static ObjectValue CreateError(IObjectValueSource source, ObjectPath path, string typeName, string value, ObjectValueFlags flags)
 {
     var val = Create (source, path, typeName);
     val.flags = flags | ObjectValueFlags.Error;
     val.value = value;
     return val;
 }
		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;
		}
Beispiel #38
0
 public static ObjectValue CreateImplicitNotSupported(IObjectValueSource source, ObjectPath path, string typeName, ObjectValueFlags flags)
 {
     return(CreateNotSupported(source, path, typeName, "Implicit evaluation is disabled", flags));
 }
		public static ObjectValue CreateImplicitNotSupported (IObjectValueSource source, ObjectPath path, string typeName, ObjectValueFlags flags)
		{
			return CreateNotSupported (source, path, typeName, "Implicit evaluation is disabled", flags);
		}
		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;
		}
Beispiel #41
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;
        }
Beispiel #42
0
 public MtaObjectValueSource(IObjectValueSource s)
 {
     source = s;
 }
		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);
			}
		}
		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;
		}
Beispiel #45
0
 public static ObjectValue CreateNotSupported(IObjectValueSource source, ObjectPath path, string typeName, string message, ObjectValueFlags flags)
 {
     var val = Create (source, path, typeName);
     val.flags = flags | ObjectValueFlags.NotSupported;
     val.value = message;
     return val;
 }
		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;
		}
 public MonoDSymbolResolver(IObjectValueSource objectValueSource, DEW.DBGEngine engine)
 {
     this.ObjectValueSource = objectValueSource;
     this.Engine            = engine;
 }