diff --git a/gio/gcontenttype.c b/gio/gcontenttype.c
index 3c7b16f..5653c8f 100644
--- a/gio/gcontenttype.c
+++ b/gio/gcontenttype.c
@@ -900,6 +900,8 @@ g_content_type_guess (const char   *filename,
   
   G_LOCK (gio_xdgmime);
   
+  printf("DEBUG: checking file_name=%s, data=%p\n", filename?filename:"", data);
+  
   if (filename)
     {
       i = strlen (filename);
@@ -922,6 +924,7 @@ g_content_type_guess (const char   *filename,
   /* Got an extension match, and no conflicts. This is it. */
   if (n_name_mimetypes == 1)
     {
+      printf("DEBUG: return exact match %s\n", name_mimetypes[0]);
       G_UNLOCK (gio_xdgmime);
       return g_strdup (name_mimetypes[0]);
     }
@@ -943,6 +946,8 @@ g_content_type_guess (const char   *filename,
       if (filename != NULL &&
           strcmp (sniffed_mimetype, "application/x-desktop") == 0)
         sniffed_mimetype = "text/plain";
+        
+      printf("DEBUG: sniffed mimetype %s\n", sniffed_mimetype);
     }
   
   if (n_name_mimetypes == 0)
@@ -952,6 +957,7 @@ g_content_type_guess (const char   *filename,
 	*result_uncertain = TRUE;
       
       mimetype = g_strdup (sniffed_mimetype);
+      printf("DEBUG: return sniffed mimetype %s\n", sniffed_mimetype);
     }
   else
     {
@@ -984,7 +990,11 @@ g_content_type_guess (const char   *filename,
 	  mimetype = g_strdup (name_mimetypes[0]);
 	  if (result_uncertain)
 	    *result_uncertain = TRUE;
+      printf("DEBUG: return uncertain mimetype %s\n", mimetype);
 	}
+    else {
+      printf("DEBUG: return certain mimetype %s\n", mimetype);
+    }
     }
   
   G_UNLOCK (gio_xdgmime);
diff --git a/gio/xdgmime/xdgmime.c b/gio/xdgmime/xdgmime.c
index 0888583..d78a934 100644
--- a/gio/xdgmime/xdgmime.c
+++ b/gio/xdgmime/xdgmime.c
@@ -582,9 +582,12 @@ xdg_mime_get_mime_types_from_file_name (const char *file_name,
 {
   xdg_mime_init ();
   
-  if (_caches)
+  if (_caches) {
+    printf("DEBUG: cached lookup: '%s',%d\n",file_name,n_mime_types);
     return _xdg_mime_cache_get_mime_types_from_file_name (file_name, mime_types, n_mime_types);
+  }
   
+  printf("DEBUG: non-cached lookup: '%s',%d\n",file_name,n_mime_types);
   return _xdg_glob_hash_lookup_file_name (global_hash, file_name, mime_types, n_mime_types);
 }
 
diff --git a/gio/xdgmime/xdgmimecache.c b/gio/xdgmime/xdgmimecache.c
index 97fe975..f425b06 100644
--- a/gio/xdgmime/xdgmimecache.c
+++ b/gio/xdgmime/xdgmimecache.c
@@ -112,7 +112,7 @@ XdgMimeCache *
 _xdg_mime_cache_new_from_file (const char *file_name)
 {
   XdgMimeCache *cache = NULL;
-
+  
 #ifdef HAVE_MMAP
   int fd = -1;
   struct stat st;
@@ -156,6 +156,8 @@ _xdg_mime_cache_new_from_file (const char *file_name)
 
 #endif  /* HAVE_MMAP */
 
+  printf("DEBUG: read cache %p from '%s'\n",cache, file_name);
+
   return cache;
 }
 
@@ -474,6 +476,8 @@ cache_glob_node_lookup_suffix (XdgMimeCache  *cache,
   character = file_name[len - 1];
 
   assert (character != 0);
+  
+  printf("DEBUG: cache_glob_node_lookup_suffix(%p,%s), n_entries=%d\n", cache, file_name, n_entries);
 
   min = 0;
   max = n_entries - 1;
@@ -607,6 +609,7 @@ cache_glob_lookup_file_name (const char *file_name,
   if (n > 0)
     {
       free (lower_case);
+      printf("DEBUG: cache_glob_lookup_literal (lower_case, mime_types, n_mime_types, FALSE) = %d\n",n);
       return n;
     }
 
@@ -614,13 +617,17 @@ cache_glob_lookup_file_name (const char *file_name,
   if (n > 0)
     {
       free (lower_case);
+      printf("DEBUG: cache_glob_lookup_literal (file_name, mime_types, n_mime_types, TRUE) = %d\n",n);
       return n;
     }
 
   len = strlen (file_name);
   n = cache_glob_lookup_suffix (lower_case, len, FALSE, mimes, n_mimes);
-  if (n == 0)
+  printf("DEBUG: cache_glob_lookup_suffix (lower_case, len, FALSE, mimes, n_mimes) = %d\n",n);
+  if (n == 0) {
     n = cache_glob_lookup_suffix (file_name, len, TRUE, mimes, n_mimes);
+    printf("DEBUG: cache_glob_lookup_suffix (file_name, len, TRUE, mimes, n_mimes) = %d\n",n);
+  }
 
   free (lower_case);
 
