/// <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);
        }
Пример #2
0
        private GrpcValueInfo CreateValueInfoAndUpdateStores(RemoteValue remoteValue)
        {
            if (remoteValue == null)
            {
                return(null);
            }

            string expressionPath;
            var    hasExpressionPath = remoteValue.GetExpressionPath(out expressionPath);
            var    valueInfo         = new GrpcValueInfo
            {
                ExpressionPath    = expressionPath ?? "",
                HasExpressionPath = hasExpressionPath,
                NumChildren       = remoteValue.GetNumChildren(),
                Summary           = remoteValue.GetSummary() ?? "",
                TypeName          = remoteValue.GetTypeName() ?? "",
                Value             = remoteValue.GetValue() ?? "",
                ValueType         = EnumUtil.ConvertTo <Debugger.Common.ValueType>(
                    remoteValue.GetValueType()),
                IsPointerType = remoteValue.TypeIsPointerType(),
                ByteSize      = remoteValue.GetByteSize(),
            };
            var typeInfo = remoteValue.GetTypeInfo();

            if (typeInfo != null)
            {
                valueInfo.Type = GrpcFactoryUtils.CreateType(
                    typeInfo, typeStore.AddObject(typeInfo));
            }
            return(valueInfo);
        }
        public virtual string FormatValue(RemoteValue remoteValue, ValueFormat fallbackValueFormat)
        {
            string displayValue = remoteValue.GetDisplayValue(GetValueFormat(fallbackValueFormat));

            // TODO: Remove trailing zeros from ST registers summary.
            if (remoteValue.GetValueType() == ValueType.Register &&
                remoteValue.GetTypeName().Contains("ext_vector_type"))
            {
                // Ensure consistency across all the registers presented as vectors.
                return(TrySwitchFromParenthesesToBrackets(displayValue));
            }
            return(displayValue);
        }
 public string GetValueForAssignment(
     RemoteValue remoteValue, ValueFormat fallbackValueFormat)
 => remoteValue.GetValueType() == ValueType.Register ?
 FormatValue(remoteValue, fallbackValueFormat) :
 remoteValue.GetValue(GetValueFormat(fallbackValueFormat));
Пример #5
0
 public string Fullname() => _remoteValue.GetValueType() == DebuggerApi.ValueType.Register
     ? $"{ExpressionConstants.RegisterPrefix}{_remoteValue.GetName()}"
     : _remoteValue.GetFullName();
Пример #6
0
 public virtual DebuggerApi.ValueType GetValueType()
 {
     return(value.GetValueType());
 }