Ejemplo n.º 1
0
        void IDkmClrResultProvider.GetItems(DkmEvaluationResultEnumContext enumContext, DkmWorkList workList, int startIndex, int count, DkmCompletionRoutine<DkmEvaluationEnumAsyncResult> completionRoutine)
        {
            var dataItem = enumContext.GetDataItem<EnumContextDataItem>();
            if (dataItem == null)
            {
                // We don't know about this result.  Call next implementation
                enumContext.GetItems(workList, startIndex, count, completionRoutine);
                return;
            }

            GetItemsAndContinue(dataItem.EvalResultDataItem, workList, startIndex, count, enumContext.InspectionContext, completionRoutine);
        }
Ejemplo n.º 2
0
        public void GetItems(DkmEvaluationResultEnumContext enumContext, DkmWorkList workList, int startIndex, int count, DkmCompletionRoutine<DkmEvaluationEnumAsyncResult> completionRoutine) {
            var evalResults = enumContext.GetDataItem<EvaluationResults>();
            if (evalResults == null) {
                Debug.Fail("GetItems called on a DkmEvaluationResultEnumContext without an associated EvaluationResults.");
                throw new NotSupportedException();
            }

            var result = evalResults.Results.Skip(startIndex).Take(count).ToArray();
            completionRoutine(new DkmEvaluationEnumAsyncResult(result));
        }
Ejemplo n.º 3
0
        void IDkmClrResultProvider.GetItems(DkmEvaluationResultEnumContext enumContext, DkmWorkList workList, int startIndex, int count, DkmCompletionRoutine<DkmEvaluationEnumAsyncResult> completionRoutine)
        {
            try
            {
                var dataItem = enumContext.GetDataItem<EnumContextDataItem>();
                if (dataItem == null)
                {
                    // We don't know about this result.  Call next implementation
                    enumContext.GetItems(workList, startIndex, count, completionRoutine);
                    return;
                }

                completionRoutine(GetItems(enumContext.InspectionContext, dataItem.EvalResultDataItem, startIndex, count));
            }
            catch (Exception e) when (ExpressionEvaluatorFatalError.CrashIfFailFastEnabled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }
Ejemplo n.º 4
0
        public void GetItems(DkmVisualizedExpression visualizedExpression, DkmEvaluationResultEnumContext enumContext, int startIndex, int count, out DkmChildVisualizedExpression[] items) {
            if (count == 0) {
                items = new DkmChildVisualizedExpression[0];
                return;
            }

            var rawContextData = enumContext.GetDataItem<RawEnumContextData>();
            var rawContext = rawContextData != null ? rawContextData.RawContext : enumContext;

            var result = new List<DkmChildVisualizedExpression>(count);
            if (rawContextData != null && rawContextData.PythonView != null) {
                if (startIndex == 0) {
                    result.Add(rawContextData.PythonView);
                    --count;
                } else {
                    --startIndex;
                }
            }

            DkmEvaluationResult[] rawItems;
            visualizedExpression.GetItemsCallback(rawContext, startIndex, count, out rawItems);
            for (int i = 0; i < rawItems.Length; ++i) {
                var rawItem = rawItems[i];

                var rawSuccessItem = rawItem as DkmSuccessEvaluationResult;
                DkmExpressionValueHome home = null;
                if (rawSuccessItem != null && rawSuccessItem.Address != null) {
                    home = DkmPointerValueHome.Create(rawSuccessItem.Address.Value);
                } else {
                    home = DkmFakeValueHome.Create(0);
                }

                var item = DkmChildVisualizedExpression.Create(
                    visualizedExpression.InspectionContext,
                    visualizedExpression.VisualizerId,
                    visualizedExpression.SourceId,
                    visualizedExpression.StackFrame,
                    home,
                    rawItem,
                    visualizedExpression,
                    (uint)(startIndex + i),
                    rawItem.GetDataItem<RawEvaluationResultHolder>());
                result.Add(item);
            }

            items = result.ToArray();
        }
Ejemplo n.º 5
0
        void IDkmClrResultProvider.GetItems(DkmEvaluationResultEnumContext enumContext, DkmWorkList workList, int startIndex, int count, DkmCompletionRoutine<DkmEvaluationEnumAsyncResult> completionRoutine)
        {
            var enumContextDataItem = enumContext.GetDataItem<EnumContextDataItem>();
            if (enumContextDataItem == null)
            {
                // We don't know about this result.  Call next implementation
                enumContext.GetItems(workList, startIndex, count, completionRoutine);
                return;
            }

            var evaluationResult = enumContextDataItem.Result;
            var dataItem = evaluationResult.GetDataItem<EvalResultDataItem>();
            var expansion = dataItem.Expansion;
            if (expansion == null)
            {
                completionRoutine(new DkmEvaluationEnumAsyncResult(new DkmEvaluationResult[0]));
                return;
            }

            var inspectionContext = enumContext.InspectionContext;

            var rows = ArrayBuilder<EvalResult>.GetInstance();
            int index = 0;
            expansion.GetRows(this, rows, inspectionContext, dataItem, dataItem.Value, startIndex, count, visitAll: false, index: ref index);
            var numRows = rows.Count;
            Debug.Assert(count >= numRows);
            var results = new DkmEvaluationResult[numRows];
            CompletionRoutine<Exception> onException = e => completionRoutine(DkmEvaluationEnumAsyncResult.CreateErrorResult(e));
            var wl = new WorkList(workList, onException);
            wl.ContinueWith(() =>
                GetEvaluationResultsAndContinue(evaluationResult, rows, results, 0, numRows, wl, inspectionContext,
                    () =>
                    wl.ContinueWith(
                        () =>
                        {
                            completionRoutine(new DkmEvaluationEnumAsyncResult(results));
                            rows.Free();
                        }),
                    onException));
        }
Ejemplo n.º 6
0
		public override void GetChildItems(DkmEvaluationResultEnumContext enumContext, int start, int count, out DkmChildVisualizedExpression[] items)
		{
			// Cap the requested number to the total remaining from startIndex
			count = Math.Min(count, enumContext.Count - start);
			items = new DkmChildVisualizedExpression[count];
			uint idx = 0;

			// Retrieve the default expansion enum context
			var default_data = enumContext.GetDataItem<DefaultEnumContextDataItem>();

			if (start < default_data.Context.Count)
			{
				// Requesting default children

				int default_count = Math.Min(count, default_data.Context.Count - start);
				DkmEvaluationResult[] default_evals;
				expression_.GetItemsCallback(default_data.Context, start, default_count, out default_evals);
				for (int dft_idx = 0; dft_idx < default_count; ++dft_idx, ++idx)
				{
					DkmSuccessEvaluationResult success_eval = default_evals[dft_idx] as DkmSuccessEvaluationResult;
					DkmExpressionValueHome home = null;
					if (success_eval != null && success_eval.Address != null)
					{
						home = DkmPointerValueHome.Create(success_eval.Address.Value);
					}
					else
					{
						home = DkmFakeValueHome.Create(0);
					}

					items[idx] = DkmChildVisualizedExpression.Create(
						enumContext.InspectionContext,
						expression_.VisualizerId,	// @TODO: Check this is what we want. Will we get callbacks for it, regardless of its type?
						expression_.SourceId,
						enumContext.StackFrame,
						home,
						default_evals[dft_idx],
						expression_,
						(uint)start,
						null
						);
				}
			}

			if (start + count > default_data.Context.Count)
			{
				// Requesting custom children
				// @NOTE: Currently just assuming only 1 custom child (prop list) and hard coding as such.

				// DkmSuccessEvaluationResult.ExtractFromProperty(IDebugProperty3!!!!!!!) ...............................................

				// @NOTE: Had thought could just create an expression with a null evaluation
				// inside it, and by giving it a visualizer guid, the system would call back
				// to us to evaluate the expression. Seems not to work though, I guess because the
				// visualizer guid identifies the visualizer but not the containing component,
				// and since the expression itself doesn't have a type, it can't know that it 
				// should call our component.
				DkmEvaluationResult eval = DkmSuccessEvaluationResult.Create(
					enumContext.InspectionContext,
					enumContext.StackFrame,
					Resources.UE4PropVis.IDS_DISP_BLUEPRINTPROPERTIES,
					Resources.UE4PropVis.IDS_DISP_BLUEPRINTPROPERTIES,
					DkmEvaluationResultFlags.ReadOnly | DkmEvaluationResultFlags.Expandable,
					"",	// @TODO: something like "[<count> properties]"
					null,
					"",	// Type column
					DkmEvaluationResultCategory.Other,
					DkmEvaluationResultAccessType.None,
					DkmEvaluationResultStorageType.None,
					DkmEvaluationResultTypeModifierFlags.None,
					null,
					null,
					null,
					null
					);

				// This child is just for organization and does not correspond to anything in memory.
				DkmExpressionValueHome valueHome = DkmFakeValueHome.Create(0);

				var prop_list_expr = DkmChildVisualizedExpression.Create(
					enumContext.InspectionContext,
					Guids.Visualizer.PropertyList,
					// Associate the expression with ourselves, since we created it
					Guids.Component.VisualizerComponent,
					enumContext.StackFrame,
					valueHome,
					eval,
					expression_,
					idx,
					null
					);

				// Create a visualizer for the property list, and attach it to the expression.
				var prop_list_visualizer = new PropertyListVisualizer(prop_list_expr, access_ctx_);
				prop_list_expr.SetDataItem(DkmDataCreationDisposition.CreateAlways, new ExpressionDataItem(prop_list_visualizer));

				items[idx] = prop_list_expr;
            }
		}