Browse Source

Removed dependency on Value.ExpressionTree from Grid visualizer and WatchPad.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4956 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Martin Koníček 16 years ago
parent
commit
0c173cf688
  1. 5
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/WatchPad.cs
  2. 22
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  3. 16
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/GridVisualizer/GridVisualizerWindow.xaml.cs

5
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/WatchPad.cs

@ -197,8 +197,9 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -197,8 +197,9 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
foreach (var nod in watches) {
try {
LoggingService.Info("Evaluating: " + (string.IsNullOrEmpty(nod.Name) ? "is null or empty!" : nod.Name));
Value val = ExpressionEvaluator.Evaluate(nod.Name, nod.Language, debuggedProcess.SelectedStackFrame);
ExpressionNode valNode = new ExpressionNode(null, nod.Name, val.ExpressionTree);
var nodExpression = debugger.GetExpression(nod.Name);
//Value val = ExpressionEvaluator.Evaluate(nod.Name, nod.Language, debuggedProcess.SelectedStackFrame);
ExpressionNode valNode = new ExpressionNode(null, nod.Name, nodExpression);
nodes.Add(new TreeViewVarNode(debuggedProcess, watchList, valNode));
} catch (GetValueException) {
string error = String.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.InvalidExpression}"), nod.Name);

22
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -37,6 +37,7 @@ @@ -37,6 +37,7 @@
//
#endregion
using ICSharpCode.NRefactory.Ast;
using System;
using System.Diagnostics;
using System.Drawing;
@ -44,7 +45,6 @@ using System.IO; @@ -44,7 +45,6 @@ using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;
using Debugger;
using Debugger.AddIn;
using Debugger.AddIn.TreeModel;
@ -341,9 +341,20 @@ namespace ICSharpCode.SharpDevelop.Services @@ -341,9 +341,20 @@ namespace ICSharpCode.SharpDevelop.Services
{
if (!CanEvaluate) {
return null;
} else {
return ExpressionEvaluator.Evaluate(variableName, SupportedLanguage.CSharp, debuggedProcess.SelectedStackFrame);
}
return ExpressionEvaluator.Evaluate(variableName, SupportedLanguage.CSharp, debuggedProcess.SelectedStackFrame);
}
/// <summary>
/// Gets Expression for given variable. Can throw GetValueException.
/// <exception cref="GetValueException">Thrown when getting expression fails. Exception message explains reason.</exception>
/// </summary>
public Expression GetExpression(string variableName)
{
if (!CanEvaluate) {
throw new GetValueException("Cannot evaluate now - debugged process is either null or running or has no selected stack frame");
}
return ExpressionEvaluator.ParseExpression(variableName, SupportedLanguage.CSharp);
}
public bool IsManaged(int processId)
@ -387,11 +398,8 @@ namespace ICSharpCode.SharpDevelop.Services @@ -387,11 +398,8 @@ namespace ICSharpCode.SharpDevelop.Services
/// </summary>
public object GetTooltipControl(string variableName)
{
if (!CanEvaluate) {
return null;
}
try {
var tooltipExpression = ExpressionEvaluator.ParseExpression(variableName, SupportedLanguage.CSharp);
var tooltipExpression = GetExpression(variableName);
ExpressionNode expressionNode = new ExpressionNode(ExpressionNode.GetImageForLocalVariable(), variableName, tooltipExpression);
return new DebuggerTooltipControl(expressionNode);
} catch (GetValueException) {

16
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/GridVisualizer/GridVisualizerWindow.xaml.cs

@ -111,29 +111,31 @@ namespace Debugger.AddIn.Visualizers.GridVisualizer @@ -111,29 +111,31 @@ namespace Debugger.AddIn.Visualizers.GridVisualizer
if (listViewScroller != null) {
listViewScroller.ScrollToVerticalOffset(0);
}
Value val = null;
Value shownValue = null;
ICSharpCode.NRefactory.Ast.Expression shownExpr = null;
try {
val = debuggerService.GetValueFromName(txtExpression.Text);
shownExpr = debuggerService.GetExpression(txtExpression.Text);
shownValue = shownExpr.Evaluate(debuggerService.DebuggedProcess);
} catch(GetValueException) {
// display ex.Message
}
if (val != null && !val.IsNull) {
if (shownValue != null && !shownValue.IsNull) {
GridValuesProvider gridValuesProvider;
// Value is IList
DebugType iListType, listItemType;
if (val.Type.ResolveIListImplementation(out iListType, out listItemType)) {
gridValuesProvider = CreateListValuesProvider(val.ExpressionTree, iListType, listItemType);
if (shownValue.Type.ResolveIListImplementation(out iListType, out listItemType)) {
gridValuesProvider = CreateListValuesProvider(shownExpr, iListType, listItemType);
} else {
// Value is IEnumerable
DebugType iEnumerableType, itemType;
if (val.Type.ResolveIEnumerableImplementation(out iEnumerableType, out itemType)) {
if (shownValue.Type.ResolveIEnumerableImplementation(out iEnumerableType, out itemType)) {
// original
/*var lazyListViewWrapper = new LazyItemsControl<ObjectValue>(this.listView, initialIEnumerableItemsCount);
var enumerableValuesProvider = new EnumerableValuesProvider(val.ExpressionTree, iEnumerableType, itemType);
lazyListViewWrapper.ItemsSource = new VirtualizingIEnumerable<ObjectValue>(enumerableValuesProvider.ItemsSource);
gridValuesProvider = enumerableValuesProvider;*/
DebugType debugListType;
var debugListExpression = DebuggerHelpers.CreateDebugListExpression(val.ExpressionTree, itemType, out debugListType);
var debugListExpression = DebuggerHelpers.CreateDebugListExpression(shownExpr, itemType, out debugListType);
gridValuesProvider = CreateListValuesProvider(debugListExpression, debugListType, itemType);
} else {
// Value cannot be displayed in GridVisualizer

Loading…
Cancel
Save