Browse Source

Issue the breakpoint hit event outside the COM callback. This allows the continue and terminate commands to be issued and allows evaluation of expressions.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3445 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 17 years ago
parent
commit
68811b3f16
  1. 23
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-StateControl.cs
  2. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs

23
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-StateControl.cs

@ -6,6 +6,7 @@
// </file> // </file>
using System; using System;
using System.Collections.Generic;
using System.Threading; using System.Threading;
namespace Debugger namespace Debugger
@ -15,6 +16,7 @@ namespace Debugger
public partial class Process public partial class Process
{ {
internal bool TerminateCommandIssued = false; internal bool TerminateCommandIssued = false;
internal Queue<Breakpoint> BreakpointHitEventQueue = new Queue<Breakpoint>();
#region Events #region Events
@ -25,7 +27,7 @@ namespace Debugger
public virtual void OnPaused() public virtual void OnPaused()
{ {
AssertPaused(); AssertPaused();
// No real purpose // No real purpose - just additional check
if (callbackInterface.IsInCallback) throw new DebuggerException("Can not raise event within callback."); if (callbackInterface.IsInCallback) throw new DebuggerException("Can not raise event within callback.");
TraceMessage ("Debugger event: OnPaused()"); TraceMessage ("Debugger event: OnPaused()");
if (Paused != null) { if (Paused != null) {
@ -34,6 +36,10 @@ namespace Debugger
TraceMessage ("Skipping OnPaused delegate becuase process has resumed"); TraceMessage ("Skipping OnPaused delegate becuase process has resumed");
break; break;
} }
if (this.TerminateCommandIssued || this.HasExited) {
TraceMessage ("Skipping OnPaused delegate becuase process has exited");
break;
}
d.DynamicInvoke(this, new ProcessEventArgs(this)); d.DynamicInvoke(this, new ProcessEventArgs(this));
} }
} }
@ -42,7 +48,7 @@ namespace Debugger
protected virtual void OnResumed() protected virtual void OnResumed()
{ {
AssertRunning(); AssertRunning();
// No real purpose // No real purpose - just additional check
if (callbackInterface.IsInCallback) throw new DebuggerException("Can not raise event within callback."); if (callbackInterface.IsInCallback) throw new DebuggerException("Can not raise event within callback.");
TraceMessage ("Debugger event: OnResumed()"); TraceMessage ("Debugger event: OnResumed()");
if (Resumed != null) { if (Resumed != null) {
@ -108,12 +114,19 @@ namespace Debugger
ExceptionEventArgs args = new ExceptionEventArgs(this, this.SelectedThread.CurrentException, this.SelectedThread.CurrentExceptionType, this.SelectedThread.CurrentExceptionIsUnhandled); ExceptionEventArgs args = new ExceptionEventArgs(this, this.SelectedThread.CurrentException, this.SelectedThread.CurrentExceptionType, this.SelectedThread.CurrentExceptionIsUnhandled);
OnExceptionThrown(args); OnExceptionThrown(args);
// The event could have resumed or killed the process // The event could have resumed or killed the process
if (this.IsRunning || this.TerminateCommandIssued || this.HasExited) return;
} }
if (this.IsPaused && !this.HasExited) { while(BreakpointHitEventQueue.Count > 0) {
OnPaused(); Breakpoint breakpoint = BreakpointHitEventQueue.Dequeue();
// The event could have resumed the process breakpoint.NotifyHit();
// The event could have resumed or killed the process
if (this.IsRunning || this.TerminateCommandIssued || this.HasExited) return;
} }
OnPaused();
// The event could have resumed the process
if (this.IsRunning || this.TerminateCommandIssued || this.HasExited) return;
} }
#endregion #endregion

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs

@ -165,9 +165,11 @@ namespace Debugger
{ {
EnterCallback(PausedReason.Breakpoint, "Breakpoint", pThread); EnterCallback(PausedReason.Breakpoint, "Breakpoint", pThread);
pauseOnNextExit = true; Breakpoint breakpoint = process.Debugger.GetBreakpoint(corBreakpoint);
// The event will be risen outside the callback
process.BreakpointHitEventQueue.Enqueue(breakpoint);
process.Debugger.GetBreakpoint(corBreakpoint).NotifyHit(); pauseOnNextExit = true;
ExitCallback(); ExitCallback();
} }

Loading…
Cancel
Save