Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mono/mini/mini-exceptions.c')
-rw-r--r--mono/mini/mini-exceptions.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c
index d5f280f1c74..7bd99c0cc39 100644
--- a/mono/mini/mini-exceptions.c
+++ b/mono/mini/mini-exceptions.c
@@ -1741,7 +1741,7 @@ mono_handle_native_sigsegv (int signal, void *ctx)
handling_sigsegv = TRUE;
/* !jit_tls means the thread was not registered with the runtime */
- if (jit_tls) {
+ if (jit_tls && mono_thread_current ()) {
fprintf (stderr, "Stacktrace:\n\n");
mono_jit_walk_stack (print_stack_frame, TRUE, stderr);
@@ -1847,14 +1847,8 @@ mono_handle_native_sigsegv (int signal, void *ctx)
abort ();
}
-/*
- * mono_print_thread_dump:
- *
- * Print information about the current thread to stdout.
- * SIGCTX can be NULL, allowing this to be called from gdb.
- */
-void
-mono_print_thread_dump (void *sigctx)
+static void
+mono_print_thread_dump_internal (void *sigctx, MonoContext *start_ctx)
{
MonoThread *thread = mono_thread_current ();
#if defined(__i386__) || defined(__x86_64__)
@@ -1882,7 +1876,9 @@ mono_print_thread_dump (void *sigctx)
#endif
#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
- if (!sigctx)
+ if (start_ctx) {
+ memcpy (&ctx, start_ctx, sizeof (MonoContext));
+ } else if (!sigctx)
MONO_INIT_CONTEXT_FROM_FUNC (&ctx, mono_print_thread_dump);
else
mono_arch_sigctx_to_monoctx (sigctx, &ctx);
@@ -1896,3 +1892,21 @@ mono_print_thread_dump (void *sigctx)
g_string_free (text, TRUE);
fflush (stdout);
}
+
+/*
+ * mono_print_thread_dump:
+ *
+ * Print information about the current thread to stdout.
+ * SIGCTX can be NULL, allowing this to be called from gdb.
+ */
+void
+mono_print_thread_dump (void *sigctx)
+{
+ mono_print_thread_dump_internal (sigctx, NULL);
+}
+
+void
+mono_print_thread_dump_from_ctx (MonoContext *ctx)
+{
+ mono_print_thread_dump_internal (NULL, ctx);
+}