Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Improve leaving nested break states.
Browse files Browse the repository at this point in the history
2010-02-24  Martin Baulig  <martin@ximian.com>

	* frontend/Main.cs: Don't deadlock when leaving a nested
	break state.

	* backend/SingleSteppingEngine.cs
	(SSE.ProcessEvent): On `ChildEventType.RUNTIME_INVOKE_DONE':
	terminate the current operation if it's different from the rti.

	* classes/Operation.cs
	(OperationCommandResult.Completed): Send the result before
	signalling the wait handle.

svn path=/trunk/debugger/; revision=152398
  • Loading branch information
Martin Baulig committed Feb 24, 2010
1 parent 702b7a2 commit 6d54d6e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
@@ -1,3 +1,16 @@
2010-02-24 Martin Baulig <martin@ximian.com>

* frontend/Main.cs: Don't deadlock when leaving a nested
break state.

* backend/SingleSteppingEngine.cs
(SSE.ProcessEvent): On `ChildEventType.RUNTIME_INVOKE_DONE':
terminate the current operation if it's different from the rti.

* classes/Operation.cs
(OperationCommandResult.Completed): Send the result before
signalling the wait handle.

2010-02-24 Martin Baulig <martin@ximian.com>

* backend/server/x86_64-arch.c
Expand Down
6 changes: 5 additions & 1 deletion backend/SingleSteppingEngine.cs
Expand Up @@ -288,8 +288,12 @@ public bool ProcessEvent (Inferior.ChildEvent cevent)
process.Debugger.OnLeaveNestedBreakState (this);
}

if (current_operation != rti)
if (current_operation != rti) {
OperationCommandResult result = current_operation.Result as OperationCommandResult;
if (result != null)
result.Completed (this, null);
current_operation.Result.Completed ();
}
current_operation = rti;

TargetEventArgs args = rti.OperationCompleted (current_frame, false);
Expand Down
2 changes: 1 addition & 1 deletion classes/Operation.cs
Expand Up @@ -93,9 +93,9 @@ internal virtual void Completed (SingleSteppingEngine sse, TargetEventArgs args)

if (!IsCompleted) {
IsCompleted = true;
Host.OperationCompleted (sse, args, ThreadingModel);
if (args != null)
Host.SendResult (sse, args);
Host.OperationCompleted (sse, args, ThreadingModel);
}
}

Expand Down
16 changes: 9 additions & 7 deletions frontend/Main.cs
Expand Up @@ -33,8 +33,8 @@ public class CommandLineInterpreter
get { return interrupt_event; }
}

public ST.AutoResetEvent EnterNestedBreakStateEvent {
get { return enter_nested_break_state_event; }
public ST.AutoResetEvent NestedBreakStateEvent {
get { return nested_break_state_event; }
}

Interpreter interpreter;
Expand All @@ -47,7 +47,7 @@ public class CommandLineInterpreter
ST.Thread main_thread;

ST.AutoResetEvent interrupt_event;
ST.AutoResetEvent enter_nested_break_state_event;
ST.AutoResetEvent nested_break_state_event;

Stack<CommandLineInterpreter.MainLoop> main_loop_stack;

Expand Down Expand Up @@ -88,7 +88,7 @@ internal CommandLineInterpreter (DebuggerOptions options, bool is_interactive)
parser = new LineParser (engine);

interrupt_event = new ST.AutoResetEvent (false);
enter_nested_break_state_event = new ST.AutoResetEvent (false);
nested_break_state_event = new ST.AutoResetEvent (false);

main_loop_stack = new Stack<MainLoop> ();
main_loop_stack.Push (new MainLoop (interpreter));
Expand All @@ -109,7 +109,7 @@ public CommandLineInterpreter (Interpreter interpreter)
parser = new LineParser (engine);

interrupt_event = new ST.AutoResetEvent (false);
enter_nested_break_state_event = new ST.AutoResetEvent (false);
nested_break_state_event = new ST.AutoResetEvent (false);

main_loop_stack = new Stack<MainLoop> ();
main_loop_stack.Push (new MainLoop (interpreter));
Expand Down Expand Up @@ -178,7 +178,7 @@ void wait_for_completion ()
Report.Debug (DebugFlags.CLI, "{0} waiting for completion", loop);

ST.WaitHandle[] wait = new ST.WaitHandle[] {
loop.CompletedEvent, interrupt_event, enter_nested_break_state_event
loop.CompletedEvent, interrupt_event, nested_break_state_event
};
int ret = ST.WaitHandle.WaitAny (wait);

Expand All @@ -197,7 +197,7 @@ public void EnterNestedBreakState ()

Report.Debug (DebugFlags.CLI, "{0} enter nested break state", loop);

enter_nested_break_state_event.Set ();
nested_break_state_event.Set ();
}

public void LeaveNestedBreakState ()
Expand All @@ -206,6 +206,8 @@ public void LeaveNestedBreakState ()
nested.Completed = true;

Report.Debug (DebugFlags.CLI, "{0} leave nested break state", nested);

nested_break_state_event.Set ();
}

void main_thread_main ()
Expand Down

0 comments on commit 6d54d6e

Please sign in to comment.