Fix stack alignment when resuming from a signal handler in the soft debugger. Fixes #647464.

This commit is contained in:
Zoltan Varga committed 2010-11-25 23:33:25 +01:00
1 parent 65292a69c8
commit e10b6ddad7
4 files changed
+22 -2

No files matched your search

+4
View File
@@ -3725,7 +3725,11 @@ resume_from_signal_handler (void *sigctx, void *func)
mono_arch_sigctx_to_monoctx (sigctx, &ctx);
memcpy (&tls->handler_ctx, &ctx, sizeof (MonoContext));
#ifdef MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX
mono_arch_setup_resume_sighandler_ctx (&ctx, func);
#else
MONO_CONTEXT_SET_IP (&ctx, func);
#endif
mono_arch_monoctx_to_sigctx (&ctx, sigctx);
#ifdef PPC_USES_FUNCTION_DESCRIPTOR
+16
View File
@@ -1427,3 +1427,19 @@ mono_tasklets_arch_restore (void)
}
#endif
/*
* mono_arch_setup_resume_sighandler_ctx:
*
* Setup CTX so execution continues at FUNC.
*/
void
mono_arch_setup_resume_sighandler_ctx (MonoContext *ctx, gpointer func)
{
/*
* When resuming from a signal handler, the stack should be misaligned, just like right after
* a call.
*/
if ((((guint64)MONO_CONTEXT_GET_SP (ctx)) % 16) == 0)
MONO_CONTEXT_SET_SP (ctx, (guint64)MONO_CONTEXT_GET_SP (ctx) - 8);
MONO_CONTEXT_SET_IP (ctx, func);
}
+1 -2
View File
@@ -389,8 +389,7 @@ typedef struct {
#define MONO_ARCH_HAVE_LLVM_IMT_TRAMPOLINE 1
#define MONO_ARCH_LLVM_SUPPORTED 1
#define MONO_ARCH_THIS_AS_FIRST_ARG 1
#define MONO_ARCH_USE_OP_TAIL_CALL(caller_sig, callee_sig) mono_metadata_signature_equal ((caller_sig), (callee_sig))
#define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
/* Used for optimization, not complete */
#define MONO_ARCH_IS_OP_MEMBASE(opcode) ((opcode) == OP_X86_PUSH_MEMBASE)
+1
View File
@@ -1841,6 +1841,7 @@ guint8* mono_arch_get_ip_for_breakpoint (MonoJitInfo *ji, MonoContext *c
void mono_arch_skip_breakpoint (MonoContext *ctx) MONO_INTERNAL;
void mono_arch_skip_single_step (MonoContext *ctx) MONO_INTERNAL;
gpointer mono_arch_get_seq_point_info (MonoDomain *domain, guint8 *code) MONO_INTERNAL;
void mono_arch_setup_resume_sighandler_ctx (MonoContext *ctx, gpointer func) MONO_INTERNAL;
#endif
MonoJitInfo *mono_arch_find_jit_info (MonoDomain *domain,