#include "mini.h"
#include "mini-x86.h"
#include "tasklets.h"
-#include "debug-mini.h"
static gpointer signal_exception_trampoline;
mono_ex->stack_trace = NULL;
}
- if (mono_debug_using_mono_debugger ()) {
- guint8 buf [16], *code;
-
- mono_breakpoint_clean_code (NULL, (gpointer)eip, 8, buf, sizeof (buf));
- code = buf + 8;
-
- if (buf [3] == 0xe8) {
- MonoContext ctx_cp = ctx;
- ctx_cp.eip = eip - 5;
-
- if (mono_debugger_handle_exception (&ctx_cp, exc)) {
- mono_restore_context (&ctx_cp);
- g_assert_not_reached ();
- }
- }
- }
-
/* adjust eip so that it point into the call instruction */
ctx.eip -= 1;
frame->type = FRAME_TYPE_MANAGED;
- if (ji->from_aot)
- unwind_info = mono_aot_get_unwind_info (ji, &unwind_info_len);
- else
- unwind_info = mono_get_cached_unwind_info (ji->used_regs, &unwind_info_len);
+ unwind_info = mono_jinfo_get_unwind_info (ji, &unwind_info_len);
regs [X86_EAX] = new_ctx->eax;
regs [X86_EBX] = new_ctx->ebx;
/* Adjust IP */
new_ctx->eip --;
- if (*lmf && (MONO_CONTEXT_GET_BP (ctx) >= (gpointer)(*lmf)->ebp)) {
- /* remove any unused lmf */
- *lmf = (gpointer)(((gsize)(*lmf)->previous_lmf) & ~3);
+ if (*lmf && ((*lmf) != jit_tls->first_lmf)) {
+ gboolean is_tramp = ((guint32)((*lmf)->previous_lmf) & 1);
+ gpointer lmf_esp;
+
+ if (is_tramp)
+ /* lmf->esp is only set in trampoline frames */
+ lmf_esp = (gpointer)(*lmf)->esp;
+ else
+ /* In non-trampoline frames, ebp is the frame pointer */
+ lmf_esp = (gpointer)(*lmf)->ebp;
+ if (MONO_CONTEXT_GET_SP (ctx) >= lmf_esp)
+ /* remove any unused lmf */
+ *lmf = (gpointer)(((gsize)(*lmf)->previous_lmf) & ~3);
}
/* Pop arguments off the stack */
memcpy (&ctx, &jit_tls->ex_ctx, sizeof (MonoContext));
- if (mono_debugger_handle_exception (&ctx, (MonoObject *)obj))
- return;
-
mono_handle_exception (&ctx, obj);
mono_restore_context (&ctx);
mono_arch_sigctx_to_monoctx (sigctx, &mctx);
- if (mono_debugger_handle_exception (&mctx, (MonoObject *)obj))
- return TRUE;
-
mono_handle_exception (&mctx, obj);
mono_arch_monoctx_to_sigctx (&mctx, sigctx);
mctx = *ctx;
- if (mono_debugger_handle_exception (&mctx, (MonoObject *)obj)) {
- if (stack_ovf)
- prepare_for_guard_pages (&mctx);
- mono_restore_context (&mctx);
- }
-
mono_handle_exception (&mctx, obj);
if (stack_ovf)
prepare_for_guard_pages (&mctx);