Beispiel #1
0
 public virtual RemoteValue Create(RemoteValue remoteProxy, RemoteValue addressOf,
                                   SbType typeInfo, string expressionPath, bool hasExpressionPath, uint numChildren,
                                   string summary, string typeName, string value, ValueType valueType, bool isPointerType,
                                   ValueFormat valueFormat, ulong byteSize)
 => new CachedValue(remoteProxy, addressOf, typeInfo, expressionPath, hasExpressionPath,
                    numChildren, summary, typeName, value, valueType, isPointerType, valueFormat,
                    byteSize);
        static IEnumerable <RemoteValue> GetPointerChildren(RemoteValue value, int offset, int count)
        {
            var    result      = new List <RemoteValue>();
            SbType pointeeType = value.GetTypeInfo()?.GetPointeeType();

            if (pointeeType == null)
            {
                // If we cannot get the pointee type, just return the empty list.
                return(result);
            }
            ulong byteSize    = pointeeType.GetByteSize();
            ulong baseAddress = value.GetValueAsUnsigned() + (ulong)offset * byteSize;

            for (int n = 0; n < count; ++n)
            {
                ulong       address    = baseAddress + (ulong)n * byteSize;
                RemoteValue childValue =
                    value.CreateValueFromAddress($"[{offset + n}]", address, pointeeType);
                if (childValue != null)
                {
                    result.Add(childValue);
                }
            }
            return(result);
        }
Beispiel #3
0
        public SbTypeMember AddDirectBaseClass(SbType typeInfo)
        {
            var typeMember = new SbTypeMemberStub();

            typeMember.SetTypeInfo(typeInfo);
            directBaseClasses.Add(typeMember);
            return(typeMember);
        }
Beispiel #4
0
 public SbTypeStub(string name, TypeFlags typeFlags, SbType pointeeType = null)
 {
     this.name          = name;
     this.typeFlags     = typeFlags;
     directBaseClasses  = new List <SbTypeMember>();
     this.canonicalType = this;
     this.pointeeType   = pointeeType;
 }
 internal static GrpcSbType CreateType(SbType sbType, long id) =>
 new GrpcSbType
 {
     Id    = id,
     Flags = (uint)sbType.GetTypeFlags(),
     Name  = sbType.GetName() ?? "",
     NumberOfDirectBaseClasses = sbType.GetNumberOfDirectBaseClasses(),
 };
        public override Task <GetByteSizeResponse> GetByteSize(GetByteSizeRequest request,
                                                               ServerCallContext context)
        {
            SbType type = typeStore.GetObject(request.Type.Id);

            return(Task.FromResult(new GetByteSizeResponse {
                ByteSize = type.GetByteSize()
            }));
        }
        public RemoteValue CreateValueFromAddress(string name, ulong address, SbType type)
        {
            if (valuesForAddress.TryGetValue(address, out RemoteValue value))
            {
                return(new RemoteValueNameDecorator(value, name));
            }

            var remoteValueError = new RemoteValueFake("", "");

            remoteValueError.SetError(new SbErrorStub(false, "invalid"));
            return(remoteValueError);
        }
        public override Task <GetPointeeTypeResponse> GetPointeeType(GetPointeeTypeRequest request,
                                                                     ServerCallContext context)
        {
            SbType type        = typeStore.GetObject(request.Type.Id);
            SbType pointeeType = type.GetPointeeType();
            var    response    = new GetPointeeTypeResponse();

            if (pointeeType != null)
            {
                response.Type =
                    GrpcFactoryUtils.CreateType(pointeeType, typeStore.AddObject(pointeeType));
            }
            return(Task.FromResult(response));
        }
Beispiel #9
0
        public RemoteValue CreateValueFromAddress(string name, ulong address, SbType type)
        {
            CreateValueFromAddressResponse response = null;

            if (connection.InvokeRpc(() => {
                response = client.CreateValueFromAddress(new CreateValueFromAddressRequest {
                    Value = grpcSbValue, Name = name, Address = address,
                    Type = new GrpcSbType {
                        Id = type.GetId()
                    }
                });
            }))
            {
                if (response.ExpressionResult != null && response.ExpressionResult.Id != 0)
                {
                    return(valueFactory.Create(connection, response.ExpressionResult));
                }
            }
            return(null);
        }
Beispiel #10
0
        internal CachedValue(RemoteValue remoteProxy, RemoteValue addressOf, SbType typeInfo,
                             string expressionPath, bool hasExpressionPath, uint numChildren, string summary,
                             string typeName, string value, ValueType valueType, bool isPointerType,
                             ValueFormat valueFormat, ulong byteSize)
        {
            this.remoteProxy       = remoteProxy;
            this.addressOf         = addressOf;
            this.typeInfo          = typeInfo;
            this.expressionPath    = expressionPath;
            this.hasExpressionPath = hasExpressionPath;
            this.numChildren       = numChildren;
            this.summary           = summary;
            this.typeName          = typeName;
            this.value             = value;
            this.valueType         = valueType;
            this.isPointerType     = isPointerType;
            this.valueFormat       = valueFormat;
            this.byteSize          = byteSize;

            // These values are prefeteched by remoteProxy.
            error = remoteProxy.GetError();
            name  = remoteProxy.GetName();
        }
Beispiel #11
0
        public IEnumerable <string> GetAllInheritedTypes()
        {
            SbType typeInfo = _remoteValue.GetTypeInfo();

            if (typeInfo == null)
            {
                yield break;
            }

            TypeFlags typeFlags = typeInfo.GetTypeFlags();

            if (typeFlags.HasFlag(TypeFlags.IS_POINTER) ||
                typeFlags.HasFlag(TypeFlags.IS_REFERENCE))
            {
                typeInfo = typeInfo.GetPointeeType();
                if (typeInfo == null)
                {
                    yield break;
                }
            }

            var typeQueue = new Queue <SbType>();

            typeQueue.Enqueue(typeInfo);

            while (typeQueue.Count > 0)
            {
                SbType curType = typeQueue.Dequeue();
                yield return(curType.GetName());

                uint numDirectBaseClasses = curType.GetNumberOfDirectBaseClasses();
                for (uint i = 0; i < numDirectBaseClasses; i++)
                {
                    typeQueue.Enqueue(curType.GetDirectBaseClassAtIndex(i).GetTypeInfo());
                }
            }
        }
Beispiel #12
0
 public void SetCanonicalType(SbType t) => canonicalType = t;
 public void SetTypeInfo(SbType sbType)
 {
     this.sbType = sbType;
 }
Beispiel #14
0
 public RemoteValue CreateValueFromAddress(string name, ulong address, SbType type) =>
 remoteProxy.CreateValueFromAddress(name, address, type);
Beispiel #15
0
 public RemoteValue CreateValueFromAddress(string name, ulong address, SbType type)
 {
     return(_valueFactory.Create(_sbValue.CreateValueFromAddress(name, address, type)));
 }
 public virtual RemoteValue CreateValueFromAddress(
     string name, ulong address, SbType type) => value.CreateValueFromAddress(name, address,
                                                                              type);