From 06822be894af6e5e5541732085a5a5a8d55963cf Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Tue, 2 Feb 2010 20:42:16 +0000 Subject: [PATCH] 2010-02-02 Zoltan Varga * mini-amd64.c (mono_arch_emit_prolog): Initialize lmf->rsp in the prolog too so async stack walks don't crash. svn path=/branches/mono-2-6/mono/; revision=150738 --- mono/mini/ChangeLog | 5 +++++ mono/mini/debugger-agent.c | 2 ++ mono/mini/mini-amd64.c | 6 +++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index d96477366f8c7..6629f794831ce 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,8 @@ +2010-02-02 Zoltan Varga + + * mini-amd64.c (mono_arch_emit_prolog): Initialize lmf->rsp in the prolog too + so async stack walks don't crash. + 2010-02-02 Zoltan Varga * mini-trampolines.c (mono_magic_trampoline): Fix a problem where the callsite diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index e3cf3bafb723c..d5c246a6591a5 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -1858,6 +1858,8 @@ mono_debugger_agent_thread_interrupt (void *sigctx, MonoJitInfo *ji) tls->has_async_ctx = FALSE; } + mono_memory_barrier (); + tls->suspended = TRUE; MONO_SEM_POST (&suspend_sem); } diff --git a/mono/mini/mini-amd64.c b/mono/mini/mini-amd64.c index aa5b3d6ad9cf4..b6ab6f99a414d 100644 --- a/mono/mini/mini-amd64.c +++ b/mono/mini/mini-amd64.c @@ -5827,7 +5827,11 @@ mono_arch_emit_prolog (MonoCompile *cfg) /* * The ip field is not set, the exception handling code will obtain it from the stack location pointed to by the sp field. */ - /* sp is saved right before calls */ + /* + * sp is saved right before calls but we need to save it here too so + * async stack walks would work. + */ + amd64_mov_membase_reg (code, cfg->frame_reg, cfg->arch.lmf_offset + G_STRUCT_OFFSET (MonoLMF, rsp), AMD64_RSP, 8); /* Skip method (only needed for trampoline LMF frames) */ /* Save callee saved regs */ for (i = 0; i < MONO_MAX_IREGS; ++i) {