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_); }
/* 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 DkmChildVisualizedExpression CreateNewExpression(string expr_str) { DkmSuccessEvaluationResult result_eval = null; try { result_eval = DefaultEE.DefaultEval(expr_str, callback_expr_, true) as DkmSuccessEvaluationResult; } catch (Exception e) { } if (result_eval == null) { return(null); } DkmExpressionValueHome home; if (result_eval.Address != null) { home = DkmPointerValueHome.Create(result_eval.Address.Value); } else { home = DkmFakeValueHome.Create(0); } // @TODO: This is weird. Can I perhaps construct a DkmRootVisualizedExpression instead?? // Not sure about a couple of the parameters needed to do so, Module especially... return(DkmChildVisualizedExpression.Create( result_eval.InspectionContext, expr_.VisualizerId, expr_.SourceId, result_eval.StackFrame, home, result_eval, callback_expr_, //expr_, 0, // ?? null )); }
/* 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; } }