Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[no merge] call mono_pmip_u in the crash handler #83219

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mono/mono/mini/mini-arm64.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ typedef struct {

#endif

#if defined(TARGET_IOS) || defined(TARGET_WATCHOS)
#if defined(TARGET_IOS) || defined(TARGET_WATCHOS) || defined(__linux__)
#define MONO_ARCH_HAVE_UNWIND_BACKTRACE 1
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/mini/mini-exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ is_address_protected (MonoJitInfo *ji, MonoJitExceptionInfo *ei, gpointer ip)

#ifdef MONO_ARCH_HAVE_UNWIND_BACKTRACE

#if 0
#if 1
static gboolean show_native_addresses = TRUE;
#else
static gboolean show_native_addresses = FALSE;
Expand Down
26 changes: 26 additions & 0 deletions src/mono/mono/mini/mini-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
#include "jit-icalls.h"
#include <glib.h>

#ifdef HAVE_UNWIND_H
#include <unwind.h>
#endif

#ifdef HOST_DARWIN
#include <mach/mach.h>
#include <mach/mach_time.h>
Expand Down Expand Up @@ -774,6 +778,21 @@ fork_crash_safe (void)
}
#endif

#ifdef MONO_ARCH_HAVE_UNWIND_BACKTRACE
static _Unwind_Reason_Code
dump_unwind_backtrace (struct _Unwind_Context *frame_ctx, G_GNUC_UNUSED void *state)
{
uintptr_t ip = _Unwind_GetIP (frame_ctx);

g_async_safe_printf ("\t Frame: %p\n\t\t");
mono_print_method_from_ip ((void*)ip);
g_async_safe_printf ("\n");

return _URC_NO_REASON;
}

#endif

static void
dump_native_stacktrace (const char *signal, MonoContext *mctx)
{
Expand All @@ -789,6 +808,13 @@ dump_native_stacktrace (const char *signal, MonoContext *mctx)

}

#ifdef MONO_ARCH_HAVE_UNWIND_BACKTRACE
g_async_safe_printf ("\n=================================================================\n");
g_async_safe_printf (" _Unwind_Backtrace stacktrace:\n");
g_async_safe_printf ("=================================================================\n");
_Unwind_Backtrace (dump_unwind_backtrace, NULL);
#endif

#ifdef HAVE_BACKTRACE_SYMBOLS

void *array [256];
Expand Down