Skip to content

Commit

Permalink
Revert "[runtime] Fix pedump by using the normal embedding APIs inste…
Browse files Browse the repository at this point in the history
…ad of in…" (mono#3479)
  • Loading branch information
vargaz authored Aug 29, 2016
1 parent 770ca46 commit f7a57d5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
1 change: 0 additions & 1 deletion tools/pedump/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
25 changes: 22 additions & 3 deletions tools/pedump/pedump.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <mono/metadata/class-internals.h>
#include <mono/metadata/verify-internals.h>
#include <mono/metadata/marshal.h>
#include <mono/mini/jit.h>
#include "mono/utils/mono-digest.h"
#include <mono/utils/mono-mmap.h>
#include <mono/utils/mono-counters.h>
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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, ",");
Expand Down

0 comments on commit f7a57d5

Please sign in to comment.