Exemplo n.º 1
0
        internal static string ReadString(MonoLanguageBackend mono, TargetMemoryAccess target,
						   TargetAddress address)
        {
            if (address.IsNull)
                return null;

            TargetLocation location = new AbsoluteTargetLocation (address);
            MonoStringObject so = new MonoStringObject (mono.BuiltinTypes.StringType, location);
            return (string) so.DoGetObject (target);
        }
Exemplo n.º 2
0
        internal override TargetObject GetObject(StackFrame frame,
                                                 TargetMemoryAccess target)
        {
            TargetLocation location = GetLocation(frame, target);

            if (location == null)
            {
                throw new LocationInvalidException();
            }

            if (location.HasAddress && location.GetAddress(target).IsNull)
            {
                TargetLocation null_loc = new AbsoluteTargetLocation(TargetAddress.Null);
                return(new TargetNullObject(type));
            }

            return(type.GetObject(target, location));
        }
Exemplo n.º 3
0
        internal override TargetFundamentalObject CreateInstance(Thread thread, object obj)
        {
            string str = obj as string;

            if (str == null)
            {
                throw new ArgumentException();
            }

            if (!thread.CurrentFrame.Language.IsManaged)
            {
                throw new TargetException(TargetError.InvalidContext);
            }

            TargetAddress retval = thread.CallMethod(
                CreateString, TargetAddress.Null, 0, 0, str);
            TargetLocation location = new AbsoluteTargetLocation(retval);

            return(new MonoStringObject(this, location));
        }
Exemplo n.º 4
0
        internal override TargetFundamentalObject CreateInstance(Thread thread, object obj)
        {
            string str = obj as string;
                        if (str == null)
                                throw new ArgumentException ();

            if (!thread.CurrentFrame.Language.IsManaged)
                throw new TargetException (TargetError.InvalidContext);

                        TargetAddress retval = thread.CallMethod (
                CreateString, TargetAddress.Null, 0, 0, str);
                        TargetLocation location = new AbsoluteTargetLocation (retval);
                        return new MonoStringObject (this, location);
        }
Exemplo n.º 5
0
        internal override TargetObject GetObject(StackFrame frame,
							  TargetMemoryAccess target)
        {
            TargetLocation location = GetLocation (frame, target);

            if (location == null)
                throw new LocationInvalidException ();

            if (location.HasAddress && location.GetAddress (target).IsNull) {
                TargetLocation null_loc = new AbsoluteTargetLocation (TargetAddress.Null);
                return new TargetNullObject (type);
            }

            return type.GetObject (target, location);
        }
Exemplo n.º 6
0
        internal void SetStaticField(TargetMemoryAccess target, TargetFieldInfo field,
					      TargetAddress data_address, TargetObject obj)
        {
            GetFields (target);

            int offset = field_offsets [field.Position];
            TargetType type = field_types [field.Position];

            TargetLocation location = new AbsoluteTargetLocation (data_address);
            TargetLocation field_loc = location.GetLocationAtOffset (offset);

            if (type.IsByRef)
                field_loc = field_loc.GetDereferencedLocation ();

            type.SetObject (target, field_loc, obj);
        }
Exemplo n.º 7
0
        public override TargetPointerObject CreatePointer(StackFrame frame,
								   TargetAddress address)
        {
            TargetLocation location = new AbsoluteTargetLocation (address);
            return new NativePointerObject (pointer_type, location);
        }
Exemplo n.º 8
0
 public override TargetObject CreateNullObject(Thread target, TargetType type)
 {
     TargetLocation location = new AbsoluteTargetLocation (TargetAddress.Null);
     NativePointerType pointer = new NativePointerType (this, type);
     return new NativePointerObject (pointer, location);
 }