Skip to content

Commit

Permalink
Merge pull request mono#3478 from vargaz/fix-pedump
Browse files Browse the repository at this point in the history
[runtime] Fix pedump by using the normal embedding APIs instead of in…
  • Loading branch information
kumpera authored Aug 29, 2016
2 parents 66fd6fd + a9c75b0 commit 770ca46
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
1 change: 1 addition & 0 deletions tools/pedump/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ 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: 3 additions & 22 deletions tools/pedump/pedump.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#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 @@ -425,6 +426,8 @@ 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 @@ -459,22 +462,9 @@ 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 @@ -653,15 +643,6 @@ 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 770ca46

Please sign in to comment.