Index: uspace/lib/c/rtld/arch/ia32/src/reloc.c
===================================================================
--- uspace/lib/c/rtld/arch/ia32/src/reloc.c	(revision b678410d7e2eada8e2e3f65aaf7c4efc831777d6)
+++ uspace/lib/c/rtld/arch/ia32/src/reloc.c	(revision a6dffb87dcaf2a7ccc2024825b36ea3c06c77e48)
@@ -41,4 +41,5 @@
 #include <symbol.h>
 #include <rtld.h>
+#include <rtld_debug.h>
 
 #include <rtld_arch.h>
Index: uspace/lib/c/rtld/arch/mips32/src/reloc.c
===================================================================
--- uspace/lib/c/rtld/arch/mips32/src/reloc.c	(revision b678410d7e2eada8e2e3f65aaf7c4efc831777d6)
+++ uspace/lib/c/rtld/arch/mips32/src/reloc.c	(revision a6dffb87dcaf2a7ccc2024825b36ea3c06c77e48)
@@ -41,4 +41,5 @@
 #include <symbol.h>
 #include <rtld.h>
+#include <rtld_debug.h>
 
 #include <rtld_arch.h>
Index: uspace/lib/c/rtld/arch/ppc32/src/reloc.c
===================================================================
--- uspace/lib/c/rtld/arch/ppc32/src/reloc.c	(revision b678410d7e2eada8e2e3f65aaf7c4efc831777d6)
+++ uspace/lib/c/rtld/arch/ppc32/src/reloc.c	(revision a6dffb87dcaf2a7ccc2024825b36ea3c06c77e48)
@@ -41,4 +41,5 @@
 #include <symbol.h>
 #include <rtld.h>
+#include <rtld_debug.h>
 #include <smc.h>
 
Index: uspace/lib/c/rtld/dynamic.c
===================================================================
--- uspace/lib/c/rtld/dynamic.c	(revision b678410d7e2eada8e2e3f65aaf7c4efc831777d6)
+++ uspace/lib/c/rtld/dynamic.c	(revision a6dffb87dcaf2a7ccc2024825b36ea3c06c77e48)
@@ -41,4 +41,5 @@
 #include <dynamic.h>
 #include <rtld.h>
+#include <rtld_debug.h>
 
 void dynamic_parse(elf_dyn_t *dyn_ptr, size_t bias, dyn_info_t *info)
Index: uspace/lib/c/rtld/include/rtld.h
===================================================================
--- uspace/lib/c/rtld/include/rtld.h	(revision b678410d7e2eada8e2e3f65aaf7c4efc831777d6)
+++ uspace/lib/c/rtld/include/rtld.h	(revision a6dffb87dcaf2a7ccc2024825b36ea3c06c77e48)
@@ -42,13 +42,4 @@
 #include <module.h>
 
-/* Define to enable debugging mode. */
-#undef RTLD_DEBUG
-
-#ifdef RTLD_DEBUG
-	#define DPRINTF(format, ...) printf(format, ##__VA_ARGS__)
-#else
-	#define DPRINTF(format, ...) if (0) printf(format, ##__VA_ARGS__)
-#endif
-
 typedef struct {
 	elf_dyn_t *rtld_dynamic;
Index: uspace/lib/c/rtld/include/rtld_debug.h
===================================================================
--- uspace/lib/c/rtld/include/rtld_debug.h	(revision a6dffb87dcaf2a7ccc2024825b36ea3c06c77e48)
+++ uspace/lib/c/rtld/include/rtld_debug.h	(revision a6dffb87dcaf2a7ccc2024825b36ea3c06c77e48)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2011 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup generic	
+ * @{
+ */
+/** @file
+ */
+
+#ifndef RTLD_DEBUG_H_
+#define RTLD_DEBUG_H_
+
+#include <sys/types.h>
+#include <adt/list.h>
+
+#include <dynamic.h>
+#include <module.h>
+
+/* Define to enable debugging mode. */
+#undef RTLD_DEBUG
+
+#ifdef RTLD_DEBUG
+	#define DPRINTF(format, ...) printf(format, ##__VA_ARGS__)
+#else
+	#define DPRINTF(format, ...) if (0) printf(format, ##__VA_ARGS__)
+#endif
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/rtld/module.c
===================================================================
--- uspace/lib/c/rtld/module.c	(revision b678410d7e2eada8e2e3f65aaf7c4efc831777d6)
+++ uspace/lib/c/rtld/module.c	(revision a6dffb87dcaf2a7ccc2024825b36ea3c06c77e48)
@@ -43,4 +43,5 @@
 
 #include <rtld.h>
+#include <rtld_debug.h>
 #include <dynamic.h>
 #include <elf_load.h>
@@ -97,4 +98,6 @@
 	module_t *m;
 	const char *p, *soname;
+
+	DPRINTF("module_find('%s')\n", name);
 
 	/*
@@ -107,5 +110,7 @@
 
 	/* Traverse list of all modules. Not extremely fast, but simple */
+	DPRINTF("head = %p\n", head);
 	for (cur = head->next; cur != head; cur = cur->next) {
+		DPRINTF("cur = %p\n", cur);
 		m = list_get_instance(cur, module_t, modules_link);
 		if (str_cmp(m->dyn.soname, soname) == 0) {
@@ -185,4 +190,6 @@
 	module_t *dm;
 	size_t n, i;
+
+	DPRINTF("module_load_deps('%s')\n", m->dyn.soname);
 
 	/* Count direct dependencies */
Index: uspace/lib/c/rtld/symbol.c
===================================================================
--- uspace/lib/c/rtld/symbol.c	(revision b678410d7e2eada8e2e3f65aaf7c4efc831777d6)
+++ uspace/lib/c/rtld/symbol.c	(revision a6dffb87dcaf2a7ccc2024825b36ea3c06c77e48)
@@ -40,4 +40,5 @@
 
 #include <rtld.h>
+#include <rtld_debug.h>
 #include <symbol.h>
 #include <elf.h>
