Index: pakchois.c
===================================================================
--- pakchois.c	(revision 39)
+++ pakchois.c	(working copy)
@@ -105,7 +105,9 @@
 {
     char module_path[] = PAKCHOIS_MODPATH;
     char *next = module_path;
-    
+
+    fprintf(stderr, "pakchois: module path [%s]\n", module_path);
+
     while (next) {
         char *dir = next, *sep = strchr(next, ':');
         unsigned i;
@@ -118,6 +120,8 @@
             next = NULL;
         }
 
+        fprintf(stderr, "pakchois: module directory '%s'...\n", dir);
+
         for (i = 0; suffix_prefixes[i][0]; i++) {
             char path[PATH_MAX];
             void *h;
@@ -125,17 +129,29 @@
             snprintf(path, sizeof path, "%s/%s%s%s", dir,
                      suffix_prefixes[i][0], name, suffix_prefixes[i][1]);
 
+            fprintf(stderr, "pakchois: loading %s\n", path);
+
             h = dlopen(path, RTLD_LOCAL|RTLD_NOW);
             if (h != NULL) {
                 *gfl = dlsym(h, "C_GetFunctionList");
                 if (*gfl) {
                     return h;
                 }
+                else {
+                    fprintf(stderr, "pakchois: C_GFL lookup failed for %s: %s.\n",
+                            name, dlerror());
+                }
                 dlclose(h);
             }
+            else {
+                fprintf(stderr, "pakchois: dlopen failed for %s: %s\n",
+                        name, dlerror());
+            }
         }
     }
 
+    fprintf(stderr, "pakchois: fell through; nothing worked.\n");
+
     return NULL;
 }            
 
@@ -164,6 +180,7 @@
     char *cname;
 
     if (pthread_mutex_lock(&provider_mutex) != 0) {
+        fprintf(stderr, "pakchois: mutex lock failed.\n");
         return CKR_CANT_LOCK;
     }
 
@@ -226,6 +243,8 @@
     provider_list = prov;
 
     pthread_mutex_unlock(&provider_mutex);
+
+    fprintf(stderr, "pakchois: loaded %s OK.\n", name);
     
     return CKR_OK;
 fail_ctx:        
@@ -237,6 +256,7 @@
 fail_locked:
     pthread_mutex_unlock(&provider_mutex);
     *provider = NULL;
+    fprintf(stderr, "pakchois: load failed with %ld\n", rv);
     return rv;
 }    
 


