public EvaluatedObjectContext(DkmVisualizedExpression expr, DkmVisualizedExpression callback_expr): base(expr, callback_expr)
		{
			DkmEvaluationResult eval = null;
			if (expr_.TagValue == DkmVisualizedExpression.Tag.ChildVisualizedExpression)
			{
				eval = ((DkmChildVisualizedExpression)expr_).EvaluationResult;
			}
			else
			{
				eval = DefaultEE.DefaultEval(expr_, true);
			}
			eval_ = (DkmSuccessEvaluationResult)eval;

			// @NOTE: Pretty sure this is reliable
			is_pointer_ = eval_.Type.Contains('*');

			string fullname = Utility.GetExpressionFullName(expr_);
			// Remove any trailing format specifiers.
			int comma = fullname.IndexOf(',');
			if(comma != -1)
			{
				fullname = fullname.Substring(0, comma);
			}
            string base_expr_stub_ = String.Format(
				"({0})",
				fullname
				);
			ptr_expr_stub_ = is_pointer_ ?
				base_expr_stub_ : String.Format("(&{0})", base_expr_stub_);
		}
        DkmClrValue IDkmClrResultProvider.GetClrValue(DkmSuccessEvaluationResult evaluationResult)
        {
            try
            {
                var dataItem = evaluationResult.GetDataItem<EvalResultDataItem>();
                if (dataItem == null)
                {
                    return null;
                }

                return dataItem.Value;
            }
            catch (Exception e) when (ExpressionEvaluatorFatalError.CrashIfFailFastEnabled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }
Esempio n. 3
0
        DkmClrValue IDkmClrResultProvider.GetClrValue(DkmSuccessEvaluationResult evaluationResult)
        {
            try
            {
                var dataItem = evaluationResult.GetDataItem<EvalResultDataItem>();
                if (dataItem == null)
                {
                    // We don't know about this result.  Call next implementation
                    return evaluationResult.GetClrValue();
                }

                return dataItem.Value;
            }
            catch (Exception e) when (ExpressionEvaluatorFatalError.CrashIfFailFastEnabled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }
        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 override DkmChildVisualizedExpression GetMostDerived()
		{
			foreach (var child in MemberExpressions)
			{
				var eval = child.Value.EvaluationResult as DkmSuccessEvaluationResult;
				if (eval != null && eval.Category == DkmEvaluationResultCategory.MostDerivedClass)
				{
					return child.Value;
				}
			}

			return null;
		}
*/
		private void EvaluateChildren()
		{
			MemberExpressions = new Dictionary<string, DkmChildVisualizedExpression>();

			// @TODO: Am assuming that if expr_ is a child expression, it would be more
			// efficient to use its EvaluationResult property instead of invoking the default
			// evaluator again. However, doing this results in using child UObject expressions which
			// have been generated using the custom visualization (since ! specifier is not recursive).
			// We really don't want this since we just want the default expansion so we can navigate
			// through the members and bases of the class.
			// Problem is, don't know how to communicate to the 'UseDefaultEvaluationBehavior'
			// implementation to use a default expansion in this particular case. Setting the data
			// item on expr_ before calling GetItemsCallback doesn't work, since the expression that
			// gets passed through is not actually expr_, but a root visualized expression that was
			// created by the EE when visualizing the parent, which we don't have access to.

			// As it is, now that we inline the default expansion alongside the addition of the
			// 'UE4 Properties' child, this does seem to work. However, not obvious there is any
			// performance improvement, also not 100% sure it's safe to use the stored evaluation.
			DkmEvaluationResult uobj_eval = null;
			if (expr_.TagValue == DkmVisualizedExpression.Tag.ChildVisualizedExpression)
			{
				uobj_eval = ((DkmChildVisualizedExpression)expr_).EvaluationResult;
			}
			else
			{
				uobj_eval = DefaultEE.DefaultEval(callback_expr_, true);
			}
			eval_ = (DkmSuccessEvaluationResult)uobj_eval;

			DkmEvaluationResult[] children;
			DkmEvaluationResultEnumContext enum_context;
			try
			{
				callback_expr_.GetChildrenCallback(uobj_eval, 0, callback_expr_.InspectionContext, out children, out enum_context);
				// @NOTE: Assuming count will not be large here!!
				callback_expr_.GetItemsCallback(enum_context, 0, enum_context.Count, out children);
			}
			catch
			{
				return;
			}

			uint idx = 0;
			foreach (var child_eval in children)
			{
				if (child_eval.TagValue == DkmEvaluationResult.Tag.SuccessResult)
				{
					var success_eval = child_eval as DkmSuccessEvaluationResult;
					Debug.Assert(success_eval != null);

					DkmExpressionValueHome home;
					if(success_eval.Address != null)
					{
						home = DkmPointerValueHome.Create(success_eval.Address.Value);
                    }
					else
					{
						home = DkmFakeValueHome.Create(0);
					}
					DkmChildVisualizedExpression child = DkmChildVisualizedExpression.Create(
						child_eval.InspectionContext,
						callback_expr_.VisualizerId,
						callback_expr_.SourceId,
						child_eval.StackFrame,
						home,
						child_eval,
						expr_,
						idx,
						null
						);
					MemberExpressions[child_eval.Name] = child;
				}

				++idx;
			}
		}
 DkmClrValue IDkmClrResultProvider.GetClrValue(DkmSuccessEvaluationResult successResult)
 {
     return successResult.GetClrValue();
 }
Esempio n. 7
0
		// Assumes already confirmed that we are dealing with a pointer
		protected bool IsPointerNull(DkmSuccessEvaluationResult eval)
		{
			return eval.Address.Value == 0;
		}
Esempio n. 8
0
		protected bool IsPointer(DkmSuccessEvaluationResult eval)
		{
			// @TODO: Confirm reliable. Alternative is to check for '*' within Type property.
			return eval.Flags.HasFlag(DkmEvaluationResultFlags.Address);
		}