Browse Source

first workable debugger

pull/191/merge
Eusebiu Marcu 16 years ago
parent
commit
f4bc253e89
  1. 6
      Debugger/Debugger.Core/NRefactory/Ast/ExpressionExtensionMethods.cs
  2. 13
      Debugger/ILSpy.Debugger/AvalonEdit/TextEditorWeakEventManager.cs
  3. 4
      Debugger/ILSpy.Debugger/Services/Debugger/DebuggerService.cs
  4. 13
      Debugger/ILSpy.Debugger/ToolTips/TextEditorListener.cs
  5. 1
      ILSpy/TextView/DecompilerTextView.cs

6
Debugger/Debugger.Core/NRefactory/Ast/ExpressionExtensionMethods.cs

@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.Ast @@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.Ast
if (val != null && val.GetType().FullName == castTo.FullName)
return expresion;
}
return new CastExpression() { Expression = expresion.Parenthesize(), Type = castTo.GetTypeReference() };
return new CastExpression() { Expression = expresion.Clone().Parenthesize(), Type = castTo.GetTypeReference() };
}
public static Expression GetExpression(this DebugLocalVariableInfo locVar)
@ -95,7 +95,7 @@ namespace ICSharpCode.NRefactory.Ast @@ -95,7 +95,7 @@ namespace ICSharpCode.NRefactory.Ast
if (memberInfo.IsStatic) {
target = new TypeReferenceExpression() { Type = memberInfo.DeclaringType.GetTypeReference() };
} else {
target = expresion.Clone().CastTo((DebugType)memberInfo.DeclaringType);
target = CastTo(expresion, (DebugType)memberInfo.DeclaringType);
}
if (memberInfo is DebugFieldInfo) {
@ -141,7 +141,7 @@ namespace ICSharpCode.NRefactory.Ast @@ -141,7 +141,7 @@ namespace ICSharpCode.NRefactory.Ast
throw new DebuggerException("Incorrect number of arguments");
List<Expression> typedArgs = new List<Expression>(args.Length);
for(int i = 0; i < args.Length; i++) {
typedArgs.Add(args[i].Clone().CastTo((DebugType)method.GetParameters()[i].ParameterType));
typedArgs.Add(CastTo(args[i], (DebugType)method.GetParameters()[i].ParameterType));
}
return typedArgs;
}

13
Debugger/ILSpy.Debugger/AvalonEdit/TextEditorWeakEventManager.cs

@ -50,5 +50,18 @@ namespace ILSpy.Debugger.AvalonEdit @@ -50,5 +50,18 @@ namespace ILSpy.Debugger.AvalonEdit
source.MouseHoverStopped += DeliverEvent;
}
}
public sealed class MouseDown : WeakEventManagerBase<MouseDown, TextEditor>
{
protected override void StopListening(TextEditor source)
{
source.MouseDown -= DeliverEvent;
}
protected override void StartListening(TextEditor source)
{
source.MouseDown += DeliverEvent;
}
}
}
}

4
Debugger/ILSpy.Debugger/Services/Debugger/DebuggerService.cs

@ -210,7 +210,11 @@ namespace ILSpy.Debugger.Services @@ -210,7 +210,11 @@ namespace ILSpy.Debugger.Services
e.ContentToShow = null;
}
else {
try {
e.ContentToShow = currentDebugger.GetTooltipControl(e.LogicalPosition, variable);
} catch {
return;
}
}
// FIXME Do proper parsing

13
Debugger/ILSpy.Debugger/ToolTips/TextEditorListener.cs

@ -63,9 +63,21 @@ namespace ILSpy.Debugger.ToolTips @@ -63,9 +63,21 @@ namespace ILSpy.Debugger.ToolTips
OnMouseHoverStopped((MouseEventArgs)e);
}
if (managerType == typeof(ILSpy.Debugger.AvalonEdit.TextEditorWeakEventManager.MouseDown)) {
OnMouseDown((MouseEventArgs)e);
}
return true;
}
void OnMouseDown(MouseEventArgs mouseEventArgs0)
{
if (toolTip != null)
toolTip.IsOpen = false;
TryCloseExistingPopup(true);
}
void OnMouseHoverStopped(MouseEventArgs e)
{
if (toolTip != null)
@ -185,7 +197,6 @@ namespace ILSpy.Debugger.ToolTips @@ -185,7 +197,6 @@ namespace ILSpy.Debugger.ToolTips
return popup;
}
bool IWeakEventListener.ReceiveWeakEvent(Type managerType, object sender, EventArgs e)
{
return ReceiveWeakEvent(managerType, sender, e);

1
ILSpy/TextView/DecompilerTextView.cs

@ -86,6 +86,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -86,6 +86,7 @@ namespace ICSharpCode.ILSpy.TextView
// wire the mouse events
TextEditorWeakEventManager.MouseHover.AddListener(textEditor, TextEditorListener.Instance);
TextEditorWeakEventManager.MouseHoverStopped.AddListener(textEditor, TextEditorListener.Instance);
TextEditorWeakEventManager.MouseDown.AddListener(textEditor, TextEditorListener.Instance);
textEditor.TextArea.TextView.VisualLinesChanged += (s, e) => iconMargin.InvalidateVisual();
}

Loading…
Cancel
Save