diff --git a/Debugger/Debugger.Core/BreakpointCollection.cs b/Debugger/Debugger.Core/BreakpointCollection.cs index 41912b8ad..25a2c92eb 100644 --- a/Debugger/Debugger.Core/BreakpointCollection.cs +++ b/Debugger/Debugger.Core/BreakpointCollection.cs @@ -66,6 +66,13 @@ namespace Debugger base.Remove(breakpoint); } + public void RemoveAll() + { + for (int i = Count - 1; i >= 0; --i) { + this[i].Remove(); + } + } + protected override void OnRemoved(Breakpoint breakpoint) { breakpoint.Deactivate(); diff --git a/Debugger/ILSpy.Debugger/AvalonEdit/IconBarMargin.cs b/Debugger/ILSpy.Debugger/AvalonEdit/IconBarMargin.cs index fff248991..2897bbcd5 100644 --- a/Debugger/ILSpy.Debugger/AvalonEdit/IconBarMargin.cs +++ b/Debugger/ILSpy.Debugger/AvalonEdit/IconBarMargin.cs @@ -80,6 +80,9 @@ namespace ILSpy.Debugger.AvalonEdit foreach (var bm in BookmarkManager.Bookmarks) { if (CurrentType == null || bm.TypeName != CurrentType.FullName) continue; + if (bm is BreakpointBookmark && + ((BreakpointBookmark)bm).Language != DebuggerService.CurrentDebugger.Language) + continue; int line = bm.LineNumber; BookmarkBase existingBookmark; diff --git a/Debugger/ILSpy.Debugger/Bookmarks/BreakpointBookmark.cs b/Debugger/ILSpy.Debugger/Bookmarks/BreakpointBookmark.cs index c0b1a839b..e0689e16b 100644 --- a/Debugger/ILSpy.Debugger/Bookmarks/BreakpointBookmark.cs +++ b/Debugger/ILSpy.Debugger/Bookmarks/BreakpointBookmark.cs @@ -38,7 +38,7 @@ namespace ILSpy.Debugger.Bookmarks string tooltip; BreakpointAction action = BreakpointAction.Break; - public DecompiledLanguages Laguage { get; private set; } + public DecompiledLanguages Language { get; private set; } public BreakpointAction Action { get { @@ -89,7 +89,7 @@ namespace ILSpy.Debugger.Bookmarks { this.action = action; this.tooltip = language.ToString(); - this.Laguage = language; + this.Language = language; } public override ImageSource Image { diff --git a/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs b/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs index 4f871ff5f..ef25e5223 100644 --- a/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs +++ b/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs @@ -500,7 +500,7 @@ namespace ILSpy.Debugger.Services var storage = CodeMappings.GetStorage(Language); - if (Language == bookmark.Laguage) { + if (Language == bookmark.Language) { uint token; SourceCodeMapping map = storage.GetInstructionByTypeAndLine( diff --git a/Debugger/ILSpy.Debugger/Services/ParserService/ParserService.cs b/Debugger/ILSpy.Debugger/Services/ParserService/ParserService.cs index 829688668..eded96638 100644 --- a/Debugger/ILSpy.Debugger/Services/ParserService/ParserService.cs +++ b/Debugger/ILSpy.Debugger/Services/ParserService/ParserService.cs @@ -78,12 +78,12 @@ namespace ILSpy.Debugger.Services int left = offset, right = offset; //search left - while((!mySet.Contains(currentValue) || currentValue == ".") && offset >= 0) + while((!mySet.Contains(currentValue) || currentValue == ".") && left > 0) currentValue = fullText[--left].ToString(); currentValue = fullText[offset].ToString(); // searh right - while(!mySet.Contains(currentValue) && offset < fullText.Length - 2) + while(!mySet.Contains(currentValue) && right < fullText.Length - 2) currentValue = fullText[++right].ToString(); return fullText.Substring(left + 1, right - 1 - left).Trim(); diff --git a/ILSpy/MainWindow.xaml.cs b/ILSpy/MainWindow.xaml.cs index 66363a734..bb4a41ebe 100644 --- a/ILSpy/MainWindow.xaml.cs +++ b/ILSpy/MainWindow.xaml.cs @@ -319,28 +319,26 @@ namespace ICSharpCode.ILSpy if (window.ShowDialog() == true) { if (DebuggerService.CurrentDebugger.IsDebugging) { - AttachMenuItem.IsEnabled = AttachButton.IsEnabled = false; - ContinueDebuggingMenuItem.IsEnabled = - StepIntoMenuItem.IsEnabled = - StepOverMenuItem.IsEnabled = - StepOutMenuItem.IsEnabled = - DetachMenuItem.IsEnabled = true; + EnableDebuggerUI(false); + DebuggerService.CurrentDebugger.DebugStopped += OnDebugStopped; } } } } + + void OnDebugStopped(object sender, EventArgs e) + { + EnableDebuggerUI(true); + DebuggerService.CurrentDebugger.DebugStopped -= OnDebugStopped; + } void DetachFromProcessExecuted(object sender, ExecutedRoutedEventArgs e) { if (DebuggerService.CurrentDebugger.IsDebugging){ DebuggerService.CurrentDebugger.Detach(); - AttachMenuItem.IsEnabled = AttachButton.IsEnabled = true; - ContinueDebuggingMenuItem.IsEnabled = - StepIntoMenuItem.IsEnabled = - StepOverMenuItem.IsEnabled = - StepOutMenuItem.IsEnabled = - DetachMenuItem.IsEnabled = false; + EnableDebuggerUI(true); + DebuggerService.CurrentDebugger.DebugStopped -= OnDebugStopped; } } @@ -391,6 +389,16 @@ namespace ICSharpCode.ILSpy base.OnKeyUp(e); } + void EnableDebuggerUI(bool enable) + { + AttachMenuItem.IsEnabled = AttachButton.IsEnabled = enable; + ContinueDebuggingMenuItem.IsEnabled = + StepIntoMenuItem.IsEnabled = + StepOverMenuItem.IsEnabled = + StepOutMenuItem.IsEnabled = + DetachMenuItem.IsEnabled = !enable; + } + #endregion #region Exit/About