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.
Example #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);
        }
Example #2
0
 internal TargetNullableObject(TargetNullableType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
Example #3
0
 protected override TargetObject DoGetObject(TargetMemoryAccess target, TargetLocation location)
 {
     return new TargetEnumObject (this, location);
 }
Example #4
0
 internal TargetObject(TargetType type, TargetLocation location)
 {
     this.type = type;
     this.Location = location;
     this.type_name = type.Name;
 }
Example #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;
 }
Example #8
0
 internal TargetNullableObject(TargetNullableType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
Example #9
0
 protected abstract TargetObject DoGetObject(TargetMemoryAccess target,
                                             TargetLocation location);
Example #10
0
 internal TargetObject GetObject(TargetMemoryAccess target, TargetLocation location)
 {
     return(DoGetObject(target, location));
 }
Example #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;
 }
Example #13
0
 internal abstract long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
                                       TargetLocation location,
                                       out TargetLocation dynamic_location);
Example #14
0
 internal TargetObject(TargetType type, TargetLocation location)
 {
     this.type      = type;
     this.Location  = location;
     this.type_name = type.Name;
 }
Example #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);
        }
Example #16
0
 protected override TargetObject DoGetObject(TargetMemoryAccess target, TargetLocation location)
 {
     return(new TargetEnumObject(this, location));
 }
Example #17
0
 public RelativeTargetLocation(TargetLocation relative_to, long offset)
 {
     this.relative_to = relative_to;
     this.offset = offset;
 }
Example #18
0
 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();
 }
Example #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;
 }
Example #22
0
            public override TargetLocation GetBaseLocation(TargetMemoryAccess memory,
									TargetLocation location)
            {
                return Inheritance.DataMember.GetLocation (location);
            }
Example #23
0
 internal TargetEnumObject(TargetEnumType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
Example #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;
 }
Example #26
0
        protected abstract TargetObject DoGetObject(TargetMemoryAccess target,
							     TargetLocation location);
Example #27
0
        internal abstract long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
						       TargetLocation location,
						       out TargetLocation dynamic_location);
Example #28
0
 internal TargetObject GetObject(TargetMemoryAccess target, TargetLocation location)
 {
     return DoGetObject (target, location);
 }
 public DereferencedTargetLocation(TargetLocation reference)
 {
     this.reference = reference;
 }
Example #30
0
 internal TargetFundamentalObject(TargetFundamentalType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }