From 20bdb3ec834c1bad4162852d498ab52ca28271ed Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Wed, 3 May 2017 17:34:50 -0400 Subject: [PATCH] [pedump] Fix running with cooperative GC This is the pedump analog of 9f5115a343213e7ce27b197c96274cc611a05284 which fixed monodis under coop. --- tools/pedump/pedump.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/pedump/pedump.c b/tools/pedump/pedump.c index 072b535f299..829cda2bdf1 100644 --- a/tools/pedump/pedump.c +++ b/tools/pedump/pedump.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "mono/utils/mono-digest.h" #include #include @@ -616,6 +617,11 @@ pedump_assembly_search_hook (MonoAssemblyName *aname, gpointer user_data) return NULL; } +static void +thread_state_init (MonoThreadUnwindState *ctx) +{ +} + #define VALID_ONLY_FLAG 0x08000000 #define VERIFY_CODE_ONLY MONO_VERIFY_ALL + 1 #define VERIFY_METADATA_ONLY VERIFY_CODE_ONLY + 1 @@ -632,6 +638,7 @@ main (int argc, char *argv []) const char *flag_desc [] = {"error", "warn", "cls", "all", "code", "fail-on-verifiable", "non-strict", "valid-only", "metadata", "partial-md", NULL}; guint flag_vals [] = {MONO_VERIFY_ERROR, MONO_VERIFY_WARNING, MONO_VERIFY_CLS, MONO_VERIFY_ALL, VERIFY_CODE_ONLY, MONO_VERIFY_FAIL_FAST, MONO_VERIFY_NON_STRICT, VALID_ONLY_FLAG, VERIFY_METADATA_ONLY, VERIFY_PARTIAL_METADATA, 0}; int i, verify_flags = MONO_VERIFY_REPORT_ALL_ERRORS, run_new_metadata_verifier = 0; + MonoThreadInfoRuntimeCallbacks ticallbacks; for (i = 1; i < argc; i++){ if (argv [i][0] != '-'){ @@ -659,11 +666,19 @@ main (int argc, char *argv []) #endif mono_counters_init (); mono_tls_init_runtime_keys (); + 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_metadata_init (); mono_images_init (); mono_assemblies_init (); mono_loader_init (); + if (verify_pe) { char *tok = strtok (flags, ","); -- 2.25.1