Index: arch/mips32/src/exception.c
===================================================================
--- arch/mips32/src/exception.c	(revision ebbdb8fd8b3f471868d0d452f8ad473aa432226e)
+++ arch/mips32/src/exception.c	(revision e07fe0c1834e24beaa907000673e1e37acbc7c7d)
@@ -38,4 +38,6 @@
 #include <print.h>
 #include <interrupt.h>
+#include <func.h>
+#include <console/kconsole.h>
 
 static char * exctable[] = {
@@ -86,4 +88,15 @@
 {
 	struct exception_regdump *pstate = (struct exception_regdump *)data;
+	char *symbol = get_symtab_entry(pstate->epc);
+
+#ifdef CONFIG_DEBUG	
+	printf("***Breakpoint %p in %s.\n", pstate->epc, symbol);
+	printf("***Type 'exit' to exit kconsole.\n");
+	/* Umm..we should rather set some 'debugstate' here */
+	haltstate = 1;
+	kconsole("debug");
+	haltstate = 0;
+#endif
+
 	/* it is necessary to not re-execute BREAK instruction after 
 	   returning from Exception handler
Index: generic/include/console/kconsole.h
===================================================================
--- generic/include/console/kconsole.h	(revision ebbdb8fd8b3f471868d0d452f8ad473aa432226e)
+++ generic/include/console/kconsole.h	(revision e07fe0c1834e24beaa907000673e1e37acbc7c7d)
@@ -69,5 +69,5 @@
 
 extern void kconsole_init(void);
-extern void kconsole(void *arg);
+extern void kconsole(void *prompt);
 
 extern int cmd_register(cmd_info_t *cmd);
Index: generic/src/console/cmd.c
===================================================================
--- generic/src/console/cmd.c	(revision ebbdb8fd8b3f471868d0d452f8ad473aa432226e)
+++ generic/src/console/cmd.c	(revision e07fe0c1834e24beaa907000673e1e37acbc7c7d)
@@ -59,4 +59,10 @@
 };
 
+static cmd_info_t exit_info = {
+	.name = "exit",
+	.description ="Exit kconsole",
+	.argc = 0
+};
+
 /** Data and methods for 'description' command. */
 static int cmd_desc(cmd_arg_t *argv);
@@ -257,4 +263,8 @@
 	if (!cmd_register(&desc_info))
 		panic("could not register command %s\n", desc_info.name);
+
+	cmd_initialize(&exit_info);
+	if (!cmd_register(&exit_info))
+		panic("could not register command %s\n", exit_info.name);
 	
 	cmd_initialize(&symaddr_info);
Index: generic/src/console/kconsole.c
===================================================================
--- generic/src/console/kconsole.c	(revision ebbdb8fd8b3f471868d0d452f8ad473aa432226e)
+++ generic/src/console/kconsole.c	(revision e07fe0c1834e24beaa907000673e1e37acbc7c7d)
@@ -41,4 +41,5 @@
 #include <func.h>
 #include <symtab.h>
+#include <macros.h>
 
 /** Simple kernel console.
@@ -396,5 +397,5 @@
  * @param arg Not used.
  */
-void kconsole(void *arg)
+void kconsole(void *prompt)
 {
 	cmd_info_t *cmd_info;
@@ -408,5 +409,5 @@
 	
 	while (true) {
-		cmdline = clever_readline(__FUNCTION__, stdin);
+		cmdline = clever_readline(prompt, stdin);
 		len = strlen(cmdline);
 		if (!len)
@@ -415,4 +416,7 @@
 		if (!cmd_info)
 			continue;
+		if (strncmp(cmd_info->name,"exit", \
+			    min(strlen(cmd_info->name),5)) == 0)
+			break;
 		(void) cmd_info->func(cmd_info->argv);
 	}
Index: generic/src/lib/func.c
===================================================================
--- generic/src/lib/func.c	(revision ebbdb8fd8b3f471868d0d452f8ad473aa432226e)
+++ generic/src/lib/func.c	(revision e07fe0c1834e24beaa907000673e1e37acbc7c7d)
@@ -49,5 +49,5 @@
 #ifdef CONFIG_DEBUG
 	printf("\n");
-	kconsole(NULL); /* Run kconsole as a last resort to user */
+	kconsole("panic"); /* Run kconsole as a last resort to user */
 #endif      
 
Index: generic/src/main/kinit.c
===================================================================
--- generic/src/main/kinit.c	(revision ebbdb8fd8b3f471868d0d452f8ad473aa432226e)
+++ generic/src/main/kinit.c	(revision e07fe0c1834e24beaa907000673e1e37acbc7c7d)
@@ -134,5 +134,5 @@
 	 * Create kernel console.
 	 */
-	if (t = thread_create(kconsole, NULL, TASK, 0))
+	if (t = thread_create(kconsole, "kconsole", TASK, 0))
 		thread_ready(t);
 	else panic("thread_create/kconsole\n");
Index: kernel.config
===================================================================
--- kernel.config	(revision ebbdb8fd8b3f471868d0d452f8ad473aa432226e)
+++ kernel.config	(revision e07fe0c1834e24beaa907000673e1e37acbc7c7d)
@@ -82,3 +82,4 @@
 @ "thread/thread1" Thread test 1
 @ "mm/mapping1" Mapping test 1
+@ [ARCH=mips32] "debug/mips1" Mips breakpoint-debug test 
 ! CONFIG_TEST (choice)
Index: test/debug/mips1/test.c
===================================================================
--- test/debug/mips1/test.c	(revision e07fe0c1834e24beaa907000673e1e37acbc7c7d)
+++ test/debug/mips1/test.c	(revision e07fe0c1834e24beaa907000673e1e37acbc7c7d)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2005 Ondrej Palkovsky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <print.h>
+#include <debug.h>
+#include <panic.h>
+
+#include <test.h>
+#include <arch/atomic.h>
+#include <proc/thread.h>
+#include <time/delay.h>
+
+#include <arch.h>
+
+
+void test(void)
+{
+	printf("MIPS debug test #1\n");
+
+	printf("You should enter kconsole debug mode now.\n");
+
+	asm __volatile__ ("break");
+
+	printf("Test passed.\n");
+}
