From f7a57d5f08b15cc2b8eeae3dece5eb4396a2e695 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Tue, 30 Aug 2016 00:01:18 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"[runtime]=20Fix=20pedump=20by=20using?= =?UTF-8?q?=20the=20normal=20embedding=20APIs=20instead=20of=20in=E2=80=A6?= =?UTF-8?q?"=20(#3479)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/pedump/Makefile.am | 1 - tools/pedump/pedump.c | 25 ++++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/tools/pedump/Makefile.am b/tools/pedump/Makefile.am index 3c9ccc4a77b9..d329d1fa9b1e 100644 --- a/tools/pedump/Makefile.am +++ b/tools/pedump/Makefile.am @@ -21,7 +21,6 @@ pedump_LDADD = \ $(top_builddir)/mono/sgen/libmonosgen-static.la \ $(top_builddir)/mono/io-layer/libwapi.la \ $(top_builddir)/mono/utils/libmonoutils.la \ - $(top_builddir)/mono/mini/libmini.la \ $(LLVM_LIBS) \ $(LLVM_LDFLAGS) \ $(GLIB_LIBS) \ diff --git a/tools/pedump/pedump.c b/tools/pedump/pedump.c index 62ae54f53675..4bbcc699335a 100644 --- a/tools/pedump/pedump.c +++ b/tools/pedump/pedump.c @@ -26,7 +26,6 @@ #include #include #include -#include #include "mono/utils/mono-digest.h" #include #include @@ -426,8 +425,6 @@ verify_image_file (const char *fname) "Ok", "Error", "Warning", NULL, "CLS", NULL, NULL, NULL, "Not Verifiable" }; - mono_jit_init_version ("pedump", NULL); - image = mono_image_open_raw (fname, &status); if (!image) { printf ("Could not open %s\n", fname); @@ -462,9 +459,22 @@ verify_image_file (const char *fname) image->assembly = assembly; mono_assembly_fill_assembly_name (image, &assembly->aname); + /*Finish initializing the runtime*/ + mono_install_assembly_load_hook (pedump_assembly_load_hook, NULL); + mono_install_assembly_search_hook (pedump_assembly_search_hook, NULL); + + mono_init_version ("pedump", image->version); + + mono_install_assembly_preload_hook (pedump_preload, GUINT_TO_POINTER (FALSE)); + + mono_icall_init (); + mono_marshal_init (); + + if (!verify_partial_md && !mono_verifier_verify_full_table_data (image, &errors)) goto invalid_image; + table = &image->tables [MONO_TABLE_TYPEDEF]; for (i = 1; i <= table->rows; ++i) { MonoError error; @@ -643,6 +653,15 @@ main (int argc, char *argv []) if (!file) usage (); + +#ifndef DISABLE_PERFCOUNTERS + mono_perfcounters_init (); +#endif + mono_counters_init (); + mono_metadata_init (); + mono_images_init (); + mono_assemblies_init (); + mono_loader_init (); if (verify_pe) { char *tok = strtok (flags, ",");