Bug 354248: log the error information retrieved by NSLinkEditError in
authorwtc%google.com
Wed, 21 Nov 2007 01:44:51 +0000
changeset 3894 68551a05e6801fecc74d87ab2fb56ac5745cec5e
parent 3878 5158f39b66eb492a0d28646eb10b12a48ff54f39
child 3895 6d34d3dbded134332fd3e7213c5b7c691f912a5e
push idunknown
push userunknown
push dateunknown
bugs354248
Bug 354248: log the error information retrieved by NSLinkEditError in pr_LoadViaDyld. The patch is contributed by Nick Kreeger <nick.kreeger@park.edu>. r=mark.mentovai,wtc.
pr/src/linking/prlink.c
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -769,20 +769,26 @@ pr_LoadCFBundle(const char *name, PRLibr
 
 static PRStatus
 pr_LoadViaDyld(const char *name, PRLibrary *lm)
 {
     lm->dlh = pr_LoadMachDyldModule(name);
     if (lm->dlh == NULL) {
         lm->image = NSAddImage(name, NSADDIMAGE_OPTION_RETURN_ON_ERROR
                                | NSADDIMAGE_OPTION_WITH_SEARCHING);
-        /*
-         * TODO: If NSAddImage fails, use NSLinkEditError to retrieve
-         * error information.
-         */
+        if (lm->image == NULL) {
+            NSLinkEditErrors linkEditError;
+            int errorNum;
+            const char *errorString;
+            const char *fileName;
+            NSLinkEditError(&linkEditError, &errorNum, &fileName, &errorString);
+            PR_LOG(_pr_linker_lm, PR_LOG_MIN, 
+                   ("LoadMachDyldModule error %d:%d for file %s:\n%s",
+                    linkEditError, errorNum, fileName, errorString));
+        }
     }
     return (lm->dlh != NULL || lm->image != NULL) ? PR_SUCCESS : PR_FAILURE;
 }
 
 #endif /* XP_MACOSX */
 
 #ifdef WIN95
 static HMODULE WINAPI