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; } }
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); }
public void EvaluateChildren(DkmChildVisualizedExpression[] output, int startIndex, out int numWritten) { DkmEvaluationResult evalResult = evaluator_(name_, startIndex); EvaluationDataItem originalDataItem = evalResult.GetDataItem <EvaluationDataItem>(); DkmChildVisualizedExpression childExpr = DkmChildVisualizedExpression.Create( expression_.InspectionContext, expression_.VisualizerId, expression_.SourceId, expression_.StackFrame, DkmFakeValueHome.Create(0), evalResult, expression_, (uint)startIndex, originalDataItem); output[startIndex] = childExpr; numWritten = 1; }
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); }
public void EvaluateChildren(DkmChildVisualizedExpression[] output, int startIndex, out int numWritten) { numWritten = 0; if (mode_ == ChildDisplayMode.Inline) { CreateDefaultEnumContext(); int count = ChildCount; DkmEvaluationResult[] results = new DkmEvaluationResult[count]; expression_.GetItemsCallback(defEnumContext_, 0, count, out results); for (int i = 0; i < count; ++i) { DkmSuccessEvaluationResult successResult = results[i] as DkmSuccessEvaluationResult; DkmExpressionValueHome home = null; if (successResult != null && successResult.Address != null) { home = DkmPointerValueHome.Create(successResult.Address.Value); } else { home = DkmFakeValueHome.Create(0); } output[startIndex + i] = DkmChildVisualizedExpression.Create( defEnumContext_.InspectionContext, Guids.CustomVisualizer.ForceDefault, expression_.SourceId, defEnumContext_.StackFrame, home, results[i], expression_, (uint)startIndex, null); EvaluationDataItem originalDataItem = results[i].GetDataItem <EvaluationDataItem>(); } numWritten = count; } else { numWritten = 1; } }