diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs index 6fbfc5dab1..ed96e6856a 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs @@ -338,7 +338,7 @@ namespace ICSharpCode.SharpDevelop.Services exceptionHistory.Add(debugger.CurrentThread.CurrentException); if (debugger.CurrentThread.CurrentException.ExceptionType != ExceptionType.DEBUG_EXCEPTION_UNHANDLED && (debugger.CatchHandledExceptions == false)) { // Ignore the exception - Continue(); + e.ResumeDebuggingAfterEvent(); return; } @@ -355,11 +355,11 @@ namespace ICSharpCode.SharpDevelop.Services case ExceptionForm.Result.Break: break; case ExceptionForm.Result.Continue: - Continue(); + e.ResumeDebuggingAfterEvent(); return; case ExceptionForm.Result.Ignore: System.Diagnostics.Debug.Fail("Not implemented"); - Continue(); + e.ResumeDebuggingAfterEvent(); return; } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/DebuggerEvents/DebuggingPausedEventHandler.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/DebuggerEvents/DebuggingPausedEventHandler.cs index 59b1f1397b..4bf8bf5218 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/DebuggerEvents/DebuggingPausedEventHandler.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/DebuggerEvents/DebuggingPausedEventHandler.cs @@ -12,12 +12,31 @@ namespace DebuggerLibrary public class DebuggingPausedEventArgs : System.EventArgs { PausedReason reason; + + bool resumeDebugging = false; public PausedReason Reason { get { return reason; } } + + internal bool ResumeDebugging { + get { + return resumeDebugging; + } + } + + /// + /// Call this function to resume debugging when event is handled + /// + /// This is prefered to calling Continue() since it ensures Continue is + /// called only once and never before all events are handled + /// + public void ResumeDebuggingAfterEvent() + { + resumeDebugging = true; + } public DebuggingPausedEventArgs(PausedReason reason) { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs index e2a77053a7..a4f2e7c582 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs @@ -145,7 +145,11 @@ namespace DebuggerLibrary { TraceMessage ("Debugger event: OnDebuggingPaused(" + reason.ToString() + ")"); if (DebuggingPaused != null) { - DebuggingPaused(null, new DebuggingPausedEventArgs(reason)); + DebuggingPausedEventArgs args = new DebuggingPausedEventArgs(reason); + DebuggingPaused(null, args); + if (args.ResumeDebugging) { + Continue(); + } } } @@ -343,7 +347,7 @@ namespace DebuggerLibrary public VariableCollection LocalVariables { get { - if (!IsDebugging) return null; + if (!IsDebugging) return VariableCollection.Empty; return CurrentProcess.LocalVariables; } }