Пример #1
0
        private bool TryGetRegisteredVisualizer(DkmVisualizedExpression expression, out BasicVisualizer visualizer, out DkmFailedEvaluationResult failureResult)
        {
            visualizer    = null;
            failureResult = null;

            if (VisualizerRegistrar.TryCreateVisualizer(expression, out visualizer))
            {
                return(true);
            }

            string name     = null;
            string fullName = null;

            Utility.GetExpressionName(expression, out name, out fullName);

            DkmFailedEvaluationResult failure = DkmFailedEvaluationResult.Create(
                expression.InspectionContext,
                expression.StackFrame,
                name,
                fullName,
                String.Format("No formatter is registered for VisualizerId {0}",
                              expression.VisualizerId),
                DkmEvaluationResultFlags.Invalid,
                null);

            failureResult = failure;
            return(false);
        }
Пример #2
0
        void IDkmCustomVisualizer.UseDefaultEvaluationBehavior(DkmVisualizedExpression expression, out bool useDefaultEvaluationBehavior, out DkmEvaluationResult defaultEvaluationResult)
        {
            BasicVisualizer visualizer = null;

            defaultEvaluationResult      = null;
            useDefaultEvaluationBehavior = true;
            if (expression.VisualizerId != Guids.CustomVisualizer.ForceDefault &&
                VisualizerRegistrar.TryCreateVisualizer(expression, out visualizer))
            {
                // If this visualizer has custom fields, or displays default fields non-inline, don't use
                // the default evaluation behavior.
                ChildDisplayFlags flags = visualizer.ChildDisplayFlags;
                if (flags.HasFlag(ChildDisplayFlags.HasCustomFields) ||
                    !flags.HasFlag(ChildDisplayFlags.DefaultFieldsInline))
                {
                    useDefaultEvaluationBehavior = false;
                }
            }

            if (useDefaultEvaluationBehavior)
            {
                string name     = null;
                string fullName = null;
                Utility.GetExpressionName(expression, out name, out fullName);
                fullName += ",!";
                defaultEvaluationResult = CppExpressionEvaluator.Evaluate(expression, fullName);
            }
        }
Пример #3
0
        void IDkmCustomVisualizer.EvaluateVisualizedExpression(DkmVisualizedExpression expression, out DkmEvaluationResult resultObject)
        {
            BasicVisualizer           visualizer    = null;
            DkmFailedEvaluationResult failureResult = null;

            if (!TryGetRegisteredVisualizer(expression, out visualizer, out failureResult))
            {
                resultObject = failureResult;
                return;
            }

            DkmEvaluationResult evalResult     = visualizer.EvaluationResult;
            EvaluationDataItem  resultDataItem = new EvaluationDataItem(expression, evalResult);

            expression.SetDataItem(DkmDataCreationDisposition.CreateAlways, resultDataItem);

            string name     = null;
            string fullName = null;

            Utility.GetExpressionName(expression, out name, out fullName);

            if (evalResult.TagValue == DkmEvaluationResult.Tag.SuccessResult)
            {
                DkmSuccessEvaluationResult successResult = (DkmSuccessEvaluationResult)evalResult;
                resultObject = DkmSuccessEvaluationResult.Create(
                    successResult.InspectionContext,
                    successResult.StackFrame,
                    name,
                    successResult.FullName,
                    successResult.Flags,
                    successResult.Value,
                    successResult.EditableValue,
                    successResult.Type,
                    successResult.Category,
                    successResult.Access,
                    successResult.StorageType,
                    successResult.TypeModifierFlags,
                    successResult.Address,
                    successResult.CustomUIVisualizers,
                    successResult.ExternalModules,
                    resultDataItem);
            }
            else
            {
                DkmFailedEvaluationResult failResult = (DkmFailedEvaluationResult)evalResult;

                resultObject = DkmFailedEvaluationResult.Create(
                    failResult.InspectionContext,
                    failResult.StackFrame,
                    name,
                    fullName,
                    failResult.ErrorMessage,
                    failResult.Flags,
                    null);
                return;
            }
        }
Пример #4
0
        public static bool TryCreateVisualizer(DkmVisualizedExpression expression, out BasicVisualizer visualizer)
        {
            visualizer = null;

            IVisualizerFactory factory = null;
            bool result = visualizers_.TryGetValue(expression.VisualizerId, out factory);

            if (!result)
            {
                return(result);
            }

            visualizer = factory.CreateVisualizer(expression);
            return(true);
        }
Пример #5
0
      private bool TryGetRegisteredVisualizer(DkmVisualizedExpression expression, out BasicVisualizer visualizer, out DkmFailedEvaluationResult failureResult)
      {
        visualizer = null;
        failureResult = null;

        if (VisualizerRegistrar.TryCreateVisualizer(expression, out visualizer))
          return true;

        string name = null;
        string fullName = null;
        Utility.GetExpressionName(expression, out name, out fullName);

        DkmFailedEvaluationResult failure = DkmFailedEvaluationResult.Create(
            expression.InspectionContext,
            expression.StackFrame,
            name,
            fullName,
            String.Format("No formatter is registered for VisualizerId {0}",
                expression.VisualizerId),
            DkmEvaluationResultFlags.Invalid,
            null);
        failureResult = failure;
        return false;
      }