示例#1
0
 protected void PrintObject(Thread target, TargetObject obj)
 {
     try {
         Append(obj.Print(target));
     } catch {
         Append("<cannot display object>");
     }
 }
示例#2
0
 protected string PrintObject(Thread target, TargetObject obj)
 {
     try {
         return(obj.Print(target));
     } catch {
         return("<cannot display object>");
     }
 }
        internal override string Print(TargetMemoryAccess target)
        {
            if (Type.HasStaticType)
            {
                TargetFundamentalType ftype;
                NativeTypeAlias       alias = Type.StaticType as NativeTypeAlias;
                if (alias != null)
                {
                    ftype = alias.TargetType as TargetFundamentalType;
                }
                else
                {
                    ftype = Type.StaticType as TargetFundamentalType;
                }

                if ((ftype != null) && (ftype.Name == "char"))
                {
                    TargetObject sobj = Type.Language.StringType.GetObject(
                        target, Location);
                    if (sobj != null)
                    {
                        return(sobj.Print(target));
                    }
                }
            }

            if (HasAddress)
            {
                TargetAddress address = GetAddress(target);
                if (address.IsNull)
                {
                    return("null");
                }
                else
                {
                    return(String.Format("{0}", address));
                }
            }
            else
            {
                byte[] data = Location.ReadBuffer(target, type.Size);

                long address;
                if (type.Size == 4)
                {
                    address = (uint)BitConverter.ToInt32(data, 0);
                }
                else
                {
                    address = BitConverter.ToInt64(data, 0);
                }

                return(String.Format("0x{0:x}", address));
            }
        }