aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2004-07-10 23:10:07 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2004-07-10 23:10:07 +0000
commita5a3d762725b081cc720ee6ea2c924abfdd92e4c (patch)
tree4ea67294f8c0b226a9862be4a237e4a26007bf63
parenteda20064f9914593117a1b66cbc201bc070b534a (diff)
downloadsrc-a5a3d762725b081cc720ee6ea2c924abfdd92e4c.tar.gz
src-a5a3d762725b081cc720ee6ea2c924abfdd92e4c.zip
Update for the KDB framework:
o Make debugging code conditional upon KDB instead of DDB. o Call kdb_enter() instead of Debugger(). o Remove implementation of Debugger(). o Check kdb_active instead of db_active. o Call kdb_trap() according to the new world order.
Notes
Notes: svn path=/head/; revision=131950
-rw-r--r--sys/sparc64/sparc64/machdep.c25
-rw-r--r--sys/sparc64/sparc64/mp_machdep.c9
-rw-r--r--sys/sparc64/sparc64/trap.c15
3 files changed, 24 insertions, 25 deletions
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index 2bc8329cb819..1671af43824f 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -45,6 +45,7 @@
#include <sys/systm.h>
#include <sys/cons.h>
#include <sys/imgact.h>
+#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/linker.h>
@@ -109,6 +110,10 @@
typedef int ofw_vec_t(void *);
+#ifdef DDB
+extern vm_offset_t ksym_start, ksym_end;
+#endif
+
struct tlb_entry *kernel_tlbs;
int kernel_tlb_slots;
@@ -305,10 +310,6 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
cpu_block_zero = bzero;
}
-#ifdef DDB
- kdb_init();
-#endif
-
#ifdef SMP
mp_tramp = mp_tramp_alloc();
#endif
@@ -383,9 +384,11 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
OF_getprop(root, "name", sparc64_model, sizeof(sparc64_model) - 1);
-#ifdef DDB
+ kdb_init();
+
+#ifdef KDB
if (boothowto & RB_KDB)
- Debugger("Boot flags requested debugger");
+ kdb_enter("Boot flags requested debugger");
#endif
}
@@ -743,16 +746,6 @@ exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings)
td->td_retval[1] = tf->tf_out[1];
}
-void
-Debugger(const char *msg)
-{
-
- printf("Debugger(\"%s\")\n", msg);
- critical_enter();
- breakpoint();
- critical_exit();
-}
-
int
fill_regs(struct thread *td, struct reg *regs)
{
diff --git a/sys/sparc64/sparc64/mp_machdep.c b/sys/sparc64/sparc64/mp_machdep.c
index 8625b436bda9..97ef3548836d 100644
--- a/sys/sparc64/sparc64/mp_machdep.c
+++ b/sys/sparc64/sparc64/mp_machdep.c
@@ -55,11 +55,10 @@
* $FreeBSD$
*/
-#include "opt_ddb.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
+#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/mutex.h>
@@ -76,8 +75,6 @@
#include <dev/ofw/openfirm.h>
-#include <ddb/ddb.h>
-
#include <machine/asi.h>
#include <machine/atomic.h>
#include <machine/bus.h>
@@ -446,8 +443,8 @@ cpu_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2)
return;
}
if (
-#ifdef DDB
- db_active ||
+#ifdef KDB
+ kdb_active ||
#endif
panicstr != NULL)
printf("ipi_send: couldn't send ipi to module %u\n", mid);
diff --git a/sys/sparc64/sparc64/trap.c b/sys/sparc64/sparc64/trap.c
index 0a0dbabe17c8..15a7b1ee2ae2 100644
--- a/sys/sparc64/sparc64/trap.c
+++ b/sys/sparc64/sparc64/trap.c
@@ -45,6 +45,7 @@
#include "opt_ktrace.h"
#include <sys/param.h>
+#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/interrupt.h>
@@ -283,7 +284,7 @@ trap(struct trapframe *tf)
}
if (debugger_on_signal &&
(sig == 4 || sig == 10 || sig == 11))
- Debugger("trapsig");
+ kdb_enter("trapsig");
trapsignal(td, sig, tf->tf_type);
}
@@ -296,11 +297,19 @@ trap(struct trapframe *tf)
KASSERT((tf->tf_type & T_KERNEL) != 0,
("trap: kernel trap isn't"));
+#ifdef KDB
+ if (kdb_active) {
+ kdb_reenter();
+ return;
+ }
+#endif
+
switch (tf->tf_type & ~T_KERNEL) {
-#ifdef DDB
+#ifdef KDB
case T_BREAKPOINT:
case T_KSTACK_FAULT:
- error = (kdb_trap(tf) == 0);
+ error = (kdb_trap(tf->tf_type, 0, tf) == 0);
+ TF_DONE(tf);
break;
#ifdef notyet
case T_PA_WATCHPOINT: