+2004-10-21 Martin Baulig <martin@ximian.com>
+
+ * exceptions-x86.c (throw_exception): Call mono_debugger_throw_exception();
+ if it returns true, unwind the stack to the call instruction.
+
2004-10-21 <vargaz@freemail.hu>
* aot.c: Reorganize the AOT file format to avoid relocations. Fix warnings.
if (!restore_context)
restore_context = mono_arch_get_restore_context ();
- /* adjust eip so that it point into the call instruction */
- eip -= 1;
-
/* Pop argument and return address */
ctx.SC_ESP = esp + (2 * sizeof (gpointer));
ctx.SC_EIP = eip;
ctx.SC_EDX = edx;
ctx.SC_ECX = ecx;
ctx.SC_EAX = eax;
-
+
+ if (mono_debugger_throw_exception (eip - 5, esp, exc)) {
+ /*
+ * The debugger wants us to stop on the `throw' instruction.
+ * By the time we get here, it already inserted a breakpoint on
+ * eip - 5 (which is the address of the call).
+ */
+ ctx.SC_EIP = eip - 5;
+ ctx.SC_ESP = esp + sizeof (gpointer);
+ restore_context (&ctx);
+ g_assert_not_reached ();
+ }
+
+ /* adjust eip so that it point into the call instruction */
+ ctx.SC_EIP -= 1;
+
if (mono_object_isinst (exc, mono_defaults.exception_class)) {
MonoException *mono_ex = (MonoException*)exc;
mono_ex->stack_trace = NULL;
}
- mono_handle_exception (&ctx, exc, eip + 1, FALSE);
+ mono_handle_exception (&ctx, exc, eip, FALSE);
restore_context (&ctx);
g_assert_not_reached ();
if (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER) {
mono_debugger_handle_exception (ei->data.filter, MONO_CONTEXT_GET_SP (ctx), obj);
filtered = call_filter (ctx, ei->data.filter);
- }
+ }
if ((ei->flags == MONO_EXCEPTION_CLAUSE_NONE &&
mono_object_isinst (obj, mono_class_get (ji->method->klass->image, ei->data.token))) || filtered) {