[loader] If probing for a pinvoke fails, log the error mono_dl_symbol gives us.
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 2 Feb 2015 16:04:37 +0000 (11:04 -0500)
committerRodrigo Kumpera <kumpera@gmail.com>
Thu, 5 Mar 2015 20:12:36 +0000 (15:12 -0500)
We used to swallow the error, which is unhelpful.

The reason for that might be because we probe multiple names before giving up but
even then, it's ok log all attempts. It will make troubleshooting easy, even if we
have to go through a lot more log entries.

mono/metadata/loader.c

index d0ea4441087dc30c8b43e5227d5354a366fee64c..233efef8aaa5fb3a5c42289f0107d81bbe2bce23 100644 (file)
@@ -1735,12 +1735,16 @@ mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char
                                                                "Probing '%s'.", mangled_name2);
 
                                        error_msg = mono_dl_symbol (module, mangled_name2, &piinfo->addr);
-                                       g_free (error_msg);
-                                       error_msg = NULL;
 
                                        if (piinfo->addr)
                                                mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT,
                                                                        "Found as '%s'.", mangled_name2);
+                                       else
+                                               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT,
+                                                                       "Could not find '%s' due to '%s'.", mangled_name2, error_msg);
+
+                                       g_free (error_msg);
+                                       error_msg = NULL;
 
                                        if (mangled_name != mangled_name2)
                                                g_free (mangled_name2);