Browse Source

save the ILRange on a breakpoint bookmark - useful when syncing the bookmarks.

show tooltip on BreakpointBookmark.
pull/191/merge
Eusebiu Marcu 15 years ago
parent
commit
f88afd0f0a
  1. 8
      Debugger/ILSpy.Debugger/AvalonEdit/IconBarMargin.cs
  2. 2
      Debugger/ILSpy.Debugger/Bookmarks/BookmarkManager.cs
  3. 18
      Debugger/ILSpy.Debugger/Bookmarks/BreakpointBookmark.cs
  4. 9
      Debugger/ILSpy.Debugger/Services/Debugger/DebuggerService.cs

8
Debugger/ILSpy.Debugger/AvalonEdit/IconBarMargin.cs

@ -190,6 +190,13 @@ namespace ICSharpCode.ILSpy.Debugger.AvalonEdit @@ -190,6 +190,13 @@ namespace ICSharpCode.ILSpy.Debugger.AvalonEdit
dragStarted = true;
InvalidateVisual();
}
BreakpointBookmark bm = BookmarkManager.Bookmarks.Find(
b => DebugData.CodeMappings.ContainsKey(b.MemberReference.FullName) &&
b.LineNumber == GetLineFromMousePosition(e)
&& b is BreakpointBookmark) as BreakpointBookmark;
this.ToolTip = (bm != null) ? bm.Tooltip : null;
}
protected override void OnMouseUp(MouseButtonEventArgs e)
@ -235,6 +242,7 @@ namespace ICSharpCode.ILSpy.Debugger.AvalonEdit @@ -235,6 +242,7 @@ namespace ICSharpCode.ILSpy.Debugger.AvalonEdit
DebuggerService.ToggleBreakpointAt(
member,
line,
instruction.ILInstructionOffset,
DebugData.Language);
break;
}

2
Debugger/ILSpy.Debugger/Bookmarks/BookmarkManager.cs

@ -206,7 +206,7 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks @@ -206,7 +206,7 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
int line;
if (newMappings[name].GetSourceCodeFromMetadataTokenAndOffset(token, instruction.ILInstructionOffset.From, out memberReference, out line)) {
// 2. create breakpoint for new languages
var bookmark = new BreakpointBookmark(memberReference, new AstLocation(line, 0), BreakpointAction.Break, newLanguage);
var bookmark = new BreakpointBookmark(memberReference, new AstLocation(line, 0), instruction.ILInstructionOffset, BreakpointAction.Break, newLanguage);
AddMark(bookmark);
}
}

18
Debugger/ILSpy.Debugger/Bookmarks/BreakpointBookmark.cs

@ -5,9 +5,10 @@ using System; @@ -5,9 +5,10 @@ using System;
using System.Windows.Media;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.Decompiler;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.Decompiler.ILAst;
using ICSharpCode.ILSpy.Debugger.AvalonEdit;
using ICSharpCode.ILSpy.Debugger.Services;
using ICSharpCode.NRefactory.CSharp;
using Mono.Cecil;
namespace ICSharpCode.ILSpy.Debugger.Bookmarks
@ -23,7 +24,6 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks @@ -23,7 +24,6 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
{
bool isHealthy = true;
bool isEnabled = true;
string tooltip;
BreakpointAction action = BreakpointAction.Break;
public DecompiledLanguages Language { get; private set; }
@ -40,6 +40,8 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks @@ -40,6 +40,8 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
}
}
public ILRange ILRange { get; private set; }
public virtual bool IsHealthy {
get {
return isHealthy;
@ -68,16 +70,14 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks @@ -68,16 +70,14 @@ namespace ICSharpCode.ILSpy.Debugger.Bookmarks
public event EventHandler IsEnabledChanged;
public string Tooltip {
get { return tooltip; }
set { tooltip = value; }
}
public string Tooltip { get; private set; }
public BreakpointBookmark(MemberReference member, AstLocation location, BreakpointAction action, DecompiledLanguages language) : base(member, location)
public BreakpointBookmark(MemberReference member, AstLocation location, ILRange range, BreakpointAction action, DecompiledLanguages language) : base(member, location)
{
this.action = action;
this.tooltip = language.ToString();
this.Language = language;
this.ILRange = range;
this.Tooltip = string.Format("Language:{0}, Line:{1}, IL range:{2}-{3}", language.ToString(), location.Line, range.From, range.To);
this.Language = language;
}
public override ImageSource Image {

9
Debugger/ILSpy.Debugger/Services/Debugger/DebuggerService.cs

@ -5,9 +5,10 @@ using System; @@ -5,9 +5,10 @@ using System;
using System.Collections.Generic;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.Decompiler;
using ICSharpCode.NRefactory.CSharp.Resolver;
using ICSharpCode.Decompiler.ILAst;
using ICSharpCode.ILSpy.Debugger.Bookmarks;
using ICSharpCode.ILSpy.Debugger.Tooltips;
using ICSharpCode.NRefactory.CSharp.Resolver;
using Mono.Cecil;
namespace ICSharpCode.ILSpy.Debugger.Services
@ -163,12 +164,12 @@ namespace ICSharpCode.ILSpy.Debugger.Services @@ -163,12 +164,12 @@ namespace ICSharpCode.ILSpy.Debugger.Services
}
}
public static void ToggleBreakpointAt(MemberReference member, int lineNumber, DecompiledLanguages language)
public static void ToggleBreakpointAt(MemberReference member, int lineNumber, ILRange range, DecompiledLanguages language)
{
BookmarkManager.ToggleBookmark(
member.FullName.Replace("::", "."), lineNumber,
member.FullName, lineNumber,
b => b.CanToggle && b is BreakpointBookmark,
location => new BreakpointBookmark(member, location, BreakpointAction.Break, language));
location => new BreakpointBookmark(member, location, range, BreakpointAction.Break, language));
}
/* TODO: reimplement this stuff

Loading…
Cancel
Save