Skip to content
Browse files

Disallow aborting if there are any non-managed frames on the stack.

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

	* backend/SingleSteppingEngine.cs
	(SSE.DoAbortInvocation): Disallow aborting if there are any
	non-managed frames on the stack.

svn path=/trunk/debugger/; revision=152396
  • Loading branch information...
1 parent bd96310 commit e5f5ad19419f8edcf7d27a421b4d6c76b22a1192 Martin Baulig committed
Showing with 43 additions and 9 deletions.
  1. +6 −0 ChangeLog
  2. +37 −9 backend/SingleSteppingEngine.cs
View
6 ChangeLog
@@ -1,5 +1,11 @@
2010-02-23 Martin Baulig <martin@ximian.com>
+ * backend/SingleSteppingEngine.cs
+ (SSE.DoAbortInvocation): Disallow aborting if there are any
+ non-managed frames on the stack.
+
+2010-02-23 Martin Baulig <martin@ximian.com>
+
* languages/TargetNullObject.cs: New file.
(TargetNullObject): New public class.
View
46 backend/SingleSteppingEngine.cs
@@ -572,9 +572,17 @@ void OperationInterrupted ()
abort_rti = abort_requested;
abort_requested = -1;
}
- Report.Debug (DebugFlags.SSE, "{0} operation interrupted: {1} - {2}", this, abort_rti, current_frame);
+ Report.Debug (DebugFlags.SSE, "{0} operation interrupted: {1} - {2} {3}",
+ this, abort_rti, current_operation, current_frame);
if (abort_rti >= 0) {
- DoAbortInvocation (abort_rti);
+ try {
+ DoAbortInvocation (abort_rti);
+ } catch (TargetException ex) {
+ Report.Debug (DebugFlags.SSE, "{0} operation interrupted - exception: {1}",
+ this, ex.Message);
+ if (!current_operation.ResumeOperation ())
+ inferior.Continue ();
+ }
} else {
if (stop_requested)
OperationCompleted (null);
@@ -2034,22 +2042,42 @@ void DoAbortInvocation (long rti_id)
rti_id, cframe.ID);
}
+ CommandResult result = new ThreadCommandResult (thread);
+
Backtrace bt = new Backtrace (current_frame);
bt.GetBacktrace (this, inferior, Backtrace.Mode.Native, cframe.StackPointer, -1);
+ if (bt.Count < 2)
+ throw new TargetException (TargetError.NoStack);
+
+ //
+ // Walk the stack and check whether we can abort this invocation.
+ //
+
+ bool stack_ok = true;
+
for (int i = 0; i < bt.Count; i++) {
- if (bt.Frames [i].Type == FrameType.Normal)
+ StackFrame frame = bt.Frames [i];
+
+ Report.Debug (DebugFlags.SSE, "{0} do abort invocation - frame {1} ({2}:{3}): {4}",
+ this, i, frame.Type, frame.IsManaged, frame);
+
+ if ((frame.Type == FrameType.Normal) && frame.IsManaged) {
continue;
- else if ((bt.Frames [i].Type == FrameType.RuntimeInvoke) && (i + 1 == bt.Count))
+ } else if ((frame.Type == FrameType.RuntimeInvoke) && (i + 1 == bt.Count))
break;
- throw new TargetException (TargetError.InvalidReturn,
- "Cannot abort an invocation which contains non-managed frames.");
+
+ stack_ok = false;
+ break;
}
- if (bt.Count < 2)
- throw new TargetException (TargetError.NoStack);
+ if (!stack_ok)
+ throw new TargetException (TargetError.InvalidReturn,
+ "Cannot abort an invocation which contains non-managed frames.");
- CommandResult result = new ThreadCommandResult (thread);
+ //
+ // We're all set - the stack only contains managed frames, so we can go ahead here.
+ //
PushOperation (new OperationReturn (this, bt, ReturnMode.Invocation, result));
}

0 comments on commit e5f5ad1

Please sign in to comment.
Something went wrong with that request. Please try again.