From c8d809d59dac6235aaeb65b82801d1ffea1c43ef Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Sun, 14 Aug 2011 22:30:54 +0200 Subject: [PATCH] Don't pass MONO_UNWIND_ACTUAL_METHOD to the stack walker in a signal handler, its not signal safe. Fixes bxc #263. --- mono/mini/debugger-agent.c | 8 +++++++- mono/utils/mono-stack-unwinding.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index 2901bde1b694c..5f8a713a71609 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -2152,7 +2152,13 @@ mono_debugger_agent_thread_interrupt (void *sigctx, MonoJitInfo *ji) data.last_frame_set = FALSE; if (sigctx) { mono_arch_sigctx_to_monoctx (sigctx, &ctx); - mono_walk_stack_with_ctx (get_last_frame, &ctx, MONO_UNWIND_DEFAULT, &data); + mono_arch_sigctx_to_monoctx (sigctx, &ctx); + /* + * Don't pass MONO_UNWIND_ACTUAL_METHOD, its not signal safe, and + * get_last_frame () doesn't need it, the last frame cannot be a ginst + * since we are not in a JITted method. + */ + mono_walk_stack_with_ctx (get_last_frame, &ctx, MONO_UNWIND_NONE, &data); } if (data.last_frame_set) { memcpy (&tls->async_last_frame, &data.last_frame, sizeof (StackFrameInfo)); diff --git a/mono/utils/mono-stack-unwinding.h b/mono/utils/mono-stack-unwinding.h index ffeb17408b562..581ab4448982e 100644 --- a/mono/utils/mono-stack-unwinding.h +++ b/mono/utils/mono-stack-unwinding.h @@ -21,6 +21,7 @@ typedef enum { typedef enum { MONO_UNWIND_NONE = 0x0, MONO_UNWIND_LOOKUP_IL_OFFSET = 0x1, + /* NOT signal safe */ MONO_UNWIND_LOOKUP_ACTUAL_METHOD = 0x2, /* * Store the locations where caller-saved registers are saved on the stack in