{/// <inheritdoc /> int IVsCppDebugUIVisualizer.DisplayValue(uint ownerHwnd, uint visualizerId, IDebugProperty3 debugProperty) { System.Console.Out.WriteLine("enter BsonVisualizerService.DisplayValue"); try { var dkmEvalResult = DkmSuccessEvaluationResult.ExtractFromProperty(debugProperty); //using (var viewModel = new VisualizerWindowViewModel(this.modBuilder)) // { // viewModel.VisualizeSqliteInstance(dkmEvalResult); //} // Invoke plotter window to show vector contents BsonVisualizerWindow plotterWindow = new BsonVisualizerWindow(); plotterWindow.dkmEvalResult = dkmEvalResult; plotterWindow.Text = "Bson window"; plotterWindow.ShowDialog(); //WindowInteropHelper helper = new WindowInteropHelper(plotterWindow); //helper.Owner = (IntPtr)ownerHwnd; // plotterWindow.ShowModal(series); //plotterWindow. } catch (Exception e) { Debug.Fail("Visualization failed: " + e.Message); return(e.HResult); } return(VSConstants.S_OK); }
/// <summary> /// Function that is being called when user wants custom UI visualizer to visualize evaluated expression. /// </summary> /// <param name="ownerHwnd">Owner HWND. It looks like it is always 0.</param> /// <param name="visualizerId">Visualizer type. <see cref="VSUIVisualizerType"/></param> /// <param name="debugProperty">Evaluated expression.</param> /// <returns>S_OK if succeeds, or HRESULT error otherwise.</returns> public int DisplayValue(uint ownerHwnd, uint visualizerId, IDebugProperty3 debugProperty) { VSUIVisualizerType visualizerType = (VSUIVisualizerType)visualizerId; try { // Extract data DkmSuccessEvaluationResult evaluationResult = DkmSuccessEvaluationResult.ExtractFromProperty(debugProperty); int processId = evaluationResult.InspectionSession?.Process?.LivePart?.Id ?? 0; string moduleName = evaluationResult.ExternalModules?.FirstOrDefault()?.Module?.Name ?? evaluationResult.StackFrame?.ModuleInstance?.Module?.Name; string typeString = evaluationResult.Type; ulong? address = evaluationResult.Address?.Value; string fullName = evaluationResult.FullName; if (!string.IsNullOrEmpty(typeString) && !string.IsNullOrEmpty(moduleName) && address.HasValue) { // Create variable Process process = Process.All.First(p => p.SystemId == processId); Module module = process.ModulesByName[System.IO.Path.GetFileNameWithoutExtension(moduleName)]; CodeType codeType = VSCustomVisualizerEvaluator.ResolveCodeType(process, module, typeString); Variable variable = codeType.IsPointer ? Variable.CreatePointer(codeType, address.Value, fullName) : Variable.Create(codeType, address.Value, fullName); // Open visualizer window switch (visualizerType) { case VSUIVisualizerType.InteractiveWindow: // Add this variable to interactive window and make it visible. VSInteractiveWindowCommand.Instance.ShowToolWindow(); AddVariable("temp", variable, VSInteractiveWindowCommand.Instance.InteractiveWindowTool.InteractiveControl.ContentControl); break; default: case VSUIVisualizerType.ModalWindow: // Open new modal window that will visualize this variable UI.InteractiveWindow.ShowModalWindow((interactiveWindow) => { AddVariable("result", variable, interactiveWindow.ContentControl); }); break; } } } catch (Exception ex) { return(ex.HResult); } return(0); }
/// <inheritdoc /> int IVsCppDebugUIVisualizer.DisplayValue(uint ownerHwnd, uint visualizerId, IDebugProperty3 debugProperty) { try { var dkmEvalResult = DkmSuccessEvaluationResult.ExtractFromProperty(debugProperty); using (var viewModel = new VisualizerWindowViewModel(this.modBuilder)) { viewModel.VisualizeSqliteInstance(dkmEvalResult); } } catch (Exception e) { Debug.Fail("Visualization failed: " + e.Message); return(e.HResult); } return(VSConstants.S_OK); }
public int DisplayValue(uint ownerHwnd, uint visualizerId, IDebugProperty3 debugProperty) { DEBUG_PROPERTY_INFO[] rawValue = new DEBUG_PROPERTY_INFO[1]; debugProperty.GetPropertyInfo(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_RAW, 10, 10000, null, 0, rawValue); //IEnumDebugPropertyInfo2 propInfo; //Guid filter = Guid.Empty; //int enumResult = debugProperty.EnumChildren(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_RAW, 10, ref filter, enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_ALL, null, 10000, out propInfo); //uint bufferLength; //debugProperty.GetStringCharLength(out bufferLength); //ushort[] buffer = new ushort[bufferLength]; //uint fetched; //debugProperty.GetStringChars(bufferLength, buffer, out fetched); DkmSuccessEvaluationResult dkmEvalResult = DkmSuccessEvaluationResult.ExtractFromProperty(debugProperty); //DkmInspectionContext inspectionContext = DkmInspectionContext.Create( // dkmEvalResult.InspectionSession, // dkmEvalResult.RuntimeInstance, // dkmEvalResult.InspectionContext.Thread, // 1000, // DkmEvaluationFlags.None, // DkmFuncEvalFlags.None, // 10, // dkmEvalResult.InspectionContext.Language, // null); try { PointCloudVisualizerControl.Instance.AddItem(dkmEvalResult.FullName, parseMembers(dkmEvalResult)); } catch (Exception e) { Debug.Fail("Visualization failed: " + e.Message); return(e.HResult); } return(VSConstants.S_OK); }