Index: kernel/generic/include/proc/thread.h
===================================================================
--- kernel/generic/include/proc/thread.h	(revision df58e448060bb6d63ea118d30cb9b3b9b8c059bf)
+++ kernel/generic/include/proc/thread.h	(revision 875c629b6e613286c8356c783a344d75acc6f382)
@@ -140,10 +140,4 @@
 	bool interrupted;
 	
-	/**
-	 * If true, the scheduler will print a stack trace
-	 * to the kernel console upon scheduling this thread.
-	 */
-	bool btrace;
-	
 	/** If true, thread_join_timeout() cannot be used on this thread. */
 	bool detached;
@@ -196,4 +190,10 @@
 	
 #ifdef CONFIG_UDEBUG
+	/**
+	 * If true, the scheduler will print a stack trace
+	 * to the kernel console upon scheduling this thread.
+	 */
+	bool btrace;
+	
 	/** Debugging stuff */
 	udebug_thread_t udebug;
@@ -245,5 +245,8 @@
 extern void thread_update_accounting(bool);
 extern bool thread_exists(thread_t *);
+
+#ifdef CONFIG_UDEBUG
 extern void thread_stack_trace(thread_id_t);
+#endif
 
 /** Fpu context slab cache. */
Index: kernel/generic/src/console/cmd.c
===================================================================
--- kernel/generic/src/console/cmd.c	(revision df58e448060bb6d63ea118d30cb9b3b9b8c059bf)
+++ kernel/generic/src/console/cmd.c	(revision 875c629b6e613286c8356c783a344d75acc6f382)
@@ -111,4 +111,5 @@
 
 #ifdef CONFIG_TEST
+
 /* Data and methods for 'test' command. */
 static char test_buf[MAX_CMDLINE + 1];
@@ -148,5 +149,6 @@
 	.argv = bench_argv
 };
-#endif
+
+#endif /* CONFIG_TEST */
 
 /* Data and methods for 'description' command. */
@@ -383,4 +385,6 @@
 };
 
+#ifdef CONFIG_UDEBUG
+
 /* Data and methods for 'btrace' command */
 static int cmd_btrace(cmd_arg_t *argv);
@@ -395,4 +399,6 @@
 	.argv = &btrace_argv
 };
+
+#endif /* CONFIG_UDEBUG */
 
 static int cmd_sched(cmd_arg_t *argv);
@@ -492,5 +498,4 @@
 
 static cmd_info_t *basic_commands[] = {
-	&btrace_info,
 	&call0_info,
 	&mcall0_info,
@@ -523,4 +528,7 @@
 	&bench_info,
 #endif
+#ifdef CONFIG_UDEBUG
+	&btrace_info,
+#endif
 	NULL
 };
@@ -980,4 +988,6 @@
 }
 
+#ifdef CONFIG_UDEBUG
+
 /** Command for printing thread stack trace
  *
@@ -992,4 +1002,6 @@
 	return 1;
 }
+
+#endif /* CONFIG_UDEBUG */
 
 /** Command for printing scheduler information
Index: kernel/generic/src/proc/scheduler.c
===================================================================
--- kernel/generic/src/proc/scheduler.c	(revision df58e448060bb6d63ea118d30cb9b3b9b8c059bf)
+++ kernel/generic/src/proc/scheduler.c	(revision 875c629b6e613286c8356c783a344d75acc6f382)
@@ -102,4 +102,5 @@
 #endif
 	
+#ifdef CONFIG_UDEBUG
 	if (THREAD->btrace) {
 		istate_t *istate = THREAD->udebug.uspace_state;
@@ -111,4 +112,5 @@
 		THREAD->btrace = false;
 	}
+#endif
 }
 
Index: kernel/generic/src/proc/thread.c
===================================================================
--- kernel/generic/src/proc/thread.c	(revision df58e448060bb6d63ea118d30cb9b3b9b8c059bf)
+++ kernel/generic/src/proc/thread.c	(revision 875c629b6e613286c8356c783a344d75acc6f382)
@@ -338,5 +338,4 @@
 	
 	thread->interrupted = false;
-	thread->btrace = false;
 	thread->detached = false;
 	waitq_initialize(&thread->join_wq);
@@ -351,5 +350,6 @@
 	
 #ifdef CONFIG_UDEBUG
-	/* Init debugging stuff */
+	/* Initialize debugging stuff */
+	thread->btrace = false;
 	udebug_thread_initialize(&thread->udebug);
 #endif
@@ -752,4 +752,6 @@
 }
 
+#ifdef CONFIG_UDEBUG
+
 void thread_stack_trace(thread_id_t thread_id)
 {
@@ -794,4 +796,6 @@
 	irq_spinlock_unlock(&threads_lock, true);
 }
+
+#endif /* CONFIG_UDEBUG */
 
 /** Process syscall to create new thread.
