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:
authormonojenkins <jo.shields+jenkins@xamarin.com>2020-03-17 18:59:07 +0300
committerGitHub <noreply@github.com>2020-03-17 18:59:07 +0300
commit8487188883f830600a22f76c0e593ba4c01ca53a (patch)
tree70d7e0569d0491bfc8e3c787c4172c3810201561
parentf2379f2d66505faf2705aaf277bf07e8d69cbd17 (diff)
[2019-12] [merp] Add breadcrumb for StackHash (#19243)mono-6.10.0.96
* [merp] Add breadcrumb for StackHash Contributes to https://github.com/mono/mono/issues/18715 Co-authored-by: Alexis Christoforides <alexis@thenull.net>
-rw-r--r--mono/metadata/threads.c3
-rw-r--r--mono/utils/mono-state.c14
-rw-r--r--mono/utils/mono-state.h3
3 files changed, 20 insertions, 0 deletions
diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c
index 712dad4b7b4..470e7fcdfb8 100644
--- a/mono/metadata/threads.c
+++ b/mono/metadata/threads.c
@@ -6513,6 +6513,9 @@ summarizer_state_term (SummarizerGlobalState *state, gchar **out, gchar *mem, si
mono_get_eh_callbacks ()->mono_summarize_managed_stack (threads [i]);
}
+ /* The value of the breadcrumb should match the "StackHash" value written by `mono_merp_write_fingerprint_payload` */
+ mono_create_crash_hash_breadcrumb (controlling);
+
MonoStateWriter writer;
memset (&writer, 0, sizeof (writer));
diff --git a/mono/utils/mono-state.c b/mono/utils/mono-state.c
index 572f6976a4c..27cc909e8b6 100644
--- a/mono/utils/mono-state.c
+++ b/mono/utils/mono-state.c
@@ -156,6 +156,12 @@ file_for_dump_reason_breadcrumb (const char *directory, const char *dump_reason,
g_snprintf (buff, sizeof_buff, "%s%scrash_reason_%s", directory, G_DIR_SEPARATOR_S, dump_reason);
}
+static void
+file_for_hash_breadcrumb (const char *directory, MonoStackHash hashes, gchar *buff, size_t sizeof_buff)
+{
+ g_snprintf (buff, sizeof_buff, "%s%scrash_hash_0x%" PRIx64 "", directory, G_DIR_SEPARATOR_S, (uint64_t)hashes.offset_rich_hash);
+}
+
static void create_breadcrumb (const char *path)
{
int handle = g_open (path, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
@@ -184,6 +190,14 @@ create_dump_reason_breadcrumb (const char *dump_reason)
create_breadcrumb (out_file);
}
+void
+mono_create_crash_hash_breadcrumb (MonoThreadSummary *thread)
+{
+ char out_file [200];
+ file_for_hash_breadcrumb (log.directory, thread->hashes, out_file, sizeof(out_file));
+ create_breadcrumb (out_file);
+}
+
gboolean
mono_summarize_set_timeline_dir (const char *directory)
{
diff --git a/mono/utils/mono-state.h b/mono/utils/mono-state.h
index 8b5e6b4dec0..ae49faee1df 100644
--- a/mono/utils/mono-state.h
+++ b/mono/utils/mono-state.h
@@ -123,6 +123,9 @@ mono_crash_save_failfast_msg (char *msg);
const char*
mono_crash_get_failfast_msg (void);
+void
+mono_create_crash_hash_breadcrumb (MonoThreadSummary *thread);
+
#endif // DISABLE_CRASH_REPORTING
// Dump context functions (enter/leave)