Exemplo n.º 1
0
		/// <summary>
		/// Gets the tooltip control that shows the value of given variable.
		/// Return null if no tooltip is available.
		/// </summary>
		public DebuggerGridControl GetTooltipControl(string variableName)
		{
			ValueNode valueNode;
			try {
				Value val = GetValueFromName(variableName);
				if (val == null) return null;
				valueNode = new ValueNode(val);
			} catch (GetValueException) {
				return null;
			}
			
			try {
				currentTooltipRow = new DynamicTreeDebuggerRow(DebuggedProcess, valueNode);
			} catch (AbortedBecauseDebuggeeResumedException) {
				return null;
			}
			currentTooltipExpression = valueNode.Expression;
			return new DebuggerGridControl(currentTooltipRow);
		}
Exemplo n.º 2
0
		public void HandleToolTipRequest(ToolTipRequestEventArgs e)
		{
			if (!(IsDebugging && CurrentProcess.IsPaused))
				return;
			var resolveResult = e.ResolveResult;
			if (resolveResult == null)
				return;
			if (resolveResult is LocalResolveResult || resolveResult is MemberResolveResult) {
				string text = string.Empty;
				try {
					text = new ResolveResultPrettyPrinter().Print(resolveResult);
				} catch (NotImplementedException ex) {
					SD.Log.Warn(ex);
				}
				Func<Value> getValue = delegate {
					ExpressionEvaluationVisitor eval = new ExpressionEvaluationVisitor(CurrentStackFrame, EvalThread, CurrentStackFrame.AppDomain.Compilation);
					return eval.Convert(resolveResult);
				};
				try {
					var rootNode = new ValueNode(ClassBrowserIconService.LocalVariable, text, getValue);
					e.SetToolTip(new DebuggerTooltipControl(rootNode));
				} catch (InvalidOperationException ex) {
					SD.Log.Warn(ex);
				}
			}
		}
Exemplo n.º 3
0
		public override void RefreshPad()
		{
			if (debuggedProcess == null || debuggedProcess.IsRunning || debuggedProcess.SelectedStackFrame == null)
				return;
			
			using(new PrintTimes("Watch Pad refresh")) {
				try {
					watchList.BeginUpdate();
					Utils.DoEvents(debuggedProcess);
					List<TreeViewVarNode> nodes = new List<TreeViewVarNode>();
					
					foreach (var nod in watches) {
						try {
							LoggingService.Info("Evaluating: " + (string.IsNullOrEmpty(nod.Name) ? "is null or empty!" : nod.Name));
							Value val = AstEvaluator.Evaluate(nod.Name, SupportedLanguage.CSharp, debuggedProcess.SelectedStackFrame);
							ValueNode valNode = new ValueNode(val);
							valNode.SetName(nod.Name);
							nodes.Add(new TreeViewVarNode(debuggedProcess, watchList, valNode));
						} catch (GetValueException) {
							string error = String.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.InvalidExpression}"), nod.Name);
							ErrorInfoNode infoNode = new ErrorInfoNode(nod.Name, error);
							nodes.Add(new TreeViewVarNode(debuggedProcess, watchList, infoNode));
						}
					}
					
					watchList.Root.Children.Clear();
					
					foreach (TreeViewVarNode nod in nodes)
						watchList.Root.Children.Add(nod);
				} catch(AbortedBecauseDebuggeeResumedException) {
				} catch(Exception ex) {
					if (debuggedProcess == null || debuggedProcess.HasExited) {
						// Process unexpectedly exited
					} else {
						MessageService.ShowError(ex);
					}
				}
			}
			
			watchList.EndUpdate();
		}