Index: kernel/generic/include/udebug/udebug_ops.h
===================================================================
--- kernel/generic/include/udebug/udebug_ops.h	(revision c81132d46eede2bacb1fa051d014dfb0a88d0ace)
+++ kernel/generic/include/udebug/udebug_ops.h	(revision 4cca9a9dd5728890c7903ba63fd38dee86e9703e)
@@ -37,6 +37,9 @@
 
 #include <ipc/ipc.h>
+#include <proc/thread.h>
+#include <stdbool.h>
+#include <stddef.h>
 
-int udebug_begin(call_t *call);
+int udebug_begin(call_t *call, bool *active);
 int udebug_end(void);
 int udebug_set_evmask(udebug_evmask_t mask);
Index: kernel/generic/src/udebug/udebug_ipc.c
===================================================================
--- kernel/generic/src/udebug/udebug_ipc.c	(revision c81132d46eede2bacb1fa051d014dfb0a88d0ace)
+++ kernel/generic/src/udebug/udebug_ipc.c	(revision 4cca9a9dd5728890c7903ba63fd38dee86e9703e)
@@ -72,7 +72,8 @@
 {
 	int rc;
-
-	rc = udebug_begin(call);
-	if (rc < 0) {
+	bool active;
+
+	rc = udebug_begin(call, &active);
+	if (rc != EOK) {
 		IPC_SET_RETVAL(call->data, rc);
 		ipc_answer(&TASK->kb.box, call);
@@ -84,6 +85,6 @@
 	 * send a reply.
 	 */
-	if (rc != 0) {
-		IPC_SET_RETVAL(call->data, 0);
+	if (active) {
+		IPC_SET_RETVAL(call->data, EOK);
 		ipc_answer(&TASK->kb.box, call);
 	}
Index: kernel/generic/src/udebug/udebug_ops.c
===================================================================
--- kernel/generic/src/udebug/udebug_ops.c	(revision c81132d46eede2bacb1fa051d014dfb0a88d0ace)
+++ kernel/generic/src/udebug/udebug_ops.c	(revision 4cca9a9dd5728890c7903ba63fd38dee86e9703e)
@@ -46,4 +46,5 @@
 #include <errno.h>
 #include <print.h>
+#include <stdbool.h>
 #include <str.h>
 #include <syscall/copy.h>
@@ -157,18 +158,21 @@
  *
  * Initiates a debugging session for the current task (and its threads).
- * When the debugging session has started a reply will be sent to the
+ * When the debugging session has started a reply should be sent to the
  * UDEBUG_BEGIN call. This may happen immediately in this function if
  * all the threads in this task are stoppable at the moment and in this
- * case the function returns 1.
- *
- * Otherwise the function returns 0 and the reply will be sent as soon as
- * all the threads become stoppable (i.e. they can be considered stopped).
+ * case the function sets @a *active to @c true.
+ *
+ * Otherwise the function sets @a *active to false and the resonse should
+ * be sent as soon as all the threads become stoppable (i.e. they can be
+ * considered stopped).
  *
  * @param call The BEGIN call we are servicing.
- *
- * @return 0 (OK, but not done yet), 1 (done) or negative error code.
- *
- */
-int udebug_begin(call_t *call)
+ * @param active Place to store @c true iff we went directly to active state,
+ *               @c false if we only went to beginning state
+ *
+ * @return EOK on success, EBUSY if the task is already has an active
+ *         debugging session.
+ */
+int udebug_begin(call_t *call, bool *active)
 {
 	LOG("Debugging task %" PRIu64, TASK->taskid);
@@ -185,12 +189,10 @@
 	TASK->udebug.debugger = call->sender;
 	
-	int reply;
-	
 	if (TASK->udebug.not_stoppable_count == 0) {
 		TASK->udebug.dt_state = UDEBUG_TS_ACTIVE;
 		TASK->udebug.begin_call = NULL;
-		reply = 1;  /* immediate reply */
+		*active = true;  /* directly to active state */
 	} else
-		reply = 0;  /* no reply */
+		*active = false;  /* only in beginning state */
 	
 	/* Set udebug.active on all of the task's userspace threads. */
@@ -207,5 +209,5 @@
 	
 	mutex_unlock(&TASK->udebug.lock);
-	return reply;
+	return EOK;
 }
 
