Subject: Re: kgdb support for mips
To: Jeffrey M. Smith <jeffs@atheros.com>
From: Wayne Knowles <wdk@netbsd.org>
List: port-mips
Date: 07/01/2001 12:10:45
On Fri, 29 Jun 2001, Jeffrey M. Smith wrote:

>
> A bunch of the code was done at Geocast for kgdb
> on the mips, and I committed it back to the tree.
>
> I'm a bit out of touch with it, but I'd say your
> 80% of the way there.

I agree with the statement that it is about 80% of the way there.

The following patch should get you 90% of the way there:

Index: kern/kgdb_stub.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/kgdb_stub.c,v
retrieving revision 1.7
diff -u -r1.7 kgdb_stub.c
--- kern/kgdb_stub.c	2000/07/18 21:49:08	1.7
+++ kern/kgdb_stub.c	2001/06/30 23:53:51
@@ -395,6 +395,8 @@
 	/* Stick frame regs into our reg cache. */
 	kgdb_getregs(regs, gdb_regs);

+	db_clear_single_step(regs);
+
 	/*
 	 * Interact with gdb until it lets us go.
 	 * If we cause a trap, resume here.




Currently only the -mipsco and -sgimips ports gave KGDB hooks & drivers
implemented in their tree, and the -sgimips is currently untested.

There problems are related to the handling of the branch delay slot which
is a peculiarity of the MIPS family.   With the above patch you should be
able to single step straight line code, but there is a good chance KGDB
won't return if you step thru a branch or jump insn

-- 
Wayne Knowles			NetBSD/mipsco port maintainer
wdk@netbsd.org			http://www.netbsd.org