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.
This commit is contained in:
marcel 2004-07-10 23:10:07 +00:00
parent 0207025c1c
commit 7aac216371
3 changed files with 24 additions and 25 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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: