Skip to content

Commit

Permalink
Add optional Microsoft Telemetry unmanaged dumper
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkyte authored and marek-safar committed Mar 13, 2018
1 parent 5dae72b commit c836aa1
Show file tree
Hide file tree
Showing 4 changed files with 577 additions and 0 deletions.
22 changes: 22 additions & 0 deletions mono/mini/mini-exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include <mono/metadata/mono-endian.h>
#include <mono/metadata/environment.h>
#include <mono/metadata/mono-mlist.h>
#include <mono/utils/mono-merp.h>
#include <mono/utils/mono-mmap.h>
#include <mono/utils/mono-logger-internals.h>
#include <mono/utils/mono-error.h>
Expand Down Expand Up @@ -2797,6 +2798,27 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T
prctl (PR_SET_PTRACER, pid, 0, 0, 0);
}
#endif

#if defined(HOST_DARWIN)
if (mono_merp_enabled ()) {
if (pid == 0) {
MonoContext mctx;
if (!ctx) {
mono_runtime_printf_err ("\nMust always pass non-null context when using merp.\n");
exit (1);
}

mono_sigctx_to_monoctx (ctx, &mctx);

intptr_t thread_pointer = (intptr_t) MONO_CONTEXT_GET_SP (&mctx);

mono_merp_invoke (crashed_pid, thread_pointer, signal);

exit (1);
}
}
#endif

if (pid == 0) {
dup2 (STDERR_FILENO, STDOUT_FILENO);

Expand Down
2 changes: 2 additions & 0 deletions mono/utils/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ monoutils_sources = \
mono-log-posix.c \
mono-log-android.c \
mono-log-darwin.c \
mono-merp.c \
mono-merp.h \
mono-internal-hash.c \
mono-internal-hash.h \
mono-io-portability.c \
Expand Down
Loading

0 comments on commit c836aa1

Please sign in to comment.