Print dlerror() when dyld functions fail unexpectedly
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Dec 2011 04:35:22 +0000 (04:35 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Dec 2011 04:35:22 +0000 (04:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75185

Reviewed by Sam Weinig.

* platform/mac/SoftLinking.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@103647 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/mac/SoftLinking.h

index 1a8ce85b7b72f6a2e6a6633023cd5da87a506909..b0cd246b7589bc939b94069adc07131009ff422d 100644 (file)
@@ -1,3 +1,12 @@
+2011-12-23  Dan Bernstein  <mitz@apple.com>
+
+        Print dlerror() when dyld functions fail unexpectedly
+        https://bugs.webkit.org/show_bug.cgi?id=75185
+
+        Reviewed by Sam Weinig.
+
+        * platform/mac/SoftLinking.h:
+
 2011-12-23  Sam Weinig  <sam@webkit.org>
 
         Start extracting platform specific bits out of PlatformEvents
index ff17dd1c5224d38d4103228d00c3a665e671bda4..d43c3034e506c1622b053804805393b8cb195dfa 100644 (file)
@@ -33,7 +33,7 @@
     static void* lib##Library() \
     { \
         static void* dylib = dlopen("/usr/lib/" #lib ".dylib", RTLD_NOW); \
-        ASSERT(dylib); \
+        ASSERT_WITH_MESSAGE(dylib, "%s", dlerror()); \
         return dylib; \
     }
 
@@ -41,7 +41,7 @@
     static void* framework##Library() \
     { \
         static void* frameworkLibrary = dlopen("/System/Library/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
-        ASSERT(frameworkLibrary); \
+        ASSERT_WITH_MESSAGE(frameworkLibrary, "%s", dlerror()); \
         return frameworkLibrary; \
     }
 
@@ -56,7 +56,7 @@
     static void* framework##Library() \
     { \
         static void* frameworkLibrary = dlopen("/System/Library/Frameworks/CoreServices.framework/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
-        ASSERT(frameworkLibrary); \
+        ASSERT_WITH_MESSAGE(frameworkLibrary, "%s", dlerror()); \
         return frameworkLibrary; \
     }
 
@@ -67,7 +67,7 @@
     static resultType init##functionName parameterDeclarations \
     { \
         softLink##functionName = (resultType (*) parameterDeclarations) dlsym(framework##Library(), #functionName); \
-        ASSERT(softLink##functionName); \
+        ASSERT_WITH_MESSAGE(softLink##functionName, "%s", dlerror()); \
         return softLink##functionName parameterNames; \
     }\
     \
     static type init##name() \
     { \
         void** pointer = static_cast<void**>(dlsym(framework##Library(), #name)); \
-        ASSERT(pointer); \
+        ASSERT_WITH_MESSAGE(pointer, "%s", dlerror()); \
         pointer##name = static_cast<type>(*pointer); \
         get##name = name##Function; \
         return pointer##name; \
     static type init##name() \
     { \
         void* constant = dlsym(framework##Library(), #name); \
-        ASSERT(constant); \
+        ASSERT_WITH_MESSAGE(constant, "%s", dlerror()); \
         constant##name = *static_cast<type*>(constant); \
         get##name = name##Function; \
         return constant##name; \