Skip to content

Commit

Permalink
[pedump] Have the assembly search hook look at the same directory of …
Browse files Browse the repository at this point in the history
…the assembly being verified.

Unfortunately using mono_set_assemblies_path is not much of an option as it disables the MONO_PATH env var
and that's needed when working with an in-tree pedump - cuz having to `make install` all the time is BS.
  • Loading branch information
kumpera committed Aug 18, 2017
1 parent e91a66f commit bb2eff5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/pedump/pedump.c
Expand Up @@ -42,6 +42,8 @@ gboolean verify_metadata = FALSE;
gboolean verify_code = FALSE;
gboolean verify_partial_md = FALSE;

static char *assembly_directory[2];

static MonoAssembly *pedump_preload (MonoAssemblyName *aname, gchar **assemblies_path, gpointer user_data);
static void pedump_assembly_load_hook (MonoAssembly *assembly, gpointer user_data);
static MonoAssembly *pedump_assembly_search_hook (MonoAssemblyName *aname, gpointer user_data);
Expand Down Expand Up @@ -635,6 +637,8 @@ pedump_preload (MonoAssemblyName *aname,
if (assemblies_path && assemblies_path [0] != NULL) {
result = real_load (assemblies_path, aname->culture, aname->name, refonly);
}
if (!result)
result = real_load (assembly_directory, aname->culture, aname->name, refonly);

return result;
}
Expand Down Expand Up @@ -707,6 +711,8 @@ main (int argc, char *argv [])
//We have to force the runtime to load the corlib under verification as its own corlib so core types are properly populated in mono_defaults.
if (strstr (file, "mscorlib.dll"))
g_setenv ("MONO_PATH", g_path_get_dirname (file), 1);
assembly_directory [0] = g_path_get_dirname (file);
assembly_directory [1] = NULL;

#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters_init ();
Expand Down

0 comments on commit bb2eff5

Please sign in to comment.