Index: kernel/generic/src/syscall/syscall.c
===================================================================
--- kernel/generic/src/syscall/syscall.c	(revision 9ba626269585e1a53a18d3fcf863bd3d86fae9a0)
+++ kernel/generic/src/syscall/syscall.c	(revision 60866a39276f095402ba62f4e3a3289af8ad446e)
@@ -60,7 +60,17 @@
 {
 	unative_t rc;
+
+#ifdef CONFIG_UDEBUG
+	bool debug;
+
+	/*
+	 * Early check for undebugged tasks. We do not lock anything as this
+	 * test need not be precise in either way.
+	 */
+	debug = THREAD->udebug.active;
 	
-#ifdef CONFIG_UDEBUG
-	udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);
+	if (debug) {
+		udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);
+	}
 #endif
 	
@@ -77,12 +87,15 @@
 	
 #ifdef CONFIG_UDEBUG
-	udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);
+	if (debug) {
+		udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);
 	
-	/*
-	 * Stopping point needed for tasks that only invoke non-blocking
-	 * system calls.
-	 */
-	udebug_stoppable_begin();
-	udebug_stoppable_end();
+		/*
+		 * Stopping point needed for tasks that only invoke
+		 * non-blocking system calls. Not needed if the task
+		 * is not being debugged (it cannot block here).
+		 */
+		udebug_stoppable_begin();
+		udebug_stoppable_end();
+	}
 #endif
 	
