Index: kernel/generic/src/udebug/udebug_ops.c
===================================================================
--- kernel/generic/src/udebug/udebug_ops.c	(revision a53ed3a8097360ccf174e8d94fb407db919eb66a)
+++ kernel/generic/src/udebug/udebug_ops.c	(revision 34e1206ec4dc79f0592077e3ee270fba91d1eb9d)
@@ -82,8 +82,8 @@
 {
 	mutex_lock(&TASK->udebug.lock);
-	
+
 	/* thread_exists() must be called with threads_lock held */
 	irq_spinlock_lock(&threads_lock, true);
-	
+
 	if (!thread_exists(thread)) {
 		irq_spinlock_unlock(&threads_lock, true);
@@ -91,8 +91,8 @@
 		return ENOENT;
 	}
-	
+
 	/* thread->lock is enough to ensure the thread's existence */
 	irq_spinlock_exchange(&threads_lock, &thread->lock);
-	
+
 	/* Verify that 'thread' is a userspace thread. */
 	if (!thread->uspace) {
@@ -102,5 +102,5 @@
 		return ENOENT;
 	}
-	
+
 	/* Verify debugging state. */
 	if (thread->udebug.active != true) {
@@ -110,5 +110,5 @@
 		return ENOENT;
 	}
-	
+
 	/*
 	 * Since the thread has active == true, TASK->udebug.lock
@@ -118,7 +118,7 @@
 	 */
 	irq_spinlock_unlock(&thread->lock, true);
-	
+
 	/* Only mutex TASK->udebug.lock left. */
-	
+
 	/* Now verify that the thread belongs to the current task. */
 	if (thread->task != TASK) {
@@ -127,5 +127,5 @@
 		return ENOENT;
 	}
-	
+
 	/*
 	 * Now we need to grab the thread's debug lock for synchronization
@@ -134,8 +134,8 @@
 	 */
 	mutex_lock(&thread->udebug.lock);
-	
+
 	/* The big task mutex is no longer needed. */
 	mutex_unlock(&TASK->udebug.lock);
-	
+
 	if (thread->udebug.go != being_go) {
 		/* Not in debugging session or undesired GO state. */
@@ -143,7 +143,7 @@
 		return EINVAL;
 	}
-	
+
 	/* Only thread->udebug.lock left. */
-	
+
 	return EOK;  /* All went well. */
 }
@@ -177,16 +177,16 @@
 {
 	LOG("Debugging task %" PRIu64, TASK->taskid);
-	
-	mutex_lock(&TASK->udebug.lock);
-	
+
+	mutex_lock(&TASK->udebug.lock);
+
 	if (TASK->udebug.dt_state != UDEBUG_TS_INACTIVE) {
 		mutex_unlock(&TASK->udebug.lock);
 		return EBUSY;
 	}
-	
+
 	TASK->udebug.dt_state = UDEBUG_TS_BEGINNING;
 	TASK->udebug.begin_call = call;
 	TASK->udebug.debugger = call->sender;
-	
+
 	if (TASK->udebug.not_stoppable_count == 0) {
 		TASK->udebug.dt_state = UDEBUG_TS_ACTIVE;
@@ -195,7 +195,7 @@
 	} else
 		*active = false;  /* only in beginning state */
-	
+
 	/* Set udebug.active on all of the task's userspace threads. */
-	
+
 	list_foreach(TASK->threads, th_link, thread_t, thread) {
 		mutex_lock(&thread->udebug.lock);
@@ -207,5 +207,5 @@
 			mutex_unlock(&thread->udebug.lock);
 	}
-	
+
 	mutex_unlock(&TASK->udebug.lock);
 	return EOK;
@@ -222,9 +222,9 @@
 {
 	LOG("Task %" PRIu64, TASK->taskid);
-	
+
 	mutex_lock(&TASK->udebug.lock);
 	errno_t rc = udebug_task_cleanup(TASK);
 	mutex_unlock(&TASK->udebug.lock);
-	
+
 	return rc;
 }
@@ -242,15 +242,15 @@
 {
 	LOG("mask = 0x%x", mask);
-	
-	mutex_lock(&TASK->udebug.lock);
-	
+
+	mutex_lock(&TASK->udebug.lock);
+
 	if (TASK->udebug.dt_state != UDEBUG_TS_ACTIVE) {
 		mutex_unlock(&TASK->udebug.lock);
 		return EINVAL;
 	}
-	
+
 	TASK->udebug.evmask = mask;
 	mutex_unlock(&TASK->udebug.lock);
-	
+
 	return EOK;
 }
@@ -272,9 +272,9 @@
 	if (rc != EOK)
 		return rc;
-	
+
 	thread->udebug.go_call = call;
 	thread->udebug.go = true;
 	thread->udebug.cur_event = 0;  /* none */
-	
+
 	/*
 	 * Neither thread's lock nor threads_lock may be held during wakeup.
@@ -282,7 +282,7 @@
 	 */
 	waitq_wakeup(&thread->udebug.go_wq, WAKEUP_FIRST);
-	
+
 	_thread_op_end(thread);
-	
+
 	return EOK;
 }
@@ -300,5 +300,5 @@
 {
 	LOG("udebug_stop()");
-	
+
 	/*
 	 * On success, this will lock thread->udebug.lock. Note that this
@@ -309,8 +309,8 @@
 	if (rc != EOK)
 		return rc;
-	
+
 	/* Take GO away from the thread. */
 	thread->udebug.go = false;
-	
+
 	if (thread->udebug.stoppable != true) {
 		/* Answer will be sent when the thread becomes stoppable. */
@@ -318,25 +318,25 @@
 		return EOK;
 	}
-	
+
 	/*
 	 * Answer GO call.
 	 *
 	 */
-	
+
 	/* Make sure nobody takes this call away from us. */
 	call = thread->udebug.go_call;
 	thread->udebug.go_call = NULL;
-	
+
 	IPC_SET_RETVAL(call->data, 0);
 	IPC_SET_ARG1(call->data, UDEBUG_EVENT_STOP);
-	
+
 	THREAD->udebug.cur_event = UDEBUG_EVENT_STOP;
-	
+
 	_thread_op_end(thread);
-	
+
 	mutex_lock(&TASK->udebug.lock);
 	ipc_answer(&TASK->answerbox, call);
 	mutex_unlock(&TASK->udebug.lock);
-	
+
 	return EOK;
 }
@@ -368,10 +368,10 @@
 {
 	LOG("udebug_thread_read()");
-	
+
 	/* Allocate a buffer to hold thread IDs */
 	sysarg_t *id_buffer = malloc(buf_size + 1, 0);
-	
-	mutex_lock(&TASK->udebug.lock);
-	
+
+	mutex_lock(&TASK->udebug.lock);
+
 	/* Verify task state */
 	if (TASK->udebug.dt_state != UDEBUG_TS_ACTIVE) {
@@ -380,13 +380,13 @@
 		return EINVAL;
 	}
-	
+
 	irq_spinlock_lock(&TASK->lock, true);
-	
+
 	/* Copy down the thread IDs */
-	
+
 	size_t max_ids = buf_size / sizeof(sysarg_t);
 	size_t copied_ids = 0;
 	size_t extra_ids = 0;
-	
+
 	/* FIXME: make sure the thread isn't past debug shutdown... */
 	list_foreach(TASK->threads, th_link, thread_t, thread) {
@@ -394,9 +394,9 @@
 		bool uspace = thread->uspace;
 		irq_spinlock_unlock(&thread->lock, false);
-		
+
 		/* Not interested in kernel threads. */
 		if (!uspace)
 			continue;
-		
+
 		if (copied_ids < max_ids) {
 			/* Using thread struct pointer as identification hash */
@@ -405,13 +405,13 @@
 			extra_ids++;
 	}
-	
+
 	irq_spinlock_unlock(&TASK->lock, true);
-	
-	mutex_unlock(&TASK->udebug.lock);
-	
+
+	mutex_unlock(&TASK->udebug.lock);
+
 	*buffer = id_buffer;
 	*stored = copied_ids * sizeof(sysarg_t);
 	*needed = (copied_ids + extra_ids) * sizeof(sysarg_t);
-	
+
 	return EOK;
 }
@@ -431,10 +431,10 @@
 {
 	size_t name_size = str_size(TASK->name) + 1;
-	
+
 	*data = malloc(name_size, 0);
 	*data_size = name_size;
-	
+
 	memcpy(*data, TASK->name, name_size);
-	
+
 	return EOK;
 }
@@ -463,5 +463,5 @@
 	if (rc != EOK)
 		return rc;
-	
+
 	/* Additionally we need to verify that we are inside a syscall. */
 	if ((thread->udebug.cur_event != UDEBUG_EVENT_SYSCALL_B) &&
@@ -470,13 +470,13 @@
 		return EINVAL;
 	}
-	
+
 	/* Prepare a buffer to hold the arguments. */
 	sysarg_t *arg_buffer = malloc(6 * sizeof(sysarg_t), 0);
-	
+
 	/* Copy to a local buffer before releasing the lock. */
 	memcpy(arg_buffer, thread->udebug.syscall_args, 6 * sizeof(sysarg_t));
-	
+
 	_thread_op_end(thread);
-	
+
 	*buffer = arg_buffer;
 	return EOK;
@@ -506,5 +506,5 @@
 	if (rc != EOK)
 		return rc;
-	
+
 	istate_t *state = thread->udebug.uspace_state;
 	if (state == NULL) {
@@ -512,13 +512,13 @@
 		return EBUSY;
 	}
-	
+
 	/* Prepare a buffer to hold the data. */
 	istate_t *state_buf = malloc(sizeof(istate_t), 0);
-	
+
 	/* Copy to the allocated buffer */
 	memcpy(state_buf, state, sizeof(istate_t));
-	
+
 	_thread_op_end(thread);
-	
+
 	*buffer = (void *) state_buf;
 	return EOK;
@@ -540,12 +540,12 @@
 	/* Verify task state */
 	mutex_lock(&TASK->udebug.lock);
-	
+
 	if (TASK->udebug.dt_state != UDEBUG_TS_ACTIVE) {
 		mutex_unlock(&TASK->udebug.lock);
 		return EBUSY;
 	}
-	
+
 	void *data_buffer = malloc(n, 0);
-	
+
 	/*
 	 * NOTE: this is not strictly from a syscall... but that shouldn't
@@ -555,8 +555,8 @@
 	errno_t rc = copy_from_uspace(data_buffer, (void *) uspace_addr, n);
 	mutex_unlock(&TASK->udebug.lock);
-	
+
 	if (rc != EOK)
 		return rc;
-	
+
 	*buffer = data_buffer;
 	return EOK;
