/// <summary>
        /// Get the variable assignment expression as a string. Returns null if the value is
        /// constant or invalid.
        /// </summary>
        public static string GetVariableAssignExpression(this RemoteValue remoteValue)
        {
            var valueType = remoteValue.GetValueType();

            if (valueType == ValueType.Invalid)
            {
                return(null);
            }

            if (valueType == ValueType.Register)
            {
                return($"${remoteValue.GetName()}");
            }

            TypeFlags?typeFlags = remoteValue.GetTypeInfo()?.GetTypeFlags();

            if (typeFlags.HasValue && typeFlags.Value.HasFlag(TypeFlags.IS_ARRAY))
            {
                return(null);
            }

            string variableExpression = remoteValue.GetFullName();

            if (variableExpression == null)
            {
                variableExpression = remoteValue.GetMemoryAddressAssignExpression();
            }
            return(variableExpression);
        }
 internal static GrpcSbValue CreateValue(RemoteValue remoteValue, long id) =>
 new GrpcSbValue
 {
     Id    = id,
     Name  = remoteValue.GetName() ?? "",
     Error = CreateError(remoteValue.GetError())
 };
Beispiel #3
0
        public void SetUp()
        {
            mockFrame = Substitute.For <RemoteFrame>();

            var childAdapterFactory = new RemoteValueChildAdapter.Factory();
            var varInfoFactory      = new LLDBVariableInformationFactory(childAdapterFactory);
            var varInfoBuilder      = new VarInfoBuilder(varInfoFactory);

            varInfoFactory.SetVarInfoBuilder(varInfoBuilder);
            var registerSetsBuilderFactory = new RegisterSetsBuilder.Factory(varInfoFactory);

            registerSetsBuilder = registerSetsBuilderFactory.Create(mockFrame);

            generalPurposeRegisters = Substitute.For <RemoteValue>();
            generalPurposeRegisters.GetName().Returns("General Purpose Registers");
            generalPurposeRegisters.GetNumChildren().Returns(0u);

            floatingPointRegisters = Substitute.For <RemoteValue>();
            floatingPointRegisters.GetName().Returns("Floating Point Registers");
            floatingPointRegisters.GetNumChildren().Returns(3u);
            xmm0 = Substitute.For <RemoteValue>();
            xmm0.GetName().Returns("xmm0");
            xmm8 = Substitute.For <RemoteValue>();
            xmm8.GetName().Returns("xmm8");
            other = Substitute.For <RemoteValue>();
            other.GetName().Returns("other");
            floatingPointRegisters.GetChildren(0, 3).Returns(
                new List <RemoteValue>()
            {
                xmm0, xmm8, other
            });
        }
Beispiel #4
0
 public virtual IVariableInformation Create(
     RemoteValue remoteValue, string displayName = null,
     FormatSpecifier formatSpecifier             = null,
     CustomVisualizer customVisualizer           =
     CustomVisualizer
     .None) => new RemoteValueVariableInformation(_varInfoBuilder,
                                                  formatSpecifier != null
                                                              ? formatSpecifier.Expression
                                                              : string.Empty,
                                                  RemoteValueFormatProvider.Get(
                                                      formatSpecifier?.Expression,
                                                      formatSpecifier?.Size),
                                                  ValueFormat.Default, remoteValue,
                                                  displayName
                                                  ?? remoteValue.GetName(),
                                                  customVisualizer,
                                                  _childAdapterFactory);
Beispiel #5
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 #6
0
 public string Fullname() => _remoteValue.GetValueType() == DebuggerApi.ValueType.Register
     ? $"{ExpressionConstants.RegisterPrefix}{_remoteValue.GetName()}"
     : _remoteValue.GetFullName();
 IVariableInformation CreateVarInfo(RemoteValue remoteValue, string formatSpecifier) =>
 _compRoot.GetVariableInformationFactory().Create(remoteValue, remoteValue.GetName(),
                                                  new FormatSpecifier(formatSpecifier));
 public virtual string GetName()
 {
     return(value.GetName());
 }