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); }
/// <summary> /// Returns |remoteValue|'s summary if present and its value otherwise, formatted using /// |valueFormat|. /// </summary> public static string GetDisplayValue(this RemoteValue remoteValue, ValueFormat valueFormat) { var strValue = remoteValue.GetSummary(valueFormat); if (!string.IsNullOrEmpty(strValue)) { return(TryConvertToUtf8(strValue)); } return(remoteValue.GetValue(valueFormat)); }
void UpdateFormat(ValueFormat format) { // Changing the format may cause the value/summary to change, so update their content. if (valueFormat != format) { valueFormat = format; value = remoteProxy.GetValue(format); summary = remoteProxy.GetSummary(format); } }
async Task <uint> EvaluateSizeSpecifierExpressionAsync(string expression) { RemoteValue value = await CreateValueFromExpressionAsync(expression); var err = value.GetError(); if (err.Fail()) { throw new ExpressionEvaluationFailed(err.GetCString()); } if (!uint.TryParse(value.GetValue(ValueFormat.Default), out uint size)) { throw new ExpressionEvaluationFailed("Expression isn't a uint"); } return(size); }
/// <summary> /// Similar to base.FormatValue(), but removes the prefix for hex and binary integers. /// </summary> public override string FormatValue(RemoteValue remoteValue, ValueFormat fallbackValueFormat) { ValueFormat valueFormat = GetValueFormat(fallbackValueFormat); string summary = remoteValue.GetSummary(valueFormat); if (!string.IsNullOrEmpty(summary)) { return(summary); } string value = remoteValue.GetValue(valueFormat); if (value.StartsWith("0x") || value.StartsWith("0b")) { return(value.Substring(2)); } return(value); }
public bool IsNullPointer() { // Strip the hex prefix if it is present. // Be sure to use ValueFormat.Default here, just in case. string hexValue = _remoteValue.GetValue(ValueFormat.Default); if (hexValue.StartsWith("0x") || hexValue.StartsWith("0X")) { hexValue = hexValue.Substring(2); } int intVal; if (!int.TryParse(hexValue, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out intVal)) { return(false); } return(intVal == 0 && IsPointer); }
public string GetValueForAssignment( RemoteValue remoteValue, ValueFormat fallbackValueFormat) => remoteValue.GetValueType() == ValueType.Register ? FormatValue(remoteValue, fallbackValueFormat) : remoteValue.GetValue(GetValueFormat(fallbackValueFormat));
/// <summary> /// Calls GetValue() with ValueFormat.Default as format. /// Useful for tests if you don't care about special formatting (e.g. hex). /// </summary> public static string GetDefaultValue(this RemoteValue remoteValue) { return(remoteValue.GetValue(ValueFormat.Default)); }
public virtual string GetValue(ValueFormat format) { return(value.GetValue(format)); }