public EvalResultDataItem( string name, Type typeDeclaringMember, Type declaredType, DkmClrValue value, Expansion expansion, bool childShouldParenthesize, string fullName, string childFullNamePrefixOpt, ReadOnlyCollection <string> formatSpecifiers, DkmEvaluationResultCategory category, DkmEvaluationResultFlags flags, string editableValue) { Debug.Assert(formatSpecifiers != null); Debug.Assert((flags & DkmEvaluationResultFlags.Expandable) == 0); this.NameOpt = name; this.TypeDeclaringMember = typeDeclaringMember; this.DeclaredType = declaredType; this.Value = value; this.ChildShouldParenthesize = childShouldParenthesize; this.FullNameWithoutFormatSpecifiers = fullName; this.ChildFullNamePrefix = childFullNamePrefixOpt; this.FormatSpecifiers = formatSpecifiers; this.Category = category; this.EditableValue = editableValue; this.Flags = flags | GetFlags(value) | ((expansion == null) ? DkmEvaluationResultFlags.None : DkmEvaluationResultFlags.Expandable); this.Expansion = expansion; }
private DkmSuccessEvaluationResult( DkmInspectionContext inspectionContext, DkmStackWalkFrame stackFrame, string name, string fullName, DkmEvaluationResultFlags flags, string value, string editableValue, string type, DkmEvaluationResultCategory category, DkmEvaluationResultAccessType access, DkmEvaluationResultStorageType storageType, DkmEvaluationResultTypeModifierFlags typeModifierFlags, DkmDataAddress address, ReadOnlyCollection<DkmCustomUIVisualizerInfo> customUIVisualizers, ReadOnlyCollection<DkmModuleInstance> externalModules, DkmDataItem dataItem) : base(inspectionContext, stackFrame, name, fullName, flags, type, dataItem) { this.Value = value; this.EditableValue = editableValue; this.Category = category; this.Access = access; this.StorageType = storageType; this.TypeModifierFlags = typeModifierFlags; this.CustomUIVisualizers = customUIVisualizers; }
internal DkmClrValue( object value, object hostObjectValue, DkmClrType type, string alias, IDkmClrFormatter formatter, DkmEvaluationResultFlags evalFlags, DkmClrValueFlags valueFlags, DkmEvaluationResultCategory category = default(DkmEvaluationResultCategory), DkmEvaluationResultAccessType access = default(DkmEvaluationResultAccessType), ulong nativeComPointer = 0) { Debug.Assert(!type.GetLmrType().IsTypeVariables() || (valueFlags == DkmClrValueFlags.Synthetic)); Debug.Assert((alias == null) || evalFlags.Includes(DkmEvaluationResultFlags.HasObjectId)); // The "real" DkmClrValue will always have a value of zero for null pointers. Debug.Assert(!type.GetLmrType().IsPointer || (value != null)); this.RawValue = value; this.HostObjectValue = hostObjectValue; this.Type = type; _formatter = formatter; this.Alias = alias; this.EvalFlags = evalFlags; this.ValueFlags = valueFlags; this.Category = category; this.Access = access; this.NativeComPointer = nativeComPointer; }
internal DkmClrValue( object value, object hostObjectValue, DkmClrType type, string alias, DkmEvaluationResultFlags evalFlags, DkmClrValueFlags valueFlags, DkmEvaluationResultCategory category = default(DkmEvaluationResultCategory), DkmEvaluationResultAccessType access = default(DkmEvaluationResultAccessType), ulong nativeComPointer = 0) { Debug.Assert((type == null) || !type.GetLmrType().IsTypeVariables() || (valueFlags == DkmClrValueFlags.Synthetic)); Debug.Assert((alias == null) || evalFlags.Includes(DkmEvaluationResultFlags.HasObjectId)); // The "real" DkmClrValue will always have a value of zero for null pointers. Debug.Assert((type == null) || !type.GetLmrType().IsPointer || (value != null)); this.RawValue = value; this.HostObjectValue = hostObjectValue; this.Type = type; this.Alias = alias; this.EvalFlags = evalFlags; this.ValueFlags = valueFlags; this.Category = category; this.Access = access; this.NativeComPointer = nativeComPointer; }
private DebuggerTypeProxyExpansion( DkmInspectionContext inspectionContext, DkmClrValue proxyValue, string name, Type typeDeclaringMemberOpt, Type declaredType, DkmClrValue value, bool childShouldParenthesize, string fullName, string childFullNamePrefix, ReadOnlyCollection <string> formatSpecifiers, DkmEvaluationResultFlags flags, string editableValue, Formatter formatter) { Debug.Assert(proxyValue != null); var proxyType = proxyValue.Type.GetLmrType(); var proxyMembers = MemberExpansion.CreateExpansion( inspectionContext, proxyType, proxyValue, ExpansionFlags.IncludeBaseMembers, TypeHelpers.IsPublic, formatter); if (proxyMembers != null) { var proxyMemberFullNamePrefix = (childFullNamePrefix == null) ? null : formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyType, escapeKeywordIdentifiers: true), childFullNamePrefix); _proxyItem = new EvalResultDataItem( ExpansionKind.Default, name: string.Empty, typeDeclaringMember: null, declaredType: proxyType, parent: null, value: proxyValue, displayValue: null, expansion: proxyMembers, childShouldParenthesize: false, fullName: null, childFullNamePrefixOpt: proxyMemberFullNamePrefix, formatSpecifiers: Formatter.NoFormatSpecifiers, category: default(DkmEvaluationResultCategory), flags: default(DkmEvaluationResultFlags), editableValue: null, inspectionContext: inspectionContext); } _name = name; _typeDeclaringMemberOpt = typeDeclaringMemberOpt; _declaredType = declaredType; _value = value; _childShouldParenthesize = childShouldParenthesize; _fullName = fullName; _childFullNamePrefix = childFullNamePrefix; _formatSpecifiers = formatSpecifiers; _flags = flags; _editableValue = editableValue; }
internal static DkmEvaluationResult EvalResult( string name, string value, string type, string fullName, DkmEvaluationResultFlags flags = DkmEvaluationResultFlags.None, DkmEvaluationResultCategory category = UnspecifiedCategory, DkmEvaluationResultAccessType access = UnspecifiedAccessType, string editableValue = null, DkmCustomUIVisualizerInfo[] customUIVisualizerInfo = null) { return(DkmSuccessEvaluationResult.Create( null, null, name, fullName, flags, value, editableValue, type, category, access, default(DkmEvaluationResultStorageType), default(DkmEvaluationResultTypeModifierFlags), null, (customUIVisualizerInfo != null) ? new ReadOnlyCollection <DkmCustomUIVisualizerInfo>(customUIVisualizerInfo) : null, null, null)); }
public EvalResultDataItem( string name, Type typeDeclaringMember, Type declaredType, DkmClrValue value, Expansion expansion, bool childShouldParenthesize, string fullName, string childFullNamePrefixOpt, ReadOnlyCollection<string> formatSpecifiers, DkmEvaluationResultCategory category, DkmEvaluationResultFlags flags, string editableValue) { Debug.Assert(formatSpecifiers != null); Debug.Assert((flags & DkmEvaluationResultFlags.Expandable) == 0); this.NameOpt = name; this.TypeDeclaringMember = typeDeclaringMember; this.DeclaredType = declaredType; this.Value = value; this.ChildShouldParenthesize = childShouldParenthesize; this.FullNameWithoutFormatSpecifiers = fullName; this.ChildFullNamePrefix = childFullNamePrefixOpt; this.FormatSpecifiers = formatSpecifiers; this.Category = category; this.EditableValue = editableValue; this.Flags = flags | GetFlags(value) | ((expansion == null) ? DkmEvaluationResultFlags.None : DkmEvaluationResultFlags.Expandable); this.Expansion = expansion; }
private DkmSuccessEvaluationResult( DkmInspectionContext inspectionContext, DkmStackWalkFrame stackFrame, string name, string fullName, DkmEvaluationResultFlags flags, string value, string editableValue, string type, DkmEvaluationResultCategory category, DkmEvaluationResultAccessType access, DkmEvaluationResultStorageType storageType, DkmEvaluationResultTypeModifierFlags typeModifierFlags, DkmDataAddress address, ReadOnlyCollection <DkmCustomUIVisualizerInfo> customUIVisualizers, ReadOnlyCollection <DkmModuleInstance> externalModules, DkmDataItem dataItem) : base(inspectionContext, stackFrame, name, fullName, flags, type, dataItem) { this.Value = value; this.EditableValue = editableValue; this.Category = category; this.Access = access; this.StorageType = storageType; this.TypeModifierFlags = typeModifierFlags; this.CustomUIVisualizers = customUIVisualizers; }
public static bool Includes( this DkmEvaluationResultFlags flags, DkmEvaluationResultFlags desired ) { return((flags & desired) == desired); }
private DkmFailedEvaluationResult( DkmInspectionContext inspectionContext, DkmStackWalkFrame stackFrame, string name, string fullName, string errorMessage, DkmEvaluationResultFlags flags, string type, DkmDataItem dataItem) : base(inspectionContext, stackFrame, name, fullName, flags, type, dataItem) { this.ErrorMessage = errorMessage; }
private DkmFailedEvaluationResult( DkmInspectionContext inspectionContext, DkmStackWalkFrame stackFrame, string name, string fullName, string errorMessage, DkmEvaluationResultFlags flags, string type, DkmDataItem dataItem) : base(inspectionContext, stackFrame, name, fullName, flags, type, dataItem) { this.ErrorMessage = errorMessage; }
public EvalResult( ExpansionKind kind, string name, TypeAndCustomInfo typeDeclaringMemberAndInfo, TypeAndCustomInfo declaredTypeAndInfo, bool useDebuggerDisplay, DkmClrValue value, string displayValue, Expansion expansion, bool childShouldParenthesize, string fullName, string childFullNamePrefixOpt, ReadOnlyCollection <string> formatSpecifiers, DkmEvaluationResultCategory category, DkmEvaluationResultFlags flags, string editableValue, DkmInspectionContext inspectionContext, string displayName = null, string displayType = null, bool canFavorite = false, bool isFavorite = false ) { Debug.Assert(name != null); Debug.Assert(formatSpecifiers != null); Debug.Assert((flags & DkmEvaluationResultFlags.Expandable) == 0); m_rawFlags = flags; this.Kind = kind; this.Name = name; this.TypeDeclaringMemberAndInfo = typeDeclaringMemberAndInfo; this.DeclaredTypeAndInfo = declaredTypeAndInfo; this.UseDebuggerDisplay = useDebuggerDisplay; this.Value = value; this.DisplayValue = displayValue; this.ChildShouldParenthesize = childShouldParenthesize; this.FullNameWithoutFormatSpecifiers = fullName; this.ChildFullNamePrefix = childFullNamePrefixOpt; this.FormatSpecifiers = formatSpecifiers; this.Category = category; this.EditableValue = editableValue; this.Flags = flags | GetFlags(value, inspectionContext, expansion, canFavorite, isFavorite); this.Expansion = expansion; this.InspectionContext = inspectionContext; this.DisplayName = displayName; this.DisplayType = displayType; this.CanFavorite = canFavorite; this.IsFavorite = isFavorite; }
internal DkmClrValue CreateDkmClrValue( object value, DkmClrType type, string alias = null, DkmEvaluationResultFlags evalFlags = DkmEvaluationResultFlags.None, DkmClrValueFlags valueFlags = DkmClrValueFlags.None) { return(new DkmClrValue( value, DkmClrValue.GetHostObjectValue(type.GetLmrType(), value), type, alias, _formatter, evalFlags, valueFlags)); }
internal DkmClrValue Instantiate( object[] args, string alias, DkmEvaluationResultFlags evalFlags) { object value = UnderlyingType.Instantiate(args); return(new DkmClrValue( value, DkmClrValue.GetHostObjectValue(_lmrType, value), this, alias: alias, evalFlags: evalFlags, valueFlags: DkmClrValueFlags.None, nativeComPointer: 0)); }
internal static DkmEvaluationResult EvalFailedResult( string name, string message, string type = null, string fullName = null, DkmEvaluationResultFlags flags = DkmEvaluationResultFlags.None) { return(DkmFailedEvaluationResult.Create( null, null, name, fullName, message, flags, type, null)); }
internal DkmClrValue CreateDkmClrValue( object value, DkmClrType type, string alias = null, DkmEvaluationResultFlags evalFlags = DkmEvaluationResultFlags.None, DkmClrValueFlags valueFlags = DkmClrValueFlags.None, ulong nativeComPointer = 0) { return(new DkmClrValue( value, DkmClrValue.GetHostObjectValue(type.GetLmrType(), value), type, alias, evalFlags, valueFlags, nativeComPointer: nativeComPointer)); }
internal DkmClrValue CreateDkmClrValue( object value, Type type = null, string alias = null, DkmEvaluationResultFlags evalFlags = DkmEvaluationResultFlags.None, DkmClrValueFlags valueFlags = DkmClrValueFlags.None) { if (type == null) { type = value.GetType(); } return(new DkmClrValue( value, DkmClrValue.GetHostObjectValue((TypeImpl)type, value), new DkmClrType((TypeImpl)type), alias, evalFlags, valueFlags)); }
public static DkmFailedEvaluationResult Create(DkmInspectionContext InspectionContext, DkmStackWalkFrame StackFrame, string Name, string FullName, string ErrorMessage, DkmEvaluationResultFlags Flags, string Type, DkmDataItem DataItem) { DkmFailedEvaluationResult result = new DkmFailedEvaluationResult { InspectionContext = InspectionContext, Name = Name, FullName = FullName, ErrorMessage = ErrorMessage, Flags = Flags, Type = Type }; if (DataItem != null) { result.SetDataItem(DkmDataCreationDisposition.CreateNew, DataItem); } return result; }
public static DkmFailedEvaluationResult Create( DkmInspectionContext InspectionContext, DkmStackWalkFrame StackFrame, string Name, string FullName, string ErrorMessage, DkmEvaluationResultFlags Flags, string Type, DkmDataItem DataItem) { return new DkmFailedEvaluationResult( InspectionContext, StackFrame, Name, FullName, ErrorMessage, Flags, Type, DataItem); }
public static DkmFailedEvaluationResult Create( DkmInspectionContext InspectionContext, DkmStackWalkFrame StackFrame, string Name, string FullName, string ErrorMessage, DkmEvaluationResultFlags Flags, string Type, DkmDataItem DataItem) { return(new DkmFailedEvaluationResult( InspectionContext, StackFrame, Name, FullName, ErrorMessage, Flags, Type, DataItem)); }
internal DkmEvaluationResult( DkmInspectionContext InspectionContext, DkmStackWalkFrame StackFrame, string Name, string FullName, DkmEvaluationResultFlags Flags, string Type, DkmDataItem DataItem) { this.InspectionContext = InspectionContext; this.StackFrame = StackFrame; this.Name = Name; this.FullName = FullName; this.Flags = Flags; this.Type = Type; if (DataItem != null) { this.SetDataItem(DkmDataCreationDisposition.CreateNew, DataItem); } }
internal DkmEvaluationResult( DkmInspectionContext InspectionContext, DkmStackWalkFrame StackFrame, string Name, string FullName, DkmEvaluationResultFlags Flags, string Type, DkmDataItem DataItem) { this.InspectionContext = InspectionContext; this.StackFrame = StackFrame; this.Name = Name; this.FullName = FullName; this.Flags = Flags; this.Type = Type; if (DataItem != null) { this.SetDataItem(DkmDataCreationDisposition.CreateNew, DataItem); } }
public static DkmSuccessEvaluationResult Create(DkmInspectionContext InspectionContext, DkmStackWalkFrame StackFrame, string Name, string FullName, DkmEvaluationResultFlags Flags, string Value, string EditableValue, string Type, DkmEvaluationResultCategory Category, DkmEvaluationResultAccessType Access, DkmEvaluationResultStorageType StorageType, DkmEvaluationResultTypeModifierFlags TypeModifierFlags, DkmDataAddress Address, ReadOnlyCollection<DkmCustomUIVisualizerInfo> CustomUIVisualizers, ReadOnlyCollection<DkmModuleInstance> ExternalModules, DkmDataItem DataItem) { DkmSuccessEvaluationResult result = new DkmSuccessEvaluationResult { InspectionContext = InspectionContext, Name = Name, FullName = FullName, Flags = Flags, Value = Value, Type = Type, Category = Category, EditableValue = EditableValue, CustomUIVisualizers = CustomUIVisualizers }; if (DataItem != null) { result.SetDataItem(DkmDataCreationDisposition.CreateNew, DataItem); } return result; }
internal DkmClrValue( object value, object hostObjectValue, DkmClrType type, string alias, IDkmClrFormatter formatter, DkmEvaluationResultFlags evalFlags, DkmClrValueFlags valueFlags) { Debug.Assert(!type.GetLmrType().IsTypeVariables() || (valueFlags == DkmClrValueFlags.Synthetic)); Debug.Assert((alias == null) || evalFlags.Includes(DkmEvaluationResultFlags.HasObjectId)); // The "real" DkmClrValue will always have a value of zero for null pointers. Debug.Assert(!type.GetLmrType().IsPointer || (value != null)); _rawValue = value; this.HostObjectValue = hostObjectValue; this.Type = type; _formatter = formatter; this.Alias = alias; this.EvalFlags = evalFlags; this.ValueFlags = valueFlags; }
public EvalResultDataItem( ExpansionKind kind, string name, TypeAndCustomInfo typeDeclaringMemberAndInfo, TypeAndCustomInfo declaredTypeAndInfo, EvalResultDataItem parent, DkmClrValue value, string displayValue, Expansion expansion, bool childShouldParenthesize, string fullName, string childFullNamePrefixOpt, ReadOnlyCollection <string> formatSpecifiers, DkmEvaluationResultCategory category, DkmEvaluationResultFlags flags, string editableValue, DkmInspectionContext inspectionContext) { Debug.Assert(name != null); Debug.Assert(formatSpecifiers != null); Debug.Assert((flags & DkmEvaluationResultFlags.Expandable) == 0); this.Kind = kind; this.Name = name; this.TypeDeclaringMemberAndInfo = typeDeclaringMemberAndInfo; this.DeclaredTypeAndInfo = declaredTypeAndInfo; this.Parent = parent; this.Value = value; this.DisplayValue = displayValue; this.ChildShouldParenthesize = childShouldParenthesize; this.FullNameWithoutFormatSpecifiers = fullName; this.ChildFullNamePrefix = childFullNamePrefixOpt; this.FormatSpecifiers = formatSpecifiers; this.Category = category; this.EditableValue = editableValue; this.Flags = flags | GetFlags(value, inspectionContext) | ((expansion == null) ? DkmEvaluationResultFlags.None : DkmEvaluationResultFlags.Expandable); this.Expansion = expansion; }
public static DkmSuccessEvaluationResult Create( DkmInspectionContext InspectionContext, DkmStackWalkFrame StackFrame, string Name, string FullName, DkmEvaluationResultFlags Flags, string Value, string EditableValue, string Type, DkmEvaluationResultCategory Category, DkmEvaluationResultAccessType Access, DkmEvaluationResultStorageType StorageType, DkmEvaluationResultTypeModifierFlags TypeModifierFlags, DkmDataAddress Address, ReadOnlyCollection <DkmCustomUIVisualizerInfo> CustomUIVisualizers, ReadOnlyCollection <DkmModuleInstance> ExternalModules, DkmDataItem DataItem ) { return(new DkmSuccessEvaluationResult( InspectionContext, StackFrame, Name, FullName, Flags, Value, EditableValue, Type, Category, Access, StorageType, TypeModifierFlags, Address, CustomUIVisualizers, ExternalModules, DataItem )); }
public static DkmSuccessEvaluationResult Create( DkmInspectionContext InspectionContext, DkmStackWalkFrame StackFrame, string Name, string FullName, DkmEvaluationResultFlags Flags, string Value, string EditableValue, string Type, DkmEvaluationResultCategory Category, DkmEvaluationResultAccessType Access, DkmEvaluationResultStorageType StorageType, DkmEvaluationResultTypeModifierFlags TypeModifierFlags, DkmDataAddress Address, ReadOnlyCollection<DkmCustomUIVisualizerInfo> CustomUIVisualizers, ReadOnlyCollection<DkmModuleInstance> ExternalModules, DkmDataItem DataItem) { return new DkmSuccessEvaluationResult( InspectionContext, StackFrame, Name, FullName, Flags, Value, EditableValue, Type, Category, Access, StorageType, TypeModifierFlags, Address, CustomUIVisualizers, ExternalModules, DataItem); }
internal DkmClrValue( object value, object hostObjectValue, DkmClrType type, string alias, IDkmClrFormatter formatter, DkmEvaluationResultFlags evalFlags, DkmClrValueFlags valueFlags, DkmInspectionContext inspectionContext) { Debug.Assert(!type.GetLmrType().IsTypeVariables() || (valueFlags == DkmClrValueFlags.Synthetic)); Debug.Assert((alias == null) || evalFlags.Includes(DkmEvaluationResultFlags.HasObjectId)); // The "real" DkmClrValue will always have a value of zero for null pointers. Debug.Assert(!type.GetLmrType().IsPointer || (value != null)); _rawValue = value; this.HostObjectValue = hostObjectValue; this.Type = type; _formatter = formatter; this.Alias = alias; this.EvalFlags = evalFlags; this.ValueFlags = valueFlags; this.InspectionContext = inspectionContext ?? new DkmInspectionContext(formatter, DkmEvaluationFlags.None, 10); }
internal DkmClrValue Instantiate( object[] args, string alias, DkmEvaluationResultFlags evalFlags) { object value = UnderlyingType.Instantiate(args); return new DkmClrValue( value, DkmClrValue.GetHostObjectValue(_lmrType, value), this, alias: alias, evalFlags: evalFlags, valueFlags: DkmClrValueFlags.None, nativeComPointer: 0); }
internal EvalResult CreateDataItem( DkmInspectionContext inspectionContext, string name, TypeAndCustomInfo typeDeclaringMemberAndInfo, TypeAndCustomInfo declaredTypeAndInfo, DkmClrValue value, bool useDebuggerDisplay, ExpansionFlags expansionFlags, bool childShouldParenthesize, string fullName, ReadOnlyCollection <string> formatSpecifiers, DkmEvaluationResultCategory category, DkmEvaluationResultFlags flags, DkmEvaluationFlags evalFlags) { if ((evalFlags & DkmEvaluationFlags.ShowValueRaw) != 0) { formatSpecifiers = Formatter.AddFormatSpecifier(formatSpecifiers, "raw"); } Expansion expansion; // If the declared type is Nullable<T>, the value should // have no expansion if null, or be expanded as a T. var declaredType = declaredTypeAndInfo.Type; var lmrNullableTypeArg = declaredType.GetNullableTypeArgument(); if (lmrNullableTypeArg != null && !value.HasExceptionThrown()) { Debug.Assert(value.Type.GetProxyType() == null); DkmClrValue nullableValue; if (value.IsError()) { expansion = null; } else if ((nullableValue = value.GetNullableValue(lmrNullableTypeArg, inspectionContext)) == null) { Debug.Assert(declaredType.Equals(value.Type.GetLmrType())); // No expansion of "null". expansion = null; } else { value = nullableValue; Debug.Assert(lmrNullableTypeArg.Equals(value.Type.GetLmrType())); // If this is not the case, add a test for includeRuntimeTypeIfNecessary. // CONSIDER: The DynamicAttribute for the type argument should just be Skip(1) of the original flag array. expansion = this.GetTypeExpansion(inspectionContext, new TypeAndCustomInfo(DkmClrType.Create(declaredTypeAndInfo.ClrType.AppDomain, lmrNullableTypeArg)), value, ExpansionFlags.IncludeResultsView); } } else if (value.IsError() || (inspectionContext.EvaluationFlags & DkmEvaluationFlags.NoExpansion) != 0) { expansion = null; } else { expansion = DebuggerTypeProxyExpansion.CreateExpansion( this, inspectionContext, name, typeDeclaringMemberAndInfo, declaredTypeAndInfo, value, childShouldParenthesize, fullName, flags.Includes(DkmEvaluationResultFlags.ExceptionThrown) ? null : fullName, formatSpecifiers, flags, Formatter2.GetEditableValueString(value, inspectionContext, declaredTypeAndInfo.Info)); if (expansion == null) { expansion = value.HasExceptionThrown() ? this.GetTypeExpansion(inspectionContext, new TypeAndCustomInfo(value.Type), value, expansionFlags) : this.GetTypeExpansion(inspectionContext, declaredTypeAndInfo, value, expansionFlags); } } return(new EvalResult( ExpansionKind.Default, name, typeDeclaringMemberAndInfo, declaredTypeAndInfo, useDebuggerDisplay: useDebuggerDisplay, value: value, displayValue: null, expansion: expansion, childShouldParenthesize: childShouldParenthesize, fullName: fullName, childFullNamePrefixOpt: flags.Includes(DkmEvaluationResultFlags.ExceptionThrown) ? null : fullName, formatSpecifiers: formatSpecifiers, category: category, flags: flags, editableValue: Formatter2.GetEditableValueString(value, inspectionContext, declaredTypeAndInfo.Info), inspectionContext: inspectionContext)); }
public static bool Includes(this DkmEvaluationResultFlags flags, DkmEvaluationResultFlags desired) { return (flags & desired) == desired; }
internal EvalResultDataItem CreateDataItem( DkmInspectionContext inspectionContext, string name, TypeAndCustomInfo typeDeclaringMemberAndInfo, TypeAndCustomInfo declaredTypeAndInfo, DkmClrValue value, EvalResultDataItem parent, ExpansionFlags expansionFlags, bool childShouldParenthesize, string fullName, ReadOnlyCollection<string> formatSpecifiers, DkmEvaluationResultCategory category, DkmEvaluationResultFlags flags, DkmEvaluationFlags evalFlags) { if ((evalFlags & DkmEvaluationFlags.ShowValueRaw) != 0) { formatSpecifiers = Formatter.AddFormatSpecifier(formatSpecifiers, "raw"); } Expansion expansion; // If the declared type is Nullable<T>, the value should // have no expansion if null, or be expanded as a T. var declaredType = declaredTypeAndInfo.Type; var lmrNullableTypeArg = declaredType.GetNullableTypeArgument(); if (lmrNullableTypeArg != null && !value.HasExceptionThrown()) { Debug.Assert(value.Type.GetProxyType() == null); DkmClrValue nullableValue; if (value.IsError()) { expansion = null; } else if ((nullableValue = value.GetNullableValue(inspectionContext)) == null) { Debug.Assert(declaredType.Equals(value.Type.GetLmrType())); // No expansion of "null". expansion = null; } else { value = nullableValue; Debug.Assert(lmrNullableTypeArg.Equals(value.Type.GetLmrType())); // If this is not the case, add a test for includeRuntimeTypeIfNecessary. // CONSIDER: The DynamicAttribute for the type argument should just be Skip(1) of the original flag array. expansion = this.GetTypeExpansion(inspectionContext, new TypeAndCustomInfo(lmrNullableTypeArg), value, ExpansionFlags.IncludeResultsView); } } else if (value.IsError() || (inspectionContext.EvaluationFlags & DkmEvaluationFlags.NoExpansion) != 0) { expansion = null; } else { expansion = DebuggerTypeProxyExpansion.CreateExpansion( this, inspectionContext, name, typeDeclaringMemberAndInfo, declaredTypeAndInfo, value, childShouldParenthesize, fullName, flags.Includes(DkmEvaluationResultFlags.ExceptionThrown) ? null : fullName, formatSpecifiers, flags, this.Formatter.GetEditableValue(value, inspectionContext)); if (expansion == null) { expansion = value.HasExceptionThrown() ? this.GetTypeExpansion(inspectionContext, new TypeAndCustomInfo(value.Type), value, expansionFlags) : this.GetTypeExpansion(inspectionContext, declaredTypeAndInfo, value, expansionFlags); } } return new EvalResultDataItem( ExpansionKind.Default, name, typeDeclaringMemberAndInfo, declaredTypeAndInfo, parent: parent, value: value, displayValue: null, expansion: expansion, childShouldParenthesize: childShouldParenthesize, fullName: fullName, childFullNamePrefixOpt: flags.Includes(DkmEvaluationResultFlags.ExceptionThrown) ? null : fullName, formatSpecifiers: formatSpecifiers, category: category, flags: flags, editableValue: this.Formatter.GetEditableValue(value, inspectionContext), inspectionContext: inspectionContext); }
private DebuggerTypeProxyExpansion( DkmInspectionContext inspectionContext, DkmClrValue proxyValue, string name, TypeAndCustomInfo typeDeclaringMemberAndInfoOpt, TypeAndCustomInfo declaredTypeAndInfo, DkmClrValue value, bool childShouldParenthesize, string fullName, string childFullNamePrefix, ReadOnlyCollection<string> formatSpecifiers, DkmEvaluationResultFlags flags, string editableValue, Formatter formatter) { Debug.Assert(proxyValue != null); var proxyType = proxyValue.Type.GetLmrType(); var proxyTypeAndInfo = new TypeAndCustomInfo(proxyType); var proxyMembers = MemberExpansion.CreateExpansion( inspectionContext, proxyTypeAndInfo, proxyValue, ExpansionFlags.IncludeBaseMembers, TypeHelpers.IsPublic, formatter); if (proxyMembers != null) { var proxyMemberFullNamePrefix = (childFullNamePrefix == null) ? null : formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyTypeAndInfo, escapeKeywordIdentifiers: true), childFullNamePrefix); _proxyItem = new EvalResultDataItem( ExpansionKind.Default, name: string.Empty, typeDeclaringMemberAndInfo: default(TypeAndCustomInfo), declaredTypeAndInfo: proxyTypeAndInfo, parent: null, value: proxyValue, displayValue: null, expansion: proxyMembers, childShouldParenthesize: false, fullName: null, childFullNamePrefixOpt: proxyMemberFullNamePrefix, formatSpecifiers: Formatter.NoFormatSpecifiers, category: default(DkmEvaluationResultCategory), flags: default(DkmEvaluationResultFlags), editableValue: null, inspectionContext: inspectionContext); } _name = name; _typeDeclaringMemberAndInfoOpt = typeDeclaringMemberAndInfoOpt; _declaredTypeAndInfo = declaredTypeAndInfo; _value = value; _childShouldParenthesize = childShouldParenthesize; _fullName = fullName; _childFullNamePrefix = childFullNamePrefix; _formatSpecifiers = formatSpecifiers; _flags = flags; _editableValue = editableValue; }
internal static DkmEvaluationResult GetTableChildAtIndex(DkmInspectionContext inspectionContext, DkmStackWalkFrame stackFrame, string fullName, LuaTableData value, int index) { if (value == null) { return(DkmFailedEvaluationResult.Create(inspectionContext, stackFrame, $"[{index + 1}]", $"{fullName}[{index + 1}]", "Table data is missing", DkmEvaluationResultFlags.Invalid, null)); } var process = stackFrame.Process; var arrayElementCount = value.GetArrayElementCount(process); if (index < arrayElementCount) { var arrayElements = value.GetArrayElements(process); var element = arrayElements[index]; return(EvaluateDataAtLuaValue(inspectionContext, stackFrame, $"[{index + 1}]", $"{fullName}[{index + 1}]", element, DkmEvaluationResultFlags.None, DkmEvaluationResultAccessType.None, DkmEvaluationResultStorageType.None)); } index = index - arrayElementCount; var nodeElementCount = value.GetNodeElementCount(process); if (index < nodeElementCount) { var lazyNodeElements = value.GetNodeLazyElements(process); var node = lazyNodeElements[index]; var nodeKey = node.LoadKey(process, value.batchNodeElementData); DkmEvaluationResultFlags flags = DkmEvaluationResultFlags.None; string name = EvaluateValueAtLuaValue(process, nodeKey, 10, out _, ref flags, out _, out _); var keyString = nodeKey as LuaValueDataString; if (keyString != null) { name = keyString.value; } if (name == null || name.Length == 0) { name = "%error-name%"; } // Check if name is an identifier bool isIdentifierName = false; if (char.IsLetter(name[0]) || name[0] == '_') { int pos = 1; while (pos < name.Length && (char.IsLetterOrDigit(name[pos]) || name[pos] == '_')) { pos++; } isIdentifierName = pos == name.Length; } if (isIdentifierName) { return(EvaluateDataAtLuaValue(inspectionContext, stackFrame, name, $"{fullName}.{name}", node.LoadValue(process, value.batchNodeElementData), DkmEvaluationResultFlags.None, DkmEvaluationResultAccessType.None, DkmEvaluationResultStorageType.None)); } return(EvaluateDataAtLuaValue(inspectionContext, stackFrame, $"\"{name}\"", $"{fullName}[\"{name}\"]", node.LoadValue(process, value.batchNodeElementData), DkmEvaluationResultFlags.None, DkmEvaluationResultAccessType.None, DkmEvaluationResultStorageType.None)); } index = index - nodeElementCount; if (index == 0 && value.HasMetaTable()) { var metaTableValue = new LuaValueDataTable { baseType = LuaBaseType.Table, extendedType = LuaExtendedType.Table, evaluationFlags = DkmEvaluationResultFlags.ReadOnly, originalAddress = 0, // Not available as TValue value = value.GetMetaTable(process), targetAddress = value.metaTableDataAddress }; return(EvaluateDataAtLuaValue(inspectionContext, stackFrame, "!metatable", $"{fullName}.!metatable", metaTableValue, DkmEvaluationResultFlags.None, DkmEvaluationResultAccessType.None, DkmEvaluationResultStorageType.None)); } Debug.Assert(false, "Invalid child index"); return(null); }
internal static DkmEvaluationResult EvaluateDataAtLuaValue(DkmInspectionContext inspectionContext, DkmStackWalkFrame stackFrame, string name, string fullName, LuaValueDataBase luaValue, DkmEvaluationResultFlags flags, DkmEvaluationResultAccessType access, DkmEvaluationResultStorageType storage) { var process = stackFrame.Process; if (luaValue == null) { return(DkmFailedEvaluationResult.Create(inspectionContext, stackFrame, name, fullName, "Null pointer access", DkmEvaluationResultFlags.Invalid, null)); } string value = EvaluateValueAtLuaValue(process, luaValue, inspectionContext.Radix, out string editableValue, ref flags, out DkmDataAddress dataAddress, out string type); if (value == null) { return(DkmFailedEvaluationResult.Create(inspectionContext, stackFrame, name, fullName, "Failed to read value", DkmEvaluationResultFlags.Invalid, null)); } DkmEvaluationResultCategory category = DkmEvaluationResultCategory.Data; DkmEvaluationResultTypeModifierFlags typeModifiers = DkmEvaluationResultTypeModifierFlags.None; var dataItem = new LuaEvaluationDataItem { address = luaValue.originalAddress, type = type, fullName = fullName, luaValueData = luaValue }; return(DkmSuccessEvaluationResult.Create(inspectionContext, stackFrame, name, fullName, flags, value, editableValue, type, category, access, storage, typeModifiers, dataAddress, null, null, dataItem)); }
internal static string EvaluateValueAtAddress(DkmProcess process, ulong address, uint radix, out string editableValue, ref DkmEvaluationResultFlags flags, out DkmDataAddress dataAddress, out string type, out LuaValueDataBase luaValueData) { editableValue = null; dataAddress = null; type = "unknown"; luaValueData = LuaHelpers.ReadValue(process, address); if (luaValueData == null) { return(null); } return(EvaluateValueAtLuaValue(process, luaValueData, radix, out editableValue, ref flags, out dataAddress, out type)); }
internal static string EvaluateValueAtLuaValue(DkmProcess process, LuaValueDataBase valueBase, uint radix, out string editableValue, ref DkmEvaluationResultFlags flags, out DkmDataAddress dataAddress, out string type) { editableValue = null; dataAddress = null; type = "unknown"; if (valueBase == null) { return(null); } if (valueBase as LuaValueDataNil != null) { type = "nil"; flags |= DkmEvaluationResultFlags.IsBuiltInType | DkmEvaluationResultFlags.ReadOnly; return("nil"); } if (valueBase as LuaValueDataBool != null) { var value = valueBase as LuaValueDataBool; type = "bool"; if (value.value) { flags |= DkmEvaluationResultFlags.IsBuiltInType | DkmEvaluationResultFlags.Boolean | DkmEvaluationResultFlags.BooleanTrue; editableValue = $"{value.value}"; return("true"); } else { flags |= DkmEvaluationResultFlags.IsBuiltInType | DkmEvaluationResultFlags.Boolean; editableValue = $"{value.value}"; return("false"); } } if (valueBase as LuaValueDataLightUserData != null) { var value = valueBase as LuaValueDataLightUserData; type = "user_data"; flags |= DkmEvaluationResultFlags.IsBuiltInType; editableValue = $"{value.value}"; return($"0x{value.value:x}"); } if (valueBase as LuaValueDataNumber != null) { var value = valueBase as LuaValueDataNumber; if (value.extendedType == LuaHelpers.GetIntegerNumberExtendedType()) { type = "int"; flags |= DkmEvaluationResultFlags.IsBuiltInType; editableValue = $"{value.value}"; if (radix == 16) { return($"0x{(int)value.value:x8}"); } return($"{value.value}"); } else { type = "double"; flags |= DkmEvaluationResultFlags.IsBuiltInType; editableValue = $"{value.value}"; return($"{value.value}"); } } if (valueBase as LuaValueDataString != null) { var value = valueBase as LuaValueDataString; type = value.extendedType == LuaExtendedType.ShortString ? "short_string" : "long_string"; flags |= DkmEvaluationResultFlags.IsBuiltInType | DkmEvaluationResultFlags.RawString; editableValue = $"{value.value}"; dataAddress = DkmDataAddress.Create(process.GetNativeRuntimeInstance(), value.targetAddress, null); return($"0x{value.targetAddress:x} \"{value.value}\""); } if (valueBase as LuaValueDataTable != null) { var value = valueBase as LuaValueDataTable; type = "table"; flags |= DkmEvaluationResultFlags.ReadOnly | DkmEvaluationResultFlags.Expandable; var arrayElementCount = value.value.GetArrayElementCount(process); var nodeElementCount = value.value.GetNodeElementCount(process); if (arrayElementCount != 0 && nodeElementCount != 0) { return($"0x{value.targetAddress:x} table [{arrayElementCount} element(s) and {nodeElementCount} key(s)]"); } if (arrayElementCount != 0) { return($"0x{value.targetAddress:x} table [{arrayElementCount} element(s)]"); } if (nodeElementCount != 0) { return($"0x{value.targetAddress:x} table [{nodeElementCount} key(s)]"); } if (!value.value.HasMetaTable()) { flags &= ~DkmEvaluationResultFlags.Expandable; return($"0x{value.targetAddress:x} table [empty]"); } return($"0x{value.targetAddress:x} table"); } if (valueBase as LuaValueDataLuaFunction != null) { var value = valueBase as LuaValueDataLuaFunction; type = "lua_function"; flags |= DkmEvaluationResultFlags.IsBuiltInType | DkmEvaluationResultFlags.ReadOnly | DkmEvaluationResultFlags.Expandable; return($"0x{value.targetAddress:x}"); } if (valueBase as LuaValueDataExternalFunction != null) { var value = valueBase as LuaValueDataExternalFunction; type = "c_function"; flags |= DkmEvaluationResultFlags.IsBuiltInType | DkmEvaluationResultFlags.ReadOnly | DkmEvaluationResultFlags.Expandable; return($"0x{value.targetAddress:x}"); } if (valueBase as LuaValueDataExternalClosure != null) { var value = valueBase as LuaValueDataExternalClosure; type = "c_closure"; flags |= DkmEvaluationResultFlags.IsBuiltInType | DkmEvaluationResultFlags.ReadOnly | DkmEvaluationResultFlags.Expandable; return($"0x{value.targetAddress:x}"); } if (valueBase as LuaValueDataUserData != null) { var value = valueBase as LuaValueDataUserData; type = "user_data"; flags |= DkmEvaluationResultFlags.ReadOnly | DkmEvaluationResultFlags.Expandable; return($"0x{value.targetAddress:x}"); } if (valueBase as LuaValueDataThread != null) { var value = valueBase as LuaValueDataThread; type = "thread"; flags |= DkmEvaluationResultFlags.IsBuiltInType | DkmEvaluationResultFlags.ReadOnly; return($"0x{value.targetAddress:x}"); } return(null); }
internal static Expansion CreateExpansion( ResultProvider resultProvider, DkmInspectionContext inspectionContext, string name, TypeAndCustomInfo typeDeclaringMemberAndInfoOpt, TypeAndCustomInfo declaredTypeAndInfo, DkmClrValue value, bool childShouldParenthesize, string fullName, string childFullNamePrefix, ReadOnlyCollection <string> formatSpecifiers, DkmEvaluationResultFlags flags, string editableValue) { Debug.Assert((inspectionContext.EvaluationFlags & DkmEvaluationFlags.NoExpansion) == 0); // Note: The native EE uses the proxy type, even for // null instances, so statics on the proxy type are // displayed. That case is not supported currently. if (!value.IsNull) { var proxyType = value.Type.GetProxyType(); if (proxyType != null) { if ((inspectionContext.EvaluationFlags & DkmEvaluationFlags.ShowValueRaw) != 0) { var rawView = CreateRawView(resultProvider, inspectionContext, declaredTypeAndInfo, value); Debug.Assert(rawView != null); return(rawView); } DkmClrValue proxyValue; try { proxyValue = value.InstantiateProxyType(inspectionContext, proxyType); } catch { proxyValue = null; } if (proxyValue != null) { return(new DebuggerTypeProxyExpansion( inspectionContext, proxyValue, name, typeDeclaringMemberAndInfoOpt, declaredTypeAndInfo, value, childShouldParenthesize, fullName, childFullNamePrefix, formatSpecifiers, flags, editableValue, resultProvider)); } } } return(null); }
internal EvalResultDataItem CreateDataItem( DkmInspectionContext inspectionContext, string name, Type typeDeclaringMember, Type declaredType, DkmClrValue value, EvalResultDataItem parent, ExpansionFlags expansionFlags, bool childShouldParenthesize, string fullName, ReadOnlyCollection <string> formatSpecifiers, DkmEvaluationResultCategory category, DkmEvaluationResultFlags flags, DkmEvaluationFlags evalFlags) { if ((evalFlags & DkmEvaluationFlags.ShowValueRaw) != 0) { formatSpecifiers = Formatter.AddFormatSpecifier(formatSpecifiers, "raw"); } Expansion expansion; // If the declared type is Nullable<T>, the value should // have no expansion if null, or be expanded as a T. var lmrNullableTypeArg = declaredType.GetNullableTypeArgument(); if (lmrNullableTypeArg != null && !value.HasExceptionThrown(parent)) { Debug.Assert(value.Type.GetProxyType() == null); var nullableValue = value.GetNullableValue(inspectionContext); if (nullableValue == null) { Debug.Assert(declaredType.Equals(value.Type.GetLmrType())); // No expansion of "null". expansion = null; } else { value = nullableValue; Debug.Assert(lmrNullableTypeArg.Equals(value.Type.GetLmrType())); // If this is not the case, add a test for includeRuntimeTypeIfNecessary. expansion = this.GetTypeExpansion(inspectionContext, lmrNullableTypeArg, value, ExpansionFlags.IncludeResultsView); } } else if (value.IsError() || (inspectionContext.EvaluationFlags & DkmEvaluationFlags.NoExpansion) != 0) { expansion = null; } else { expansion = DebuggerTypeProxyExpansion.CreateExpansion( this, inspectionContext, name, typeDeclaringMember, declaredType, value, childShouldParenthesize, fullName, flags.Includes(DkmEvaluationResultFlags.ExceptionThrown) ? null : fullName, formatSpecifiers, flags, this.Formatter.GetEditableValue(value, inspectionContext)); if (expansion == null) { var expansionType = value.HasExceptionThrown(parent) ? value.Type.GetLmrType() : declaredType; expansion = this.GetTypeExpansion(inspectionContext, expansionType, value, expansionFlags); } } return(new EvalResultDataItem( ExpansionKind.Default, name, typeDeclaringMember, declaredType, parent: parent, value: value, displayValue: null, expansion: expansion, childShouldParenthesize: childShouldParenthesize, fullName: fullName, childFullNamePrefixOpt: flags.Includes(DkmEvaluationResultFlags.ExceptionThrown) ? null : fullName, formatSpecifiers: formatSpecifiers, category: category, flags: flags, editableValue: this.Formatter.GetEditableValue(value, inspectionContext), inspectionContext: inspectionContext)); }
public static DkmSuccessEvaluationResult Create(DkmInspectionContext InspectionContext, DkmStackWalkFrame StackFrame, string Name, string FullName, DkmEvaluationResultFlags Flags, string Value, string EditableValue, string Type, DkmEvaluationResultCategory Category, DkmEvaluationResultAccessType Access, DkmEvaluationResultStorageType StorageType, DkmEvaluationResultTypeModifierFlags TypeModifierFlags, DkmDataAddress Address, ReadOnlyCollection <DkmCustomUIVisualizerInfo> CustomUIVisualizers, ReadOnlyCollection <DkmModuleInstance> ExternalModules, DkmDataItem DataItem) { DkmSuccessEvaluationResult result = new DkmSuccessEvaluationResult { InspectionContext = InspectionContext, Name = Name, FullName = FullName, Flags = Flags, Value = Value, Type = Type, Category = Category, EditableValue = EditableValue, CustomUIVisualizers = CustomUIVisualizers }; if (DataItem != null) { result.SetDataItem(DkmDataCreationDisposition.CreateNew, DataItem); } return(result); }
public static DkmFailedEvaluationResult Create(DkmInspectionContext InspectionContext, DkmStackWalkFrame StackFrame, string Name, string FullName, string ErrorMessage, DkmEvaluationResultFlags Flags, string Type, DkmDataItem DataItem) { DkmFailedEvaluationResult result = new DkmFailedEvaluationResult { InspectionContext = InspectionContext, Name = Name, FullName = FullName, ErrorMessage = ErrorMessage, Flags = Flags, Type = Type }; if (DataItem != null) { result.SetDataItem(DkmDataCreationDisposition.CreateNew, DataItem); } return(result); }
private DebuggerTypeProxyExpansion( DkmClrValue proxyValue, string name, Type typeDeclaringMemberOpt, Type declaredType, DkmClrValue value, bool childShouldParenthesize, string fullName, string childFullNamePrefix, ReadOnlyCollection<string> formatSpecifiers, DkmEvaluationResultFlags flags, string editableValue, Formatter formatter) { Debug.Assert(proxyValue != null); var proxyType = proxyValue.Type.GetLmrType(); var proxyMembers = MemberExpansion.CreateExpansion( proxyType, proxyValue, ExpansionFlags.IncludeBaseMembers, TypeHelpers.IsPublic, formatter); if (proxyMembers != null) { var proxyMemberFullNamePrefix = (childFullNamePrefix == null) ? null : formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyType, escapeKeywordIdentifiers: true), childFullNamePrefix); this.proxyItem = new EvalResultDataItem( name: null, typeDeclaringMember: null, declaredType: proxyType, value: proxyValue, expansion: proxyMembers, childShouldParenthesize: false, fullName: null, childFullNamePrefixOpt: proxyMemberFullNamePrefix, formatSpecifiers: Formatter.NoFormatSpecifiers, category: default(DkmEvaluationResultCategory), flags: default(DkmEvaluationResultFlags), editableValue: null); } this.name = name; this.typeDeclaringMemberOpt = typeDeclaringMemberOpt; _declaredType = declaredType; this.value = value; this.childShouldParenthesize = childShouldParenthesize; this.fullName = fullName; this.childFullNamePrefix = childFullNamePrefix; this.formatSpecifiers = formatSpecifiers; this.flags = flags; this.editableValue = editableValue; }
private DebuggerTypeProxyExpansion( DkmInspectionContext inspectionContext, DkmClrValue proxyValue, string name, TypeAndCustomInfo typeDeclaringMemberAndInfoOpt, TypeAndCustomInfo declaredTypeAndInfo, DkmClrValue value, bool childShouldParenthesize, string fullName, string childFullNamePrefix, ReadOnlyCollection <string> formatSpecifiers, DkmEvaluationResultFlags flags, string editableValue, ResultProvider resultProvider) { Debug.Assert(proxyValue != null); var proxyType = proxyValue.Type; var proxyTypeAndInfo = new TypeAndCustomInfo(proxyType); var proxyMembers = MemberExpansion.CreateExpansion( inspectionContext, proxyTypeAndInfo, proxyValue, ExpansionFlags.IncludeBaseMembers, TypeHelpers.IsPublic, resultProvider, isProxyType: true); if (proxyMembers != null) { string proxyMemberFullNamePrefix = null; if (childFullNamePrefix != null) { proxyMemberFullNamePrefix = resultProvider.FullNameProvider.GetClrObjectCreationExpression( inspectionContext, proxyTypeAndInfo.ClrType, proxyTypeAndInfo.Info, new[] { childFullNamePrefix }); } _proxyItem = new EvalResult( ExpansionKind.Default, name: string.Empty, typeDeclaringMemberAndInfo: default(TypeAndCustomInfo), declaredTypeAndInfo: proxyTypeAndInfo, useDebuggerDisplay: false, value: proxyValue, displayValue: null, expansion: proxyMembers, childShouldParenthesize: false, fullName: null, childFullNamePrefixOpt: proxyMemberFullNamePrefix, formatSpecifiers: Formatter.NoFormatSpecifiers, category: default(DkmEvaluationResultCategory), flags: default(DkmEvaluationResultFlags), editableValue: null, inspectionContext: inspectionContext); } _name = name; _typeDeclaringMemberAndInfoOpt = typeDeclaringMemberAndInfoOpt; _declaredTypeAndInfo = declaredTypeAndInfo; _value = value; _childShouldParenthesize = childShouldParenthesize; _fullName = fullName; _childFullNamePrefix = childFullNamePrefix; _formatSpecifiers = formatSpecifiers; _flags = flags; _editableValue = editableValue; }
internal static Expansion CreateExpansion( ResultProvider resultProvider, DkmInspectionContext inspectionContext, string name, Type typeDeclaringMemberOpt, Type declaredType, DkmClrValue value, bool childShouldParenthesize, string fullName, string childFullNamePrefix, ReadOnlyCollection<string> formatSpecifiers, DkmEvaluationResultFlags flags, string editableValue) { Debug.Assert((inspectionContext.EvaluationFlags & DkmEvaluationFlags.NoExpansion) == 0); // Note: The native EE uses the proxy type, even for // null instances, so statics on the proxy type are // displayed. That case is not supported currently. if (!value.IsNull) { var proxyType = value.Type.GetProxyType(); if (proxyType != null) { if ((inspectionContext.EvaluationFlags & DkmEvaluationFlags.ShowValueRaw) != 0) { var rawView = CreateRawView(resultProvider, inspectionContext, declaredType, value); Debug.Assert(rawView != null); return rawView; } DkmClrValue proxyValue; try { proxyValue = value.InstantiateProxyType(proxyType); } catch { proxyValue = null; } if (proxyValue != null) { return new DebuggerTypeProxyExpansion( proxyValue, name, typeDeclaringMemberOpt, declaredType, value, childShouldParenthesize, fullName, childFullNamePrefix, formatSpecifiers, flags, editableValue, resultProvider.Formatter); } } } return null; }
public EvalResultDataItem( ExpansionKind kind, string name, TypeAndCustomInfo typeDeclaringMemberAndInfo, TypeAndCustomInfo declaredTypeAndInfo, EvalResultDataItem parent, DkmClrValue value, string displayValue, Expansion expansion, bool childShouldParenthesize, string fullName, string childFullNamePrefixOpt, ReadOnlyCollection<string> formatSpecifiers, DkmEvaluationResultCategory category, DkmEvaluationResultFlags flags, string editableValue, DkmInspectionContext inspectionContext) { Debug.Assert(name != null); Debug.Assert(formatSpecifiers != null); Debug.Assert((flags & DkmEvaluationResultFlags.Expandable) == 0); this.Kind = kind; this.Name = name; this.TypeDeclaringMemberAndInfo = typeDeclaringMemberAndInfo; this.DeclaredTypeAndInfo = declaredTypeAndInfo; this.Parent = parent; this.Value = value; this.DisplayValue = displayValue; this.ChildShouldParenthesize = childShouldParenthesize; this.FullNameWithoutFormatSpecifiers = fullName; this.ChildFullNamePrefix = childFullNamePrefixOpt; this.FormatSpecifiers = formatSpecifiers; this.Category = category; this.EditableValue = editableValue; this.Flags = flags | GetFlags(value, inspectionContext) | ((expansion == null) ? DkmEvaluationResultFlags.None : DkmEvaluationResultFlags.Expandable); this.Expansion = expansion; }
internal EvalResultDataItem CreateDataItem( DkmInspectionContext inspectionContext, string name, Type typeDeclaringMember, Type declaredType, DkmClrValue value, EvalResultDataItem parent, ExpansionFlags expansionFlags, bool childShouldParenthesize, string fullName, ReadOnlyCollection<string> formatSpecifiers, DkmEvaluationResultCategory category, DkmEvaluationResultFlags flags, DkmEvaluationFlags evalFlags) { if ((evalFlags & DkmEvaluationFlags.ShowValueRaw) != 0) { formatSpecifiers = Formatter.AddFormatSpecifier(formatSpecifiers, "raw"); } Expansion expansion; // If the declared type is Nullable<T>, the value should // have no expansion if null, or be expanded as a T. var lmrNullableTypeArg = declaredType.GetNullableTypeArgument(); if (lmrNullableTypeArg != null && !value.HasExceptionThrown(parent)) { Debug.Assert(value.Type.GetProxyType() == null); var nullableValue = value.GetNullableValue(); if (nullableValue == null) { Debug.Assert(declaredType.Equals(value.Type.GetLmrType())); // No expansion of "null". expansion = null; } else { value = nullableValue; Debug.Assert(lmrNullableTypeArg.Equals(value.Type.GetLmrType())); // If this is not the case, add a test for includeRuntimeTypeIfNecessary. expansion = this.GetTypeExpansion(inspectionContext, lmrNullableTypeArg, value, ExpansionFlags.IncludeResultsView); } } else if (value.IsError() || (inspectionContext.EvaluationFlags & DkmEvaluationFlags.NoExpansion) != 0) { expansion = null; } else { expansion = DebuggerTypeProxyExpansion.CreateExpansion( this, inspectionContext, name, typeDeclaringMember, declaredType, value, childShouldParenthesize, fullName, flags.Includes(DkmEvaluationResultFlags.ExceptionThrown) ? null : fullName, formatSpecifiers, flags, this.Formatter.GetEditableValue(value)); if (expansion == null) { var expansionType = value.HasExceptionThrown(parent) ? value.Type.GetLmrType() : declaredType; expansion = this.GetTypeExpansion(inspectionContext, expansionType, value, expansionFlags); } } return new EvalResultDataItem( name, typeDeclaringMember, declaredType, value, expansion, childShouldParenthesize, fullName, flags.Includes(DkmEvaluationResultFlags.ExceptionThrown) ? null : fullName, formatSpecifiers, category, flags, this.Formatter.GetEditableValue(value)); }