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)); }
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)); }
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); }
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)); }
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; }
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); }
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); } }
internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob, TargetLocation location, out TargetLocation dynamic_location) { throw new InvalidOperationException (); }
internal TargetReader(TargetBlob data) : this(data.Contents, data.TargetMemoryInfo) { }
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); }
public DwarfBinaryReader(Bfd bfd, TargetBlob blob, bool is64bit) : base(blob) { this.bfd = bfd; this.is64bit = is64bit; }
internal abstract long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob, TargetLocation location, out TargetLocation dynamic_location);
public ClientSuppliedTargetLocation(TargetBlob blob) { this.blob = blob; }
internal abstract long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob, TargetLocation location, out TargetLocation dynamic_location);
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(); }
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(); } }