Author: martin
Date: 2006-04-17 18:10:15 -0400 (Mon, 17 Apr 2006)
New Revision: 59548
Modified:
trunk/debugger/ChangeLog
trunk/debugger/backends/SingleSteppingEngine.cs
trunk/debugger/classes/Breakpoint.cs
trunk/debugger/classes/Event.cs
trunk/debugger/classes/ExceptionCatchPoint.cs
Log:
2006-04-18 Martin Baulig <[EMAIL PROTECTED]>
* classes/ExceptionCatchPoint.cs
(ExceptionCatchPoint): Make this class sealed and rename
`CheckBreakpointHit' into `CheckException'.
* classes/Event.cs
(Event.CheckBreakpointHit): Moved into the `Breakpoint' class.
* backends/SingleSteppingEngine.cs
(SingleSteppingEngine.child_breakpoint): Run
`breakpoint.CheckBreakpointHit()' asynchronously.
Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog 2006-04-17 21:55:17 UTC (rev 59547)
+++ trunk/debugger/ChangeLog 2006-04-17 22:10:15 UTC (rev 59548)
@@ -1,3 +1,16 @@
+2006-04-18 Martin Baulig <[EMAIL PROTECTED]>
+
+ * classes/ExceptionCatchPoint.cs
+ (ExceptionCatchPoint): Make this class sealed and rename
+ `CheckBreakpointHit' into `CheckException'.
+
+ * classes/Event.cs
+ (Event.CheckBreakpointHit): Moved into the `Breakpoint' class.
+
+ * backends/SingleSteppingEngine.cs
+ (SingleSteppingEngine.child_breakpoint): Run
+ `breakpoint.CheckBreakpointHit()' asynchronously.
+
2006-04-17 Martin Baulig <[EMAIL PROTECTED]>
Bump version number to 0.14 and require Mono >= 1.1.15.
Modified: trunk/debugger/backends/SingleSteppingEngine.cs
===================================================================
--- trunk/debugger/backends/SingleSteppingEngine.cs 2006-04-17 21:55:17 UTC
(rev 59547)
+++ trunk/debugger/backends/SingleSteppingEngine.cs 2006-04-17 22:10:15 UTC
(rev 59548)
@@ -75,6 +75,7 @@
// not we should enter that trampoline.
// </summary>
internal delegate bool TrampolineHandler (SingleSteppingEngine
sse, Method method);
+ internal delegate bool CheckBreakpointHandler ();
protected SingleSteppingEngine (ThreadManager manager, Inferior
inferior)
{
@@ -86,8 +87,6 @@
inferior.TargetOutput += new TargetOutputHandler
(inferior_output_handler);
PID = inferior.PID;
-
- engine_stopped_event = new ManualResetEvent (false);
}
public SingleSteppingEngine (ThreadManager manager, Process
process,
@@ -208,8 +207,6 @@
Inferior.ChildEventType message = cevent.Type;
int arg = (int) cevent.Argument;
- bool exiting = false;
-
TargetEventArgs result = null;
if ((message ==
Inferior.ChildEventType.THROW_EXCEPTION) ||
@@ -283,8 +280,10 @@
arg = 0;
cevent = new
Inferior.ChildEvent (
Inferior.ChildEventType.CHILD_STOPPED, 0, 0, 0);
- } else
- goto send_result;
+ } else {
+ ProcessChildEvent (cevent,
result);
+ return;
+ }
}
}
@@ -303,10 +302,9 @@
Report.Debug (DebugFlags.SSE,
"{0} now stepping over
breakpoint", this);
return;
- } else if (!child_breakpoint (arg)) {
+ } else if (!child_breakpoint (cevent, arg)) {
// we hit any breakpoint, but its
handler told us
// to resume the target and continue.
- do_continue ();
return;
}
}
@@ -338,12 +336,10 @@
case Inferior.ChildEventType.CHILD_SIGNALED:
result = new TargetEventArgs
(TargetEventType.TargetSignaled, arg);
- exiting = true;
break;
case Inferior.ChildEventType.CHILD_EXITED:
result = new TargetEventArgs
(TargetEventType.TargetExited, arg);
- exiting = true;
break;
case Inferior.ChildEventType.CHILD_CALLBACK_COMPLETED:
@@ -356,10 +352,20 @@
break;
}
+ ProcessChildEvent (cevent, result);
+ }
+
+ protected void ProcessChildEvent (Inferior.ChildEvent cevent,
TargetEventArgs result)
+ {
+ Inferior.ChildEventType message = cevent.Type;
+ int arg = (int) cevent.Argument;
+
send_result:
// If `result' is not null, then the target stopped
abnormally.
if (result != null) {
- if (is_main && !reached_main && !exiting) {
+ if (is_main && !reached_main &&
+ (cevent.Type !=
Inferior.ChildEventType.CHILD_EXITED) &&
+ (cevent.Type !=
Inferior.ChildEventType.CHILD_SIGNALED)) {
reached_main = true;
StackFrame ret_frame;
@@ -472,7 +478,6 @@
{
lock (this) {
engine_stopped = true;
- engine_stopped_event.Set ();
Report.Debug (DebugFlags.EventLoop, "{0}
completed operation {1}",
this, current_operation);
if (result != null)
@@ -564,7 +569,6 @@
}
engine_stopped = false;
- engine_stopped_event.Reset ();
}
}
@@ -793,7 +797,7 @@
// If we can't find a handler for the breakpoint, the default
is to stop
// the target and let the user decide what to do.
// </summary>
- bool child_breakpoint (int index)
+ bool child_breakpoint (Inferior.ChildEvent cevent, int index)
{
// The inferior knows about breakpoints from all
threads, so if this is
// zero, then no other thread has set this breakpoint.
@@ -801,16 +805,44 @@
return true;
Breakpoint bpt =
process.BreakpointManager.LookupBreakpoint (index);
- if (bpt == null)
+ if (bpt == null) {
+ do_continue ();
return false;
+ }
bool remain_stopped;
- if (bpt.BreakpointHandler (inferior, out
remain_stopped))
- return remain_stopped;
+ if (bpt.BreakpointHandler (inferior, out
remain_stopped)) {
+ if (!remain_stopped) {
+ do_continue ();
+ return false;
+ } else
+ return true;
+ }
- return bpt.CheckBreakpointHit (thread,
inferior.CurrentFrame);
+ TargetAddress address = inferior.CurrentFrame;
+ CheckBreakpointHandler callback = new
CheckBreakpointHandler (delegate {
+ return bpt.CheckBreakpointHit (thread, address);
+ });
+
+ callback.BeginInvoke (delegate (IAsyncResult result) {
+ bool remain_stopped = callback.EndInvoke
(result);
+ child_hit_breakpoint_done (cevent,
remain_stopped);
+ }, this);
+
+ return false;
}
+ void child_hit_breakpoint_done (Inferior.ChildEvent cevent,
bool remain_stopped)
+ {
+ SendCommand (delegate {
+ if (remain_stopped)
+ ProcessChildEvent (cevent, null);
+ else
+ do_continue ();
+ return null;
+ });
+ }
+
bool step_over_breakpoint (TargetAddress until, bool
trampoline, bool current)
{
int index;
@@ -846,12 +878,12 @@
if (current_operation is OperationRuntimeInvoke)
return false;
- foreach (Event handle in exception_handlers.Values) {
+ foreach (ExceptionCatchPoint handle in
exception_handlers.Values) {
Report.Debug (DebugFlags.SSE,
"{0} invoking exception handler
{1} for {0}",
this, handle.Name, exc);
- if (!handle.CheckBreakpointHit (thread, exc))
+ if (!handle.CheckException (thread, exc))
continue;
Report.Debug (DebugFlags.SSE,
@@ -1730,7 +1762,6 @@
Hashtable exception_handlers;
Stack callback_stack;
bool engine_stopped;
- ManualResetEvent engine_stopped_event;
bool stop_requested;
bool has_thread_lock;
bool is_main, reached_main;
Modified: trunk/debugger/classes/Breakpoint.cs
===================================================================
--- trunk/debugger/classes/Breakpoint.cs 2006-04-17 21:55:17 UTC (rev
59547)
+++ trunk/debugger/classes/Breakpoint.cs 2006-04-17 22:10:15 UTC (rev
59548)
@@ -73,7 +73,16 @@
return false;
}
- public override bool CheckBreakpointHit (Thread target,
TargetAddress address)
+ // <summary>
+ // This method is called each time the breakpoint is hit.
+ // It returns true if the target should remain stopped and
false
+ // if the breakpoint is to be ignored.
+ // </summary>
+ // <remarks>
+ // The @target argument is *not* serializable and may not be
used
+ // anywhere outside this handler.
+ // </remarks>
+ public virtual bool CheckBreakpointHit (Thread target,
TargetAddress address)
{
return true;
}
Modified: trunk/debugger/classes/Event.cs
===================================================================
--- trunk/debugger/classes/Event.cs 2006-04-17 21:55:17 UTC (rev 59547)
+++ trunk/debugger/classes/Event.cs 2006-04-17 22:10:15 UTC (rev 59548)
@@ -48,17 +48,6 @@
return false;
}
- // <summary>
- // This method is called each time the breakpoint is hit.
- // It returns true if the target should remain stopped and
false
- // if the breakpoint is to be ignored.
- // </summary>
- // <remarks>
- // The @target argument is *not* serializable and may not be
used
- // anywhere outside this handler.
- // </remarks>
- public abstract bool CheckBreakpointHit (Thread target,
TargetAddress address);
-
public abstract bool IsEnabled {
get;
}
Modified: trunk/debugger/classes/ExceptionCatchPoint.cs
===================================================================
--- trunk/debugger/classes/ExceptionCatchPoint.cs 2006-04-17 21:55:17 UTC
(rev 59547)
+++ trunk/debugger/classes/ExceptionCatchPoint.cs 2006-04-17 22:10:15 UTC
(rev 59548)
@@ -7,7 +7,7 @@
namespace Mono.Debugger
{
[Serializable]
- public class ExceptionCatchPoint : Event
+ public sealed class ExceptionCatchPoint : Event
{
int handle = -1;
@@ -75,7 +75,7 @@
return false;
}
- public override bool CheckBreakpointHit (Thread target,
TargetAddress address)
+ internal bool CheckException (Thread target, TargetAddress
address)
{
TargetClassObject exc = exception.Language.CreateObject
(target, address)
as TargetClassObject;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches