Imported Upstream version 5.16.0.122

Former-commit-id: 60dd6d91c5dc30a6569681c1b8d7cddebae4e52b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-08-28 08:15:10 +00:00
parent f8f43c9aed
commit 73002b0b4a
177 changed files with 232 additions and 77 deletions

View File

@@ -94,8 +94,10 @@ HANDLES(ICALL(TLS_PROVIDER_FACTORY_1, "IsBtlsSupported", ves_icall_Mono_TlsProvi
ICALL_TYPE(RUNTIME, "Mono.Runtime", RUNTIME_1)
HANDLES(ICALL(RUNTIME_1, "DisableMicrosoftTelemetry", ves_icall_Mono_Runtime_DisableMicrosoftTelemetry))
HANDLES(ICALL(RUNTIME_2, "EnableMicrosoftTelemetry_internal", ves_icall_Mono_Runtime_EnableMicrosoftTelemetry))
HANDLES(ICALL(RUNTIME_3, "GetDisplayName", ves_icall_Mono_Runtime_GetDisplayName))
HANDLES(ICALL(RUNTIME_3, "ExceptionToState_internal", ves_icall_Mono_Runtime_ExceptionToState))
HANDLES(ICALL(RUNTIME_4, "GetDisplayName", ves_icall_Mono_Runtime_GetDisplayName))
HANDLES(ICALL(RUNTIME_12, "GetNativeStackTrace", ves_icall_Mono_Runtime_GetNativeStackTrace))
HANDLES(ICALL(RUNTIME_13, "SendMicrosoftTelemetry_internal", ves_icall_Mono_Runtime_SendMicrosoftTelemetry))
ICALL_TYPE(RTCLASS, "Mono.RuntimeClassHandle", RTCLASS_1)
HANDLES(ICALL(RTCLASS_1, "GetTypeFromClass", ves_icall_Mono_RuntimeClassHandle_GetTypeFromClass))

View File

@@ -1 +1 @@
2cf59d0a12f78f6cb3ab581b655cb3aae68b9df8
c01fe52cc7b6f7b52ff0d18738de654974150a05

View File

@@ -653,6 +653,7 @@ typedef struct {
void (*mono_reraise_exception) (MonoException *ex);
#ifdef TARGET_OSX
void (*mono_summarize_stack) (MonoDomain *domain, MonoThreadSummary *out, MonoContext *crash_ctx);
void (*mono_summarize_exception) (MonoException *exc, MonoThreadSummary *out);
#endif
} MonoRuntimeExceptionHandlingCallbacks;

View File

@@ -1 +1 @@
328a7ed774148ac3ca84ca7d3f69cf1f7354d8d0
152038ab038e0863629eb2ac05d89c0a7ed3c923

View File

@@ -1 +1 @@
de66f3fc0f40e846af135d6deee896ae0c32a1fb
40ef50b2c0ba1ddad1dce319ec42832e03b82600

View File

@@ -231,8 +231,7 @@ MONO_SIG_HANDLER_FUNC (static, sigterm_signal_handler)
if (mono_merp_enabled ()) {
pid_t crashed_pid = getpid ();
char *full_version = mono_get_runtime_build_info ();
mono_merp_invoke (crashed_pid, "SIGTERM", output, &hashes, full_version);
mono_merp_invoke (crashed_pid, "SIGTERM", output, &hashes);
} else {
// Only the dumping-supervisor thread exits mono_thread_summarize
MOSTLY_ASYNC_SAFE_PRINTF("Unhandled exception dump: \n######\n%s\n######\n", output);

View File

@@ -1 +1 @@
#define FULL_VERSION "explicit/421e62d"
#define FULL_VERSION "explicit/57e9fc6"

View File

@@ -318,9 +318,14 @@ get_apple_model (char *buffer, size_t max_length)
sysctlbyname("hw.model", buffer, &sz, NULL, 0);
}
static void
mono_merp_free (MERPStruct *merp)
{
g_free ((char *)merp->moduleVersion);
}
static void
mono_init_merp (const intptr_t crashed_pid, const char *signal, MonoStackHash *hashes, MERPStruct *merp, const char *version)
mono_init_merp (const intptr_t crashed_pid, const char *signal, MonoStackHash *hashes, MERPStruct *merp)
{
g_assert (mono_merp_enabled ());
@@ -338,7 +343,7 @@ mono_init_merp (const intptr_t crashed_pid, const char *signal, MonoStackHash *h
merp->servicePathArg = config.appPath;
merp->moduleName = "Mono Exception";
merp->moduleVersion = version;
merp->moduleVersion = mono_get_runtime_callbacks ()->get_runtime_build_info ();
merp->moduleOffset = 0;
@@ -516,12 +521,12 @@ mono_wer_template (MERPStruct *merp)
}
void
mono_merp_invoke (const intptr_t crashed_pid, const char *signal, const char *non_param_data, MonoStackHash *hashes, char *version)
mono_merp_invoke (const intptr_t crashed_pid, const char *signal, const char *non_param_data, MonoStackHash *hashes)
{
MERPStruct merp;
memset (&merp, 0, sizeof (merp));
mono_init_merp (crashed_pid, signal, hashes, &merp, version);
mono_init_merp (crashed_pid, signal, hashes, &merp);
gchar *merpCfg = mono_encode_merp_params (&merp);
gchar *fullData = mono_merp_fingerprint_payload (non_param_data, &merp);
gchar *werXmlCfg = mono_wer_template (&merp);
@@ -529,6 +534,7 @@ mono_merp_invoke (const intptr_t crashed_pid, const char *signal, const char *no
// Write out to disk, start program
mono_merp_send (merpCfg, fullData, werXmlCfg);
mono_merp_free (&merp);
g_free (fullData);
g_free (merpCfg);
g_free (werXmlCfg);

View File

@@ -47,7 +47,7 @@ gboolean mono_merp_enabled (void);
* when the registered telemetry application does not respond.
*/
void
mono_merp_invoke (const intptr_t crashed_pid, const char *signal, const char *dump_file, MonoStackHash *hashes, char *version);
mono_merp_invoke (const intptr_t crashed_pid, const char *signal, const char *dump_file, MonoStackHash *hashes);
#endif // TARGET_OSX

View File

@@ -10,7 +10,6 @@
*/
#include <config.h>
#include <glib.h>
#include <mono/utils/json.h>
#include <mono/utils/mono-state.h>
#include <mono/metadata/object-internals.h>
@@ -146,16 +145,11 @@ mono_native_state_add_frames (JsonWriter *writer, int num_frames, MonoFrameSumma
mono_json_writer_array_end (writer);
}
static void
mono_native_state_add_thread (JsonWriter *writer, MonoThreadSummary *thread, MonoContext *ctx)
void
mono_native_state_add_thread (JsonWriter *writer, MonoThreadSummary *thread, MonoContext *ctx, gboolean first_thread)
{
static gboolean not_first_thread;
if (not_first_thread) {
if (!first_thread) {
mono_json_writer_printf (writer, ",\n");
} else {
not_first_thread = TRUE;
}
mono_json_writer_indent (writer);
@@ -183,7 +177,8 @@ mono_native_state_add_thread (JsonWriter *writer, MonoThreadSummary *thread, Mon
mono_json_writer_object_key(writer, "native_thread_id");
mono_json_writer_printf (writer, "\"0x%x\",\n", (gpointer) thread->native_thread_id);
mono_native_state_add_ctx (writer, ctx);
if (ctx)
mono_native_state_add_ctx (writer, ctx);
if (thread->num_managed_frames > 0) {
mono_native_state_add_frames (writer, thread->num_managed_frames, thread->managed_frames, "managed_frames");
@@ -267,10 +262,12 @@ mono_native_state_add_version (JsonWriter *writer)
mono_json_writer_object_key(writer, "configuration");
mono_json_writer_object_begin(writer);
char *build = mono_get_runtime_callbacks ()->get_runtime_build_info ();
mono_json_writer_indent (writer);
mono_json_writer_object_key(writer, "version");
char *build = mono_get_runtime_callbacks ()->get_runtime_build_info ();
mono_json_writer_printf (writer, "\"%s\",\n", build);
g_free (build);
mono_json_writer_indent (writer);
mono_json_writer_object_key(writer, "tlc");
@@ -455,24 +452,90 @@ mono_native_state_add_epilogue (JsonWriter *writer)
mono_json_writer_object_end (writer);
}
void
mono_native_state_init (JsonWriter *writer)
{
mono_native_state_add_prologue (writer);
}
char *
mono_native_state_emit (JsonWriter *writer)
{
mono_native_state_add_epilogue (writer);
return writer->text->str;
}
char *
mono_native_state_free (JsonWriter *writer, gboolean free_data)
{
mono_native_state_add_epilogue (writer);
char *output = NULL;
// Make this interface work like the g_string free does
if (!free_data)
output = g_strdup (writer->text->str);
mono_json_writer_destroy (writer);
return output;
}
void
mono_summarize_native_state_begin (void)
{
mono_json_writer_init_static ();
mono_native_state_add_prologue (&writer);
mono_native_state_init (&writer);
}
char *
mono_summarize_native_state_end (void)
{
mono_native_state_add_epilogue (&writer);
return writer.text->str;
return mono_native_state_emit (&writer);
}
void
mono_summarize_native_state_add_thread (MonoThreadSummary *thread, MonoContext *ctx)
{
mono_native_state_add_thread (&writer, thread, ctx);
static gboolean not_first_thread = FALSE;
mono_native_state_add_thread (&writer, thread, ctx, !not_first_thread);
not_first_thread = TRUE;
}
#endif // HOST_WIN32
void
mono_crash_dump (const char *jsonFile, MonoStackHash *hashes)
{
size_t size = strlen (jsonFile);
pid_t pid = getpid ();
gboolean success = FALSE;
// Save up to 100 dump files for a given stacktrace hash
for (int increment = 0; increment < 100; increment++) {
FILE* fp;
char *name = g_strdup_printf ("mono_crash.%d.%d.json", hashes->offset_free_hash, increment);
if ((fp = fopen (name, "ab"))) {
if (ftell (fp) == 0) {
fwrite (jsonFile, size, 1, fp);
success = TRUE;
}
} else {
// Couldn't make file and file doesn't exist
g_warning ("Didn't have permission to access %s for file dump\n", name);
}
/*cleanup*/
if (fp)
fclose (fp);
g_free (name);
if (success)
return;
}
return;
}
#endif // TARGET_OSX

View File

@@ -16,11 +16,16 @@
#include <mono/utils/mono-publib.h>
#include <mono/utils/mono-context.h>
#include <mono/metadata/threads-types.h>
#include <mono/utils/json.h>
#define MONO_NATIVE_STATE_PROTOCOL_VERSION "0.0.1"
MONO_BEGIN_DECLS
/*
* These use static memory, can only be called once
*/
void
mono_summarize_native_state_begin (void);
@@ -30,6 +35,25 @@ mono_summarize_native_state_end (void);
void
mono_summarize_native_state_add_thread (MonoThreadSummary *thread, MonoContext *ctx);
/*
* These use memory from the caller
*/
void
mono_native_state_init (JsonWriter *writer);
char *
mono_native_state_emit (JsonWriter *writer);
char *
mono_native_state_free (JsonWriter *writer, gboolean free_data);
void
mono_native_state_add_thread (JsonWriter *writer, MonoThreadSummary *thread, MonoContext *ctx, gboolean first_thread);
void
mono_crash_dump (const char *jsonFile, MonoStackHash *hashes);
MONO_END_DECLS
#endif // TARGET_OSX