Index: libcfa/src/bits/debug.hfa
===================================================================
--- libcfa/src/bits/debug.hfa	(revision b25aafadcc83b9d9380c55d644d06c39eca99169)
+++ libcfa/src/bits/debug.hfa	(revision 851fd922c452a3693f22ace8775f19ea83de680a)
@@ -9,7 +9,7 @@
 // Author           : Thierry Delisle
 // Created On       : Mon Nov 28 12:27:26 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Feb  4 12:29:21 2020
-// Update Count     : 9
+// Last Modified By : Andrew Beach
+// Last Modified On : Mon Apr 27 10:15:00 2020
+// Update Count     : 10
 //
 
@@ -40,5 +40,4 @@
 #endif
 	#include <stdarg.h>
-	#include <stdio.h>
 
 	extern void __cfaabi_bits_write( int fd, const char buffer[], int len );
@@ -49,8 +48,16 @@
 	extern void __cfaabi_bits_print_vararg( int fd, const char fmt[], va_list arg );
 	extern void __cfaabi_bits_print_buffer( int fd, char buffer[], int buffer_size, const char fmt[], ... ) __attribute__(( format(printf, 4, 5) ));
+
+#if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_IO__) \
+		|| defined(__CFA_DEBUG_PRINT_MONITOR__) || defined(__CFA_DEBUG_PRINT_PREEMPTION__) \
+		|| defined(__CFA_DEBUG_PRINT_RUNTIME_CORE__) || defined(__CFA_DEBUG_PRINT_EXCEPTION__)
+	#include <stdio.h>
+	#include <unistd.h>
+#endif
 #ifdef __cforall
 }
 #endif
 
+// Deprecated: Use the versions with the new module names.
 #ifdef __CFA_DEBUG_PRINT__
 	#define __cfaabi_dbg_write( buffer, len )         __cfaabi_bits_write( STDERR_FILENO, buffer, len )
@@ -73,4 +80,57 @@
 #endif
 
+// Debug print functions and statements:
+// Most are wrappers around the bits printing function but are not always used.
+// If they are used depends if the group (first argument) is active or not. The group must be one
+// defined belowe. The other arguments depend on the wrapped function.
+#define __cfadbg_write(group, buffer, len) \
+	__CFADBG_PRINT_GROUP_##group(__cfaabi_bits_write(STDERR_FILENO, buffer, len))
+#define __cfadbg_acquire(group) \
+	__CFADBG_PRINT_GROUP_##group(__cfaabi_bits_acquire())
+#define __cfadbg_release(group) \
+	__CFADBG_PRINT_GROUP_##group(__cfaabi_bits_release())
+#define __cfadbg_print_safe(group, ...) \
+	__CFADBG_PRINT_GROUP_##group(__cfaabi_bits_print_safe(STDERR_FILENO, __VA_ARGS__))
+#define __cfadbg_print_nolock(group, ...) \
+	__CFADBG_PRINT_GROUP_##group(__cfaabi_bits_print_nolock(STDERR_FILENO, __VA_ARGS__))
+#define __cfadbg_print_buffer(group, ...) \
+	__CFADBG_PRINT_GROUP_##group(__cfaabi_bits_print_buffer(STDERR_FILENO, __VA_ARGS__))
+#define __cfadbg_print_buffer_decl(group, ...) \
+	__CFADBG_PRINT_GROUP_##group(char __dbg_text[256]; int __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_bits_write( __dbg_text, __dbg_len ))
+#define __cfadbg_print_buffer_local(group, ...) \
+	__CFADBG_PRINT_GROUP_##group(__dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_bits_write(STDERR_FILENO, __dbg_text, __dbg_len))
+
+// The debug print groups:
+#if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_IO__)
+#	define __CFADBG_PRINT_GROUP_io(...) __VA_ARGS__
+#else
+#	define __CFADBG_PRINT_GROUP_io(...) ((void)0)
+#endif
+#if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_MONITOR__)
+#	define __CFADBG_PRINT_GROUP_monitor(...) __VA_ARGS__
+#else
+#	define __CFADBG_PRINT_GROUP_monitor(...) ((void)0)
+#endif
+#if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_PREEMPTION__)
+#	define __CFADBG_PRINT_GROUP_preemption(...) __VA_ARGS__
+#else
+#	define __CFADBG_PRINT_GROUP_preemption(...) ((void)0)
+#endif
+#if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_RUNTIME_CORE__)
+#	define __CFADBG_PRINT_GROUP_runtime_core(...) __VA_ARGS__
+#else
+#	define __CFADBG_PRINT_GROUP_runtime_core(...) ((void)0)
+#endif
+#if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_READY_QUEUE__)
+#	define __CFADBG_PRINT_GROUP_ready_queue(...) __VA_ARGS__
+#else
+#	define __CFADBG_PRINT_GROUP_ready_queue(...) ((void)0)
+#endif
+#if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_EXCEPTION__)
+#	define __CFADBG_PRINT_GROUP_exception(...) __VA_ARGS__
+#else
+#	define __CFADBG_PRINT_GROUP_exception(...) ((void)0)
+#endif
+
 // Local Variables: //
 // mode: c //
Index: libcfa/src/exception.c
===================================================================
--- libcfa/src/exception.c	(revision b25aafadcc83b9d9380c55d644d06c39eca99169)
+++ libcfa/src/exception.c	(revision 851fd922c452a3693f22ace8775f19ea83de680a)
@@ -83,5 +83,5 @@
 	struct exception_context_t * context = this_exception_context();
 
-	__cfaabi_dbg_print_safe("Throwing resumption exception\n");
+	__cfadbg_print_safe(exception, "Throwing resumption exception\n");
 
 	__attribute__((cleanup(reset_top_resume)))
@@ -96,5 +96,5 @@
 	}
 
-	__cfaabi_dbg_print_safe("Unhandled exception\n");
+	__cfadbg_print_safe(exception, "Unhandled exception\n");
 
 	// Fall back to termination:
@@ -180,5 +180,5 @@
 	struct exception_context_t * context = this_exception_context();
 
-	__cfaabi_dbg_print_safe("Deleting Exception\n");
+	__cfadbg_print_safe(exception, "Deleting Exception\n");
 
 	// Remove the exception from the list.
@@ -218,5 +218,5 @@
 		void * stop_param) {
 	// Verify actions follow the rules we expect.
-	verify((actions & _UA_CLEANUP_PHASE) && actions & (_UA_FORCE_UNWIND));
+	verify((actions & _UA_CLEANUP_PHASE) && (actions & _UA_FORCE_UNWIND));
 	verify(!(actions & (_UA_SEARCH_PHASE | _UA_HANDER_FRAME)));
 
@@ -261,5 +261,5 @@
 
 void __cfaehm_throw_terminate( exception_t * val ) {
-	__cfaabi_dbg_print_safe("Throwing termination exception\n");
+	__cfadbg_print_safe(exception, "Throwing termination exception\n");
 
 	__cfaehm_allocate_exception( val );
@@ -268,5 +268,5 @@
 
 void __cfaehm_rethrow_terminate(void) {
-	__cfaabi_dbg_print_safe("Rethrowing termination exception\n");
+	__cfadbg_print_safe(exception, "Rethrowing termination exception\n");
 
 	__cfaehm_begin_unwind();
@@ -284,6 +284,6 @@
 {
 
-	//__cfaabi_dbg_print_safe("CFA: 0x%lx\n", _Unwind_GetCFA(context));
-	__cfaabi_dbg_print_safe("Personality function (%d, %x, %llu, %p, %p):",
+	//__cfadbg_print_safe(exception, "CFA: 0x%lx\n", _Unwind_GetCFA(context));
+	__cfadbg_print_safe(exception, "Personality function (%d, %x, %llu, %p, %p):",
 			version, actions, exception_class, unwind_exception, unwind_context);
 
@@ -294,15 +294,15 @@
 	if (actions & _UA_SEARCH_PHASE) {
 		verify(actions == _UA_SEARCH_PHASE);
-		__cfaabi_dbg_print_safe(" lookup phase");
+		__cfadbg_print_safe(exception, " lookup phase");
 	// ... we are in clean-up phase.
 	} else {
 		verify(actions & _UA_CLEANUP_PHASE);
-		__cfaabi_dbg_print_safe(" cleanup phase");
+		__cfadbg_print_safe(exception, " cleanup phase");
 		// We shouldn't be the handler frame during forced unwind.
 		if (actions & _UA_HANDLER_FRAME) {
 			verify(!(actions & _UA_FORCE_UNWIND));
-			__cfaabi_dbg_print_safe(" (handler frame)");
+			__cfadbg_print_safe(exception, " (handler frame)");
 		} else if (actions & _UA_FORCE_UNWIND) {
-			__cfaabi_dbg_print_safe(" (force unwind)");
+			__cfadbg_print_safe(exception, " (force unwind)");
 		}
 	}
@@ -345,5 +345,5 @@
 			void * ep = (void*)lsd_info.Start + callsite_start + callsite_len;
 			void * ip = (void*)instruction_ptr;
-			__cfaabi_dbg_print_safe("\nfound %p - %p (%p, %p, %p), looking for %p\n",
+			__cfadbg_print_safe(exception, "\nfound %p - %p (%p, %p, %p), looking for %p\n",
 					bp, ep, ls, cs, cl, ip);
 #endif // __CFA_DEBUG_PRINT__
@@ -360,5 +360,5 @@
 		if ( 0 == callsite_landing_pad ) {
 			// Nothing to do, move along
-			__cfaabi_dbg_print_safe(" no landing pad");
+			__cfadbg_print_safe(exception, " no landing pad");
 		} else if (actions & _UA_SEARCH_PHASE) {
 			// In search phase, these means we found a potential handler we must check.
@@ -398,7 +398,7 @@
 				// Based on the return value, check if we matched the exception
 				if (ret == _URC_HANDLER_FOUND) {
-					__cfaabi_dbg_print_safe(" handler found\n");
+					__cfadbg_print_safe(exception, " handler found\n");
 				} else {
-					__cfaabi_dbg_print_safe(" no handler\n");
+					__cfadbg_print_safe(exception, " no handler\n");
 				}
 				return ret;
@@ -406,5 +406,5 @@
 
 			// This is only a cleanup handler, ignore it
-			__cfaabi_dbg_print_safe(" no action");
+			__cfadbg_print_safe(exception, " no action");
 		} else {
 			// In clean-up phase, no destructors here but this could be the handler.
@@ -428,5 +428,5 @@
 			_Unwind_SetIP( unwind_context, ((lsd_info.LPStart) + (callsite_landing_pad)) );
 
-			__cfaabi_dbg_print_safe(" action\n");
+			__cfadbg_print_safe(exception, " action\n");
 
 			// Return have some action to run
@@ -435,8 +435,8 @@
 	}
 	// No handling found
-	__cfaabi_dbg_print_safe(" table end reached\n");
+	__cfadbg_print_safe(exception, " table end reached");
 
 	UNWIND:
-	__cfaabi_dbg_print_safe(" unwind\n");
+	__cfadbg_print_safe(exception, " unwind\n");
 
 	// Keep unwinding the stack
Index: libcfa/src/interpose.cfa
===================================================================
--- libcfa/src/interpose.cfa	(revision b25aafadcc83b9d9380c55d644d06c39eca99169)
+++ libcfa/src/interpose.cfa	(revision 851fd922c452a3693f22ace8775f19ea83de680a)
@@ -15,4 +15,5 @@
 
 #include <stdarg.h>										// va_start, va_end
+#include <stdio.h>
 #include <string.h>										// strlen
 #include <unistd.h>										// _exit, getpid
