This class represents the `location' of a variable. The idea is that we do not always have an address for a variable (for instance if it's stored in a register) and that an addresses lifetime may be limited.
Beispiel #1
0
        internal virtual void SetObject(TargetMemoryAccess target, TargetLocation location,
                                        TargetObject obj)
        {
            if (obj == null)
            {
                if (IsByRef)
                {
                    location.WriteAddress(target, TargetAddress.Null);
                    return;
                }

                throw new InvalidOperationException();
            }

            if (IsByRef)
            {
                if (obj.Type.IsByRef)
                {
                    location.WriteAddress(target, obj.Location.GetAddress(target));
                    return;
                }

                throw new InvalidOperationException();
            }

            if (!HasFixedSize || !obj.Type.HasFixedSize)
            {
                throw new InvalidOperationException();
            }
            if (Size != obj.Type.Size)
            {
                throw new InvalidOperationException();
            }

            byte[] contents = obj.Location.ReadBuffer(target, obj.Type.Size);
            location.WriteBuffer(target, contents);
        }
 internal TargetNullableObject(TargetNullableType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
Beispiel #3
0
 protected override TargetObject DoGetObject(TargetMemoryAccess target, TargetLocation location)
 {
     return new TargetEnumObject (this, location);
 }
Beispiel #4
0
 internal TargetObject(TargetType type, TargetLocation location)
 {
     this.type = type;
     this.Location = location;
     this.type_name = type.Name;
 }
Beispiel #5
0
        internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
						       TargetLocation location,
						       out TargetLocation dynamic_location)
        {
            throw new InvalidOperationException ();
        }
 public DereferencedTargetLocation(TargetLocation reference)
 {
     this.reference = reference;
 }
 internal TargetObjectObject(TargetObjectType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
Beispiel #8
0
 internal TargetNullableObject(TargetNullableType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
Beispiel #9
0
 protected abstract TargetObject DoGetObject(TargetMemoryAccess target,
                                             TargetLocation location);
Beispiel #10
0
 internal TargetObject GetObject(TargetMemoryAccess target, TargetLocation location)
 {
     return(DoGetObject(target, location));
 }
Beispiel #11
0
 internal TargetArrayObject(TargetArrayType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
     this.Rank = type.Rank;
 }
 public BitfieldTargetLocation(TargetLocation relative_to, int offset, int size)
 {
     this.relative_to = relative_to;
     this.bit_offset  = offset;
     this.bit_size    = size;
 }
Beispiel #13
0
 internal abstract long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
                                       TargetLocation location,
                                       out TargetLocation dynamic_location);
Beispiel #14
0
 internal TargetObject(TargetType type, TargetLocation location)
 {
     this.type      = type;
     this.Location  = location;
     this.type_name = type.Name;
 }
Beispiel #15
0
        internal virtual void SetObject(TargetMemoryAccess target, TargetLocation location,
						 TargetObject obj)
        {
            if (obj == null) {
                if (IsByRef) {
                    location.WriteAddress (target, TargetAddress.Null);
                    return;
                }

                throw new InvalidOperationException ();
            }

            if (IsByRef) {
                if (obj.Type.IsByRef) {
                    location.WriteAddress (target, obj.Location.GetAddress (target));
                    return;
                }

                throw new InvalidOperationException ();
            }

            if (!HasFixedSize || !obj.Type.HasFixedSize)
                throw new InvalidOperationException ();
            if (Size != obj.Type.Size)
                throw new InvalidOperationException ();

            byte[] contents = obj.Location.ReadBuffer (target, obj.Type.Size);
            location.WriteBuffer (target, contents);
        }
Beispiel #16
0
 protected override TargetObject DoGetObject(TargetMemoryAccess target, TargetLocation location)
 {
     return(new TargetEnumObject(this, location));
 }
 public RelativeTargetLocation(TargetLocation relative_to, long offset)
 {
     this.relative_to = relative_to;
     this.offset = offset;
 }
 public BitfieldTargetLocation(TargetLocation relative_to, int offset, int size)
 {
     this.relative_to = relative_to;
     this.bit_offset = offset;
     this.bit_size = size;
 }
 internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
                                       TargetLocation location,
                                       out TargetLocation dynamic_location)
 {
     throw new InvalidOperationException();
 }
Beispiel #20
0
 internal TargetArrayObject(TargetArrayType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
     this.Rank = type.Rank;
 }
 internal TargetFundamentalObject(TargetFundamentalType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
Beispiel #22
0
            public override TargetLocation GetBaseLocation(TargetMemoryAccess memory,
									TargetLocation location)
            {
                return Inheritance.DataMember.GetLocation (location);
            }
Beispiel #23
0
 internal TargetEnumObject(TargetEnumType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
Beispiel #24
0
            public TargetLocation GetLocation(TargetLocation location)
            {
                if (location_block == null)
                    throw new NotImplementedException ();

                TargetBinaryReader locreader = new TargetBinaryReader (
                    location_block, comp_unit.DwarfReader.TargetMemoryInfo);

                byte opcode = locreader.ReadByte ();

                if (opcode == 0x23) // DW_OP_plus_uconst
                    location = new RelativeTargetLocation (location, locreader.ReadLeb128 ());
                else {
                    Console.WriteLine ("UNKNOWN OPCODE: {0:x}", opcode);
                    return null;
                }

                if (!locreader.IsEof) {
                    Console.WriteLine ("LOCREADER NOT AT EOF!");
                    return null;
                }

                return location;
            }
 public RelativeTargetLocation(TargetLocation relative_to, long offset)
 {
     this.relative_to = relative_to;
     this.offset      = offset;
 }
Beispiel #26
0
        protected abstract TargetObject DoGetObject(TargetMemoryAccess target,
							     TargetLocation location);
Beispiel #27
0
        internal abstract long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
						       TargetLocation location,
						       out TargetLocation dynamic_location);
Beispiel #28
0
 internal TargetObject GetObject(TargetMemoryAccess target, TargetLocation location)
 {
     return DoGetObject (target, location);
 }
 public DereferencedTargetLocation(TargetLocation reference)
 {
     this.reference = reference;
 }
Beispiel #30
0
 internal TargetFundamentalObject(TargetFundamentalType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }