public void GetChildren(DkmVisualizedExpression visualizedExpression, int initialRequestSize, DkmInspectionContext inspectionContext, out DkmChildVisualizedExpression[] initialChildren, out DkmEvaluationResultEnumContext enumContext)
        {
            var rawResultHolder = visualizedExpression.GetDataItem <RawEvaluationResultHolder>();

            if (rawResultHolder == null)
            {
                Debug.Fail("PythonViewNativeVisualizer.GetChildren passed a visualized expression that does not have an associated RawEvaluationResultHolder.");
                throw new NotSupportedException();
            }
            var rawResult = rawResultHolder.RawResult;

            DkmEvaluationResult[]          rawInitialChildren;
            DkmEvaluationResultEnumContext rawEnumContext;

            visualizedExpression.GetChildrenCallback(rawResult, 0, inspectionContext, out rawInitialChildren, out rawEnumContext);

            initialChildren = new DkmChildVisualizedExpression[0];
            enumContext     = rawEnumContext;

            if (DebuggerOptions.ShowPythonViewNodes)
            {
                var pythonView = GetPythonView(visualizedExpression, (uint)rawEnumContext.Count);
                if (pythonView != null)
                {
                    enumContext = DkmEvaluationResultEnumContext.Create(
                        rawEnumContext.Count + 1,
                        rawEnumContext.StackFrame,
                        rawEnumContext.InspectionContext,
                        new RawEnumContextData {
                        RawContext = rawEnumContext, PythonView = pythonView
                    });
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns number of child elements in previous evaluation.
        /// </summary>
        public void GetChildren(DkmVisualizedExpression visualizedExpression, int initialRequestSize, DkmInspectionContext inspectionContext, out DkmChildVisualizedExpression[] initialChildren, out DkmEvaluationResultEnumContext enumContext)
        {
            // Check if we want to use passthrough visualizer
            PassThroughVisualizer passThroughVisualizer = visualizedExpression.GetDataItem <PassThroughVisualizer>();

            if (passThroughVisualizer != null)
            {
                passThroughVisualizer.GetChildren(visualizedExpression, initialRequestSize, inspectionContext, out initialChildren, out enumContext);
                return;
            }

            // Execute our regular visualizer
            VSCustomVisualizerEvaluator evaluator = visualizedExpression.GetDataItem <VSCustomVisualizerEvaluator>();

            initialChildren = new DkmChildVisualizedExpression[0];
            enumContext     = DkmEvaluationResultEnumContext.Create(evaluator.ResultVisualizer?.Children.Count() ?? 0, visualizedExpression.StackFrame, visualizedExpression.InspectionContext, evaluator);
        }
Exemplo n.º 3
0
        void IDkmCustomVisualizer.GetItems(DkmVisualizedExpression expression, DkmEvaluationResultEnumContext enumContext, int startIndex, int count, out DkmChildVisualizedExpression[] items)
        {
            var data_item  = expression.GetDataItem <ExpressionDataItem>();
            var visualizer = data_item.Visualizer;

            Debug.Assert(visualizer != null);

            visualizer.GetChildItems(enumContext, startIndex, count, out items);
        }
Exemplo n.º 4
0
        public string GetUnderlyingString(DkmVisualizedExpression visualizedExpression)
        {
            var rawResultHolder = visualizedExpression.GetDataItem <RawEvaluationResultHolder>();

            if (rawResultHolder == null)
            {
                Debug.Fail("PythonViewNativeVisualizer.GetUnderlyingString passed a visualized expression that does not have an associated RawEvaluationResultHolder.");
                throw new NotSupportedException();
            }

            return(visualizedExpression.GetUnderlyingStringCallback(rawResultHolder.RawResult));
        }
Exemplo n.º 5
0
        public void SetValueAsString(DkmVisualizedExpression visualizedExpression, string value, int timeout, out string errorText)
        {
            var rawResultHolder = visualizedExpression.GetDataItem <RawEvaluationResultHolder>();

            if (rawResultHolder == null)
            {
                Debug.Fail("PythonViewNativeVisualizer.GetUnderlyingString passed a visualized expression that does not have an associated RawEvaluationResultHolder.");
                throw new NotSupportedException();
            }

            visualizedExpression.SetValueAsStringCallback(rawResultHolder.RawResult, value, timeout, out errorText);
        }
Exemplo n.º 6
0
        void IDkmCustomVisualizer.GetItems(DkmVisualizedExpression expression, DkmEvaluationResultEnumContext enumContext, int startIndex, int count, out DkmChildVisualizedExpression[] items)
        {
            EvaluationDataItem dataItem = expression.GetDataItem <EvaluationDataItem>();

            if (dataItem == null)
            {
                Debug.Fail("DebugComponent.GetItems passed a visualized expression that does not have an associated ExpressionDataItem.");
                throw new NotSupportedException();
            }

            items = dataItem.Visualizer.GetChildItems(startIndex, count);
        }
Exemplo n.º 7
0
        void IDkmCustomVisualizer.GetChildren(DkmVisualizedExpression expression, int initialRequestSize, DkmInspectionContext inspectionContext, out DkmChildVisualizedExpression[] initialChildren, out DkmEvaluationResultEnumContext enumContext)
        {
            Debug.Print("UE4PV: GetChildren('{0}'/'{1}', [{2}, {3}])",
                Utility.GetExpressionFullName(expression),
                Utility.GetExpressionName(expression),
                expression.TagValue,
                expression.VisualizerId
                );

            var data_item = expression.GetDataItem<ExpressionDataItem>();
            var visualizer = data_item.Visualizer;
            Debug.Assert(visualizer != null);

            visualizer.PrepareExpansion(out enumContext);
            initialChildren = new DkmChildVisualizedExpression[0];
        }
Exemplo n.º 8
0
        void IDkmCustomVisualizer.GetChildren(DkmVisualizedExpression expression, int initialRequestSize, DkmInspectionContext inspectionContext, out DkmChildVisualizedExpression[] initialChildren, out DkmEvaluationResultEnumContext enumContext)
        {
            Debug.Print("UE4PV: GetChildren('{0}'/'{1}', [{2}, {3}])",
                        Utility.GetExpressionFullName(expression),
                        Utility.GetExpressionName(expression),
                        expression.TagValue,
                        expression.VisualizerId
                        );

            var data_item  = expression.GetDataItem <ExpressionDataItem>();
            var visualizer = data_item.Visualizer;

            Debug.Assert(visualizer != null);

            visualizer.PrepareExpansion(out enumContext);
            initialChildren = new DkmChildVisualizedExpression[0];
        }
Exemplo n.º 9
0
		// NOTE: 'expr' must resolve to either <UObject-type>* or <UObject-type>.
		// Furthermore, it must have already been passed to a UObjectVisualizer, which has 
		// performed the initial evalution.
		public UPropertyAccessContext(DkmVisualizedExpression expr)
		{
			context_expr_ = expr;

			string base_expression_str = Utility.GetExpressionFullName(context_expr_);
			base_expression_str = Utility.StripExpressionFormatting(base_expression_str);

			obj_em_ = ExpressionManipulator.FromExpression(base_expression_str);

			// Determine if our base expression is <UObject-type>* or <UObject-type>
			var uobj_data = context_expr_.GetDataItem<UObjectDataItem>();
			Debug.Assert(uobj_data != null);
            if (!uobj_data.IsPointer)
			{
				obj_em_ = obj_em_.AddressOf();
			}
		}
Exemplo n.º 10
0
        void IDkmCustomVisualizer.UseDefaultEvaluationBehavior(DkmVisualizedExpression expression, out bool useDefaultEvaluationBehavior, out DkmEvaluationResult defaultEvaluationResult)
        {
            Debug.Print("UE4PV: UseDefaultEvaluationBehavior('{0}'/'{1}', [{2}, {3}])",
                        Utility.GetExpressionFullName(expression),
                        Utility.GetExpressionName(expression),
                        expression.TagValue,
                        expression.VisualizerId
                        );

            if (KUE4VS.ExtContext.Instance.ExtensionOptions.EnablePropVis)
            {
                var data_item = expression.GetDataItem <ExpressionDataItem>();
                if (data_item != null)
                {
                    Debug.Assert(data_item.Visualizer != null);

                    if (data_item.Visualizer.WantsCustomExpansion)
                    {
                        useDefaultEvaluationBehavior = false;
                        defaultEvaluationResult      = null;
                        return;
                    }
                }
            }

            // Don't need any special expansion, just delegate back to the default EE
            useDefaultEvaluationBehavior = true;

            /* @NOTE:
             * Not sure where exactly the problem is, but UObject properties don't expand in VS 2013.
             * When we try, there is an initial call to this method with the property's child expr,
             * so we come here, and do a default eval, which, if the prop is a UObject, will invoke
             * EvaluateVisualizedExpression above with a new root expr. In 2015, that is followed by
             * another call to this method for the root expr, which has an attached visualizer and we
             * do the custom expansion. In 2013, it seems the second call into this method does not
             * occur for some reason.
             */
            defaultEvaluationResult = DefaultEE.DefaultEval(expression, false);

/*
 *      Doing this will crash VS!
 *      DkmSuccessEvaluationResult.Create(null, null, "", "", DkmEvaluationResultFlags.None,
 *                              "", "", "", DkmEvaluationResultCategory.Other, DkmEvaluationResultAccessType.None,
 *                              DkmEvaluationResultStorageType.None, DkmEvaluationResultTypeModifierFlags.None,
 *                              null, null, null, null);
 */     }
Exemplo n.º 11
0
        void IDkmCustomVisualizer.GetChildren(DkmVisualizedExpression expression, int initialRequestSize, DkmInspectionContext inspectionContext, out DkmChildVisualizedExpression[] initialChildren, out DkmEvaluationResultEnumContext enumContext)
        {
            EvaluationDataItem dataItem = expression.GetDataItem <EvaluationDataItem>();

            if (dataItem == null)
            {
                Debug.Fail("DebugComponent.GetChildren passed a visualized expression that does not have an associated ExpressionDataItem.");
                throw new NotSupportedException();
            }

            initialChildren = new DkmChildVisualizedExpression[0];

            enumContext = DkmEvaluationResultEnumContext.Create(
                dataItem.Visualizer.ChildElementCount,
                expression.StackFrame,
                expression.InspectionContext,
                null);
        }
Exemplo n.º 12
0
        // NOTE: 'expr' must resolve to either <UObject-type>* or <UObject-type>.
        // Furthermore, it must have already been passed to a UObjectVisualizer, which has
        // performed the initial evalution.
        public UPropertyAccessContext(DkmVisualizedExpression expr)
        {
            context_expr_ = expr;

            string base_expression_str = Utility.GetExpressionFullName(context_expr_);

            base_expression_str = Utility.StripExpressionFormatting(base_expression_str);

            obj_em_ = ExpressionManipulator.FromExpression(base_expression_str);

            // Determine if our base expression is <UObject-type>* or <UObject-type>
            var uobj_data = context_expr_.GetDataItem <UObjectDataItem>();

            Debug.Assert(uobj_data != null);
            if (!uobj_data.IsPointer)
            {
                obj_em_ = obj_em_.AddressOf();
            }
        }
Exemplo n.º 13
0
        void IDkmCustomVisualizer.UseDefaultEvaluationBehavior(DkmVisualizedExpression expression, out bool useDefaultEvaluationBehavior, out DkmEvaluationResult defaultEvaluationResult)
        {
            Debug.Print("UE4PV: UseDefaultEvaluationBehavior('{0}'/'{1}', [{2}, {3}])",
                        Utility.GetExpressionFullName(expression),
                        Utility.GetExpressionName(expression),
                        expression.TagValue,
                        expression.VisualizerId
                        );

            var data_item = expression.GetDataItem <ExpressionDataItem>();

            if (data_item != null)
            {
                Debug.Assert(data_item.Visualizer != null);

                if (data_item.Visualizer.WantsCustomExpansion)
                {
                    useDefaultEvaluationBehavior = false;
                    defaultEvaluationResult      = null;
                    return;
                }
            }

            // Don't need any special expansion, just delegate back to the default EE
            useDefaultEvaluationBehavior = true;

            /* @NOTE:
             * Not sure where exactly the problem is, but UObject properties don't expand in VS 2013.
             * When we try, there is an initial call to this method with the property's child expr,
             * so we come here, and do a default eval, which, if the prop is a UObject, will invoke
             * EvaluateVisualizedExpression above with a new root expr. In 2014, that is followed by
             * another call to this method for the root expr, which has an attached visualizer and we
             * do the custom expansion. In 2013, it seems the second call into this method does not
             * occur for some reason.
             */
            defaultEvaluationResult = DefaultEE.DefaultEval(expression, false);
        }
Exemplo n.º 14
0
        void IDkmCustomVisualizer.UseDefaultEvaluationBehavior(DkmVisualizedExpression expression, out bool useDefaultEvaluationBehavior, out DkmEvaluationResult defaultEvaluationResult)
        {
			Debug.Print("UE4PV: UseDefaultEvaluationBehavior('{0}'/'{1}', [{2}, {3}])",
				Utility.GetExpressionFullName(expression),
				Utility.GetExpressionName(expression),
				expression.TagValue,
				expression.VisualizerId
				);

			var data_item = expression.GetDataItem<ExpressionDataItem>();
			if (data_item != null)
			{
				Debug.Assert(data_item.Visualizer != null);

				if (data_item.Visualizer.WantsCustomExpansion)
				{
					useDefaultEvaluationBehavior = false;
					defaultEvaluationResult = null;
					return;
				}
			}

			// Don't need any special expansion, just delegate back to the default EE
			useDefaultEvaluationBehavior = true;

			/* @NOTE:
			Not sure where exactly the problem is, but UObject properties don't expand in VS 2013.
			When we try, there is an initial call to this method with the property's child expr,
			so we come here, and do a default eval, which, if the prop is a UObject, will invoke 
			EvaluateVisualizedExpression above with a new root expr. In 2014, that is followed by
			another call to this method for the root expr, which has an attached visualizer and we
			do the custom expansion. In 2013, it seems the second call into this method does not
			occur for some reason.
			*/
			defaultEvaluationResult = DefaultEE.DefaultEval(expression, false);
		}
Exemplo n.º 15
0
        /// <summary>
        /// Returns child elements of previous evaluation.
        /// </summary>
        public void GetItems(DkmVisualizedExpression visualizedExpression, DkmEvaluationResultEnumContext enumContext, int startIndex, int count, out DkmChildVisualizedExpression[] items)
        {
            // Check if we want to use passthrough visualizer
            PassThroughVisualizer passThroughVisualizer = enumContext.GetDataItem <PassThroughVisualizer>();

            if (passThroughVisualizer != null)
            {
                passThroughVisualizer.GetItems(visualizedExpression, enumContext, startIndex, count, out items);
                return;
            }

            // Execute our regular visualizer
            VSCustomVisualizerEvaluator evaluator = visualizedExpression.GetDataItem <VSCustomVisualizerEvaluator>();

            IResultVisualizer[] itemsAsResults = evaluator.ResultVisualizer.Children.Skip(startIndex).Take(count).ToArray();

            items = new DkmChildVisualizedExpression[itemsAsResults.Length];
            for (int i = 0; i < items.Length; i++)
            {
                IResultVisualizer           item = itemsAsResults[i];
                DkmEvaluationResultCategory category;

                switch (item.DataType)
                {
                case CompletionDataType.Class:
                    category = DkmEvaluationResultCategory.Class;
                    break;

                case CompletionDataType.Property:
                case CompletionDataType.StaticProperty:
                    category = DkmEvaluationResultCategory.Property;
                    break;

                case CompletionDataType.Event:
                    category = DkmEvaluationResultCategory.Event;
                    break;

                case CompletionDataType.Method:
                    category = DkmEvaluationResultCategory.Method;
                    break;

                case CompletionDataType.Enum:
                case CompletionDataType.EnumValue:
                case CompletionDataType.Keyword:
                case CompletionDataType.Namespace:
                case CompletionDataType.StaticClass:
                case CompletionDataType.StaticEvent:
                case CompletionDataType.StaticMethod:
                case CompletionDataType.StaticVariable:
                case CompletionDataType.Unknown:
                case CompletionDataType.Variable:
                default:
                    category = DkmEvaluationResultCategory.Data;
                    break;
                }

                DkmExpressionValueHome valueHome = visualizedExpression.ValueHome;
                ulong  address  = 0;
                string fullName = string.Empty;
                string typeName = null;

                try
                {
                    if (item.Value is Variable variable)
                    {
                        address   = variable.GetPointerAddress();
                        typeName  = variable.GetCodeType().Name;
                        fullName  = $"*(({typeName}*)0x{address:X})";
                        valueHome = DkmPointerValueHome.Create(address);
                    }
                }
                catch
                {
                }

                DkmEvaluationResult result;
                DkmDataItem         dataItem = null;

                if (item.ShouldForceDefaultVisualizer && !string.IsNullOrEmpty(fullName))
                {
                    using (DkmLanguageExpression languageExpression = DkmLanguageExpression.Create(visualizedExpression.InspectionContext.Language, DkmEvaluationFlags.TreatAsExpression, fullName, null))
                    {
                        visualizedExpression.EvaluateExpressionCallback(visualizedExpression.InspectionContext, languageExpression, visualizedExpression.StackFrame, out result);
                    }

                    if (result is DkmSuccessEvaluationResult successResult)
                    {
                        dataItem = new PassThroughVisualizer(successResult);
                        result   = DkmSuccessEvaluationResult.Create(
                            successResult.InspectionContext,
                            successResult.StackFrame,
                            item.Name, // Name - Left column
                            successResult.FullName,
                            successResult.Flags,
                            successResult.Value, // Value - Middle column
                            successResult.EditableValue,
                            successResult.Type,  // Type - Right column
                            category,
                            successResult.Access,
                            successResult.StorageType,
                            successResult.TypeModifierFlags,
                            successResult.Address,
                            successResult.CustomUIVisualizers,
                            successResult.ExternalModules,
                            successResult.RefreshButtonText,
                            dataItem);
                    }
                }
                else
                {
                    result = DkmSuccessEvaluationResult.Create(
                        visualizedExpression.InspectionContext,
                        visualizedExpression.StackFrame,
                        item.Name,        // Name - Left column
                        fullName,         // FullName - What is being copied when "Add to watch"
                        DkmEvaluationResultFlags.ReadOnly | (item.IsExpandable ? DkmEvaluationResultFlags.Expandable : DkmEvaluationResultFlags.None),
                        item.ValueString, // Value - Middle column
                        "",
                        item.Type ?? "",  // Type - Right column
                        category,
                        DkmEvaluationResultAccessType.None,
                        DkmEvaluationResultStorageType.None,
                        DkmEvaluationResultTypeModifierFlags.None,
                        null,
                        VSUIVisualizerService.GetUIVisualizers(item),
                        null,
                        null);
                    dataItem = new VSCustomVisualizerEvaluator(result, item);
                }
                items[i] = DkmChildVisualizedExpression.Create(
                    visualizedExpression.InspectionContext,
                    visualizedExpression.VisualizerId,
                    visualizedExpression.SourceId,
                    visualizedExpression.StackFrame,
                    valueHome,
                    result,
                    visualizedExpression,
                    (uint)(startIndex + i),
                    dataItem);
            }
        }
Exemplo n.º 16
0
        void IDkmCustomVisualizer.GetItems(DkmVisualizedExpression expression, DkmEvaluationResultEnumContext enumContext, int startIndex, int count, out DkmChildVisualizedExpression[] items)
        {
            EvaluationDataItem dataItem = expression.GetDataItem<EvaluationDataItem>();
            if (dataItem == null)
            {
              Debug.Fail("DebugComponent.GetItems passed a visualized expression that does not have an associated ExpressionDataItem.");
              throw new NotSupportedException();
            }

            items = dataItem.Visualizer.GetChildItems(startIndex, count);
        }
Exemplo n.º 17
0
        public void EvaluateProperties()
        {
            List <DkmEvaluationResult> evals = new List <DkmEvaluationResult>();

            // Assume we've been constructed with the fabricated property list expression
            DkmChildVisualizedExpression proplist_expr = (DkmChildVisualizedExpression)expression_;

            Debug.Assert(proplist_expr != null);

            // start could be an expression with the type of any UObject-derived class
            DkmVisualizedExpression start_expr = proplist_expr.Parent;

            string base_expression_str = Utility.GetExpressionFullName(start_expr);

            base_expression_str = Utility.StripExpressionFormatting(base_expression_str);

            ExpressionManipulator obj_em = null;

            // @TODO: Deal with non-pointer start expression
            obj_em = ExpressionManipulator.FromExpression(base_expression_str);

            // Determine if our base expression is <UObject-type>* or <UObject-type>
            bool is_pointer = start_expr.GetDataItem <UObjectDataItem>().IsPointer;

            if (!is_pointer)
            {
                obj_em = obj_em.AddressOf();
            }

            var uclass_em = obj_em.PtrCast(Typ.UObjectBase).PtrMember(Memb.ObjClass);

            if (Config.PropertyDisplayPolicy == Config.PropDisplayPolicyType.BlueprintOnly)
            {
                // See if the actual class of the object instance whose properties we want to enumerate
                // is native or not.
                var is_native_res = UE4Utility.TestUClassFlags(
                    uclass_em.Expression,
                    ClassFlags.Native,
                    start_expr
                    );

                // If the instance class is native, then it can't possibly have any non-native properties,
                // so bail out now.
                // @TODO: Even if the class is not native, we should still be able to avoid doing all the work
                // for enumerating every native property in order to find the non-native ones...
                // @TODO: How best to deal with failed is_native evaluation?
                if (is_native_res.IsValid && is_native_res.Value)
                {
                    return;
                }
            }

            // Get the UStruct part of the UClass, in order to begin iterating properties
            var ustruct_em = uclass_em.PtrCast(Typ.UStruct);
            // Now access PropertyLink member, which is the start of the linked list of properties
            var prop_em = ustruct_em.PtrMember(Memb.FirstProperty);

            uint idx = 0;

            while (true)
            {
                Debug.Print("UE4PV: Invoking raw eval on UProperty* expression");

                var prop_eval = DefaultEE.DefaultEval(prop_em.Expression, start_expr, true) as DkmSuccessEvaluationResult;
                Debug.Assert(prop_eval != null);

                if (prop_eval.Address.Value == 0)
                {
                    // nullptr, end of property list
                    break;
                }

                bool should_skip = false;

                if (!should_skip && Config.PropertyDisplayPolicy == Config.PropDisplayPolicyType.BlueprintOnly)
                {
                    // Check to see if this property is native or blueprint
                    // We can test this by getting the UProperty's Outer, and checking its object flags for RF_Native.
                    var prop_outer_em = prop_em.PtrCast(Typ.UObjectBase).PtrMember(Memb.ObjOuter);

                    // @NOTE: RF_Native has gone, and checking for RF_MarkAsNative never seems to return true...
                    //var is_native_res = UE4Utility.TestUObjectFlags(prop_outer_em.Expression, ObjFlags.Native, start_expr);

                    // So, access class flags instead.
                    // Note that we make the assumption here that the property's outer is a UClass, which should be safe since
                    // we're starting out with a uobject, so all properties, including inherited ones, should be outered to a uclass.
                    var prop_outer_uclass_em = prop_outer_em.PtrCast(Typ.UClass);
                    var is_native_res        = UE4Utility.TestUClassFlags(prop_outer_uclass_em.Expression, ClassFlags.Native, start_expr);

                    // According to UE4 UStruct API docs, property linked list is ordered from most-derived
                    // to base. If so, we should be able to bail out here knowing that having hit a native property,
                    // all following properties must be native too.
                    if (is_native_res.IsValid && is_native_res.Value)
                    {
                        return;
                    }
                }

                if (!should_skip)
                {
                    // @TODO: Here we use the starting expression for the container.
                    // May not work if the root expression was not of pointer type!!
                    var prop_val_eval = GeneratePropertyValueEval(
                        obj_em.Expression,
                        prop_em.Expression,
                        idx,
                        start_expr
                        );
                    if (prop_val_eval != null && !Config.IsPropertyHidden(prop_val_eval.Name))
                    {
                        prop_evals_[prop_val_eval.Name] = prop_val_eval;
                        ++idx;
                    }
                }

                // Advance to next link
                prop_em = prop_em.PtrMember(Memb.NextProperty);
            }
        }
Exemplo n.º 18
0
        public void SetValueAsString(DkmVisualizedExpression visualizedExpression, string value, int timeout, out string errorText) {
            var rawResultHolder = visualizedExpression.GetDataItem<RawEvaluationResultHolder>();
            if (rawResultHolder == null) {
                Debug.Fail("PythonViewNativeVisualizer.GetUnderlyingString passed a visualized expression that does not have an associated RawEvaluationResultHolder.");
                throw new NotSupportedException();
            }

            visualizedExpression.SetValueAsStringCallback(rawResultHolder.RawResult, value, timeout, out errorText);
        }
Exemplo n.º 19
0
        public string GetUnderlyingString(DkmVisualizedExpression visualizedExpression) {
            var rawResultHolder = visualizedExpression.GetDataItem<RawEvaluationResultHolder>();
            if (rawResultHolder == null) {
                Debug.Fail("PythonViewNativeVisualizer.GetUnderlyingString passed a visualized expression that does not have an associated RawEvaluationResultHolder.");
                throw new NotSupportedException();
            }

            return visualizedExpression.GetUnderlyingStringCallback(rawResultHolder.RawResult);
        }
Exemplo n.º 20
0
        public void GetChildren(DkmVisualizedExpression visualizedExpression, int initialRequestSize, DkmInspectionContext inspectionContext, out DkmChildVisualizedExpression[] initialChildren, out DkmEvaluationResultEnumContext enumContext) {
            var rawResultHolder = visualizedExpression.GetDataItem<RawEvaluationResultHolder>();
            if (rawResultHolder == null) {
                Debug.Fail("PythonViewNativeVisualizer.GetChildren passed a visualized expression that does not have an associated RawEvaluationResultHolder.");
                throw new NotSupportedException();
            }
            var rawResult = rawResultHolder.RawResult;

            DkmEvaluationResult[] rawInitialChildren;
            DkmEvaluationResultEnumContext rawEnumContext;
            visualizedExpression.GetChildrenCallback(rawResult, 0, inspectionContext, out rawInitialChildren, out rawEnumContext);

            initialChildren = new DkmChildVisualizedExpression[0];
            enumContext = rawEnumContext;

            if (DebuggerOptions.ShowPythonViewNodes) {
                var pythonViewEvalResult = GetPythonView(visualizedExpression);
                var pythonView = DkmChildVisualizedExpression.Create(
                    visualizedExpression.InspectionContext,
                    visualizedExpression.VisualizerId,
                    visualizedExpression.SourceId,
                    visualizedExpression.StackFrame,
                    visualizedExpression.ValueHome,
                    pythonViewEvalResult,
                    visualizedExpression,
                    (uint)rawEnumContext.Count, null);
                if (pythonView != null) {
                    enumContext = DkmEvaluationResultEnumContext.Create(
                        rawEnumContext.Count + 1,
                        rawEnumContext.StackFrame,
                        rawEnumContext.InspectionContext,
                        new RawEnumContextData { RawContext = rawEnumContext, PythonView = pythonView });
                }
            }
        }
Exemplo n.º 21
0
        void IDkmCustomVisualizer.GetChildren(DkmVisualizedExpression expression, int initialRequestSize, DkmInspectionContext inspectionContext, out DkmChildVisualizedExpression[] initialChildren, out DkmEvaluationResultEnumContext enumContext)
        {
            EvaluationDataItem dataItem = expression.GetDataItem<EvaluationDataItem>();
            if (dataItem == null)
            {
              Debug.Fail("DebugComponent.GetChildren passed a visualized expression that does not have an associated ExpressionDataItem.");
              throw new NotSupportedException();
            }

            initialChildren = new DkmChildVisualizedExpression[0];

            enumContext = DkmEvaluationResultEnumContext.Create(
            dataItem.Visualizer.ChildElementCount,
            expression.StackFrame,
            expression.InspectionContext,
            null);
        }
Exemplo n.º 22
0
        void IDkmCustomVisualizer.GetItems(DkmVisualizedExpression expression, DkmEvaluationResultEnumContext enumContext, int startIndex, int count, out DkmChildVisualizedExpression[] items)
        {
			var data_item = expression.GetDataItem<ExpressionDataItem>();
			var visualizer = data_item.Visualizer;
			Debug.Assert(visualizer != null);

			visualizer.GetChildItems(enumContext, startIndex, count, out items);
        }