Skip to content

Commit

Permalink
[monodis] Don't segfault using cooperative GC.
Browse files Browse the repository at this point in the history
monodis with coop enabled segfaulted in mono_thread_info_attach
  • Loading branch information
lambdageek committed Sep 15, 2016
1 parent 9600693 commit 9f5115a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions mono/dis/main.c
Expand Up @@ -32,6 +32,7 @@
#include <mono/metadata/assembly.h>
#include <mono/metadata/appdomain.h>
#include <mono/utils/bsearch.h>
#include <mono/utils/mono-counters.h>

static void setup_filter (MonoImage *image);
static gboolean should_include_type (int idx);
Expand Down Expand Up @@ -1963,9 +1964,16 @@ usage (void)
exit (1);
}

static void
thread_state_init (MonoThreadUnwindState *ctx)
{
}

int
main (int argc, char *argv [])
{
MonoThreadInfoRuntimeCallbacks ticallbacks;

GList *input_files = NULL, *l;
int i, j;

Expand Down Expand Up @@ -2016,6 +2024,15 @@ main (int argc, char *argv [])
if (input_files == NULL)
usage ();

CHECKED_MONO_INIT ();
mono_counters_init ();
memset (&ticallbacks, 0, sizeof (ticallbacks));
ticallbacks.thread_state_init = thread_state_init;
#ifndef HOST_WIN32
mono_w32handle_init ();
#endif
mono_threads_runtime_init (&ticallbacks);

mono_install_assembly_load_hook (monodis_assembly_load_hook, NULL);
mono_install_assembly_search_hook (monodis_assembly_search_hook, NULL);

Expand Down

0 comments on commit 9f5115a

Please sign in to comment.