Exemple #1
0
        protected override object DoGetObject(TargetMemoryAccess target)
        {
            TargetLocation dynamic_location;
            TargetBlob     object_blob = Location.ReadMemory(target, type.Size);
            long           size        = GetDynamicSize(
                target, object_blob, Location, out dynamic_location);

            if (size > (long)MonoStringType.MaximumStringLength)
            {
                size = MonoStringType.MaximumStringLength;
            }

            TargetBlob blob = dynamic_location.ReadMemory(target, (int)size);

            TargetBinaryReader reader = blob.GetReader();
            int length = (int)reader.Size / 2;

            char[] retval = new char [length];

            for (int i = 0; i < length; i++)
            {
                retval [i] = (char)reader.ReadInt16();
            }

            return(new String(retval));
        }
Exemple #2
0
        internal virtual TargetFundamentalObject CreateInstance(Thread target, object obj)
        {
            TargetBlob     blob     = new TargetBlob(CreateObject(obj), target.TargetMemoryInfo);
            TargetLocation location = new ClientSuppliedTargetLocation(blob);

            return(new TargetFundamentalObject(this, location));
        }
Exemple #3
0
        internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
						       TargetLocation location,
						       out TargetLocation dynamic_location)
        {
            int element_size = Type.GetElementSize (target);
            dynamic_location = location.GetLocationAtOffset (Type.Size);
            return element_size * GetLength (target);
        }
Exemple #4
0
        public DwarfFrameReader(Bfd bfd, TargetBlob blob, long vma,
					 bool is_ehframe)
        {
            this.bfd = bfd;
            this.blob = blob;
            this.vma = vma;
            this.is_ehframe = is_ehframe;
        }
 public DwarfFrameReader(Bfd bfd, TargetBlob blob, long vma,
                         bool is_ehframe)
 {
     this.bfd        = bfd;
     this.blob       = blob;
     this.vma        = vma;
     this.is_ehframe = is_ehframe;
 }
        internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
                                              TargetLocation location,
                                              out TargetLocation dynamic_location)
        {
            int element_size = Type.GetElementSize(target);

            dynamic_location = location.GetLocationAtOffset(Type.Size);
            return(element_size * GetLength(target));
        }
Exemple #7
0
        internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
						       TargetLocation location,
						       out TargetLocation dynamic_location)
        {
            TargetBinaryReader reader = blob.GetReader ();
            reader.Position = Type.ObjectSize;
            dynamic_location = location.GetLocationAtOffset (Type.ObjectSize + 4);
            return reader.ReadInteger (4) * 2;
        }
Exemple #8
0
        internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
                                              TargetLocation location,
                                              out TargetLocation dynamic_location)
        {
            TargetBinaryReader reader = blob.GetReader();

            reader.Position  = Type.ObjectSize;
            dynamic_location = location.GetLocationAtOffset(Type.ObjectSize + 4);
            return(reader.ReadInteger(4) * 2);
        }
Exemple #9
0
        void create_frame_reader()
        {
            long    vma_base = base_address.IsNull ? 0 : base_address.Address;
            Section section  = GetSectionByName(".debug_frame", false);

            if (section != null)
            {
                byte[]     contents = GetSectionContents(section.section);
                TargetBlob blob     = new TargetBlob(contents, info);
                frame_reader = new DwarfFrameReader(
                    this, blob, vma_base + section.vma, false);
            }

            section = GetSectionByName(".eh_frame", false);
            if (section != null)
            {
                byte[]     contents = GetSectionContents(section.section);
                TargetBlob blob     = new TargetBlob(contents, info);
                eh_frame_reader = new DwarfFrameReader(
                    this, blob, vma_base + section.vma, true);
            }
        }
Exemple #10
0
        internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
						       TargetLocation location,
						       out TargetLocation dynamic_location)
        {
            throw new InvalidOperationException ();
        }
Exemple #11
0
 internal TargetReader(TargetBlob data)
     : this(data.Contents, data.TargetMemoryInfo)
 {
 }
Exemple #12
0
 public ClientSuppliedTargetLocation(TargetBlob blob)
 {
     this.blob = blob;
 }
 internal virtual TargetFundamentalObject CreateInstance(Thread target, object obj)
 {
     TargetBlob blob = new TargetBlob (CreateObject (obj), target.TargetMemoryInfo);
     TargetLocation location = new ClientSuppliedTargetLocation (blob);
     return new TargetFundamentalObject (this, location);
 }
Exemple #14
0
 public DwarfBinaryReader(Bfd bfd, TargetBlob blob, bool is64bit)
     : base(blob)
 {
     this.bfd = bfd;
     this.is64bit = is64bit;
 }
Exemple #15
0
 internal abstract long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
                                       TargetLocation location,
                                       out TargetLocation dynamic_location);
 public ClientSuppliedTargetLocation(TargetBlob blob)
 {
     this.blob = blob;
 }
Exemple #17
0
        internal abstract long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
						       TargetLocation location,
						       out TargetLocation dynamic_location);
Exemple #18
0
 internal TargetReader(TargetBlob data)
     : this(data.Contents, data.TargetMemoryInfo)
 {
 }
 internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
                                       TargetLocation location,
                                       out TargetLocation dynamic_location)
 {
     throw new InvalidOperationException();
 }
Exemple #20
0
        protected virtual object DoGetObject(TargetMemoryAccess target)
        {
            TargetBlob blob = Location.ReadMemory(target, Type.Size);

            switch (Type.FundamentalKind)
            {
            case FundamentalKind.Boolean:
                return(blob.Contents [0] != 0);

            case FundamentalKind.Char:
                return(BitConverter.ToChar(blob.Contents, 0));

            case FundamentalKind.SByte:
                return((sbyte)blob.Contents [0]);

            case FundamentalKind.Byte:
                return((byte)blob.Contents [0]);

            case FundamentalKind.Int16:
                return(BitConverter.ToInt16(blob.Contents, 0));

            case FundamentalKind.UInt16:
                return(BitConverter.ToUInt16(blob.Contents, 0));

            case FundamentalKind.Int32:
                return(BitConverter.ToInt32(blob.Contents, 0));

            case FundamentalKind.UInt32:
                return(BitConverter.ToUInt32(blob.Contents, 0));

            case FundamentalKind.Int64:
                return(BitConverter.ToInt64(blob.Contents, 0));

            case FundamentalKind.UInt64:
                return(BitConverter.ToUInt64(blob.Contents, 0));

            case FundamentalKind.Single:
                return(BitConverter.ToSingle(blob.Contents, 0));

            case FundamentalKind.Double:
                return(BitConverter.ToDouble(blob.Contents, 0));

            case FundamentalKind.IntPtr:
                if (blob.Contents.Length == 4)
                {
                    return(new IntPtr(BitConverter.ToInt32(blob.Contents, 0)));
                }
                else
                {
                    return(new IntPtr(BitConverter.ToInt64(blob.Contents, 0)));
                }

            case FundamentalKind.UIntPtr:
                if (blob.Size == 4)
                {
                    return(new UIntPtr(BitConverter.ToUInt32(blob.Contents, 0)));
                }
                else
                {
                    return(new UIntPtr(BitConverter.ToUInt64(blob.Contents, 0)));
                }

            case FundamentalKind.Decimal: {
                IntPtr ptr = IntPtr.Zero;

                try {
                    ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(decimal)));
                    Marshal.Copy(blob.Contents, 0, ptr, type.Size);

                    decimal d = (decimal)Marshal.PtrToStructure(ptr, typeof(decimal));
                    return(d);
                } finally {
                    if (ptr != IntPtr.Zero)
                    {
                        Marshal.FreeHGlobal(ptr);
                    }
                }
            }

            default:
                throw new InvalidOperationException();
            }
        }