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

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

@ -165,9 +165,11 @@ namespace Debugger @@ -165,9 +165,11 @@ namespace Debugger
{
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();
}

Loading…
Cancel
Save