[interp] Remove unreachable code (#12411)
[mono-project.git] / mono / utils / mono-state.h
blobda3b970ef619128eb350e184a7eb6a73e9d2b3ff
1 /**
2 * \file
3 * Support for cooperative creation of unmanaged state dumps
5 * Author:
6 * Alexander Kyte (alkyte@microsoft.com)
8 * (C) 2018 Microsoft, Inc.
11 #ifndef __MONO_UTILS_NATIVE_STATE__
12 #define __MONO_UTILS_NATIVE_STATE__
14 #ifndef DISABLE_CRASH_REPORTING
16 #include <mono/utils/mono-publib.h>
17 #include <mono/utils/mono-context.h>
18 #include <mono/metadata/threads-types.h>
19 #include <mono/utils/json.h>
21 #define MONO_NATIVE_STATE_PROTOCOL_VERSION "0.0.2"
23 typedef enum {
24 MonoSummaryNone = 0,
25 MonoSummarySetup = 1,
26 MonoSummarySuspendHandshake = 2,
27 MonoSummaryDumpTraversal = 3,
28 MonoSummaryStateWriter = 4,
29 MonoSummaryMerpWriter = 5,
30 MonoSummaryMerpInvoke = 6,
31 MonoSummaryCleanup = 7,
32 MonoSummaryDone = 8,
34 MonoSummaryDoubleFault = 9
35 } MonoSummaryStage;
37 typedef struct {
38 char *output_str;
39 int len;
40 int allocated_len;
41 int indent;
42 } MonoStateWriter;
44 // Logging
45 gboolean
46 mono_summarize_set_timeline_dir (const char *directory);
48 void
49 mono_summarize_timeline_start (void);
51 void
52 mono_summarize_timeline_phase_log (MonoSummaryStage stage);
54 void
55 mono_summarize_double_fault_log (void);
57 MonoSummaryStage
58 mono_summarize_timeline_read_level (const char *directory, gboolean clear);
60 // Json State Writer
63 * These use static memory, can only be called once
66 void
67 mono_summarize_native_state_begin (char *mem, int size);
69 char *
70 mono_summarize_native_state_end (void);
72 void
73 mono_summarize_native_state_add_thread (MonoThreadSummary *thread, MonoContext *ctx, gboolean crashing_thread);
76 * These use memory from the caller
78 void
79 mono_state_writer_init (MonoStateWriter *writer, gchar *output_str, int len);
81 void
82 mono_native_state_init (MonoStateWriter *writer);
84 char *
85 mono_native_state_emit (MonoStateWriter *writer);
87 char *
88 mono_native_state_free (MonoStateWriter *writer, gboolean free_data);
90 void
91 mono_native_state_add_thread (MonoStateWriter *writer, MonoThreadSummary *thread, MonoContext *ctx, gboolean first_thread, gboolean crashing_thread);
93 void
94 mono_crash_dump (const char *jsonFile, MonoStackHash *hashes);
96 #endif // DISABLE_CRASH_REPORTING
98 #endif // MONO_UTILS_NATIVE_STATE