Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/monodroid/jni/monodroid-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -3423,7 +3423,7 @@ set_trace_options (void)
/* Profiler support cribbed from mono/metadata/profiler.c */

typedef void (*ProfilerInitializer) (const char*);
#define INITIALIZER_NAME "mono_profiler_startup"
#define INITIALIZER_NAME "mono_profiler_init"

static mono_bool
load_profiler (void *handle, const char *desc, const char *symbol)
Expand Down Expand Up @@ -3467,7 +3467,7 @@ load_embedded_profiler (const char *desc, const char *name)
}

static mono_bool
load_profiler_from_directory (const char *directory, const char *libname, const char *desc)
load_profiler_from_directory (const char *directory, const char *libname, const char *desc, const char *name)
{
char *full_name = path_combine (directory, libname);
int exists = file_exists (full_name);
Expand All @@ -3482,7 +3482,9 @@ load_profiler_from_directory (const char *directory, const char *libname, const
free (full_name);

if (h) {
mono_bool result = load_profiler (h, desc, INITIALIZER_NAME);
char *symbol = monodroid_strdup_printf ("%s_%s", INITIALIZER_NAME, name);
mono_bool result = load_profiler (h, desc, symbol);
free (symbol);
if (result)
return 1;
dlclose (h);
Expand Down Expand Up @@ -3512,18 +3514,18 @@ monodroid_profiler_load (const char *libmono_path, const char *desc, const char
for (oi = 0; oi < MAX_OVERRIDES; ++oi) {
if (!directory_exists (override_dirs [oi]))
continue;
if ((found = load_profiler_from_directory (override_dirs [oi], libname, desc)))
if ((found = load_profiler_from_directory (override_dirs [oi], libname, desc, mname)))
break;
}

do {
if (found)
break;
if ((found = load_profiler_from_directory (app_libdir, libname, desc)))
if ((found = load_profiler_from_directory (app_libdir, libname, desc, mname)))
break;
if ((found = load_embedded_profiler (desc, mname)))
break;
if (libmono_path != NULL && (found = load_profiler_from_directory (libmono_path, libname, desc)))
if (libmono_path != NULL && (found = load_profiler_from_directory (libmono_path, libname, desc, mname)))
break;
} while (0);

Expand Down