diff options
author | marcel <marcel@FreeBSD.org> | 2004-07-10 22:35:05 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2004-07-10 22:35:05 +0000 |
commit | 7837329bdfe23f2a05c70d4a072e7538923ac70e (patch) | |
tree | a3f809f792d343a5d5690d60b2a4c58ab3f154cf | |
parent | 6660e9e4c036ddedee1dea43979df8f99db432a7 (diff) | |
download | FreeBSD-src-7837329bdfe23f2a05c70d4a072e7538923ac70e.zip FreeBSD-src-7837329bdfe23f2a05c70d4a072e7538923ac70e.tar.gz |
Update fr the KDB framework:
o Make debugging support conditional upon KDB instead of DDB.
o Call kdb_trap() according to the new world order.
o Kill the NO_SIO option completely.
o Respect the boot_gdb environment variable.
o Don't make debug specific kernel options conditional.
o Remove implementation of Debugger().
-rw-r--r-- | sys/alpha/alpha/interrupt.c | 12 | ||||
-rw-r--r-- | sys/alpha/alpha/machdep.c | 43 | ||||
-rw-r--r-- | sys/alpha/alpha/trap.c | 23 |
3 files changed, 28 insertions, 50 deletions
diff --git a/sys/alpha/alpha/interrupt.c b/sys/alpha/alpha/interrupt.c index d32ce1e..066244d 100644 --- a/sys/alpha/alpha/interrupt.c +++ b/sys/alpha/alpha/interrupt.c @@ -31,8 +31,6 @@ * notice. */ -#include "opt_ddb.h" - #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ /* __KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.23 1998/02/24 07:38:01 thorpej Exp $");*/ __FBSDID("$FreeBSD$"); @@ -41,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/bus.h> #include <sys/interrupt.h> +#include <sys/kdb.h> #include <sys/kernel.h> #include <sys/ktr.h> #include <sys/lock.h> @@ -67,10 +66,6 @@ struct evcnt clock_intr_evcnt; /* event counter for clock intrs. */ #include <machine/intrcnt.h> #endif -#ifdef DDB -#include <ddb/ddb.h> -#endif - volatile int mc_expected, mc_received; static void @@ -108,6 +103,7 @@ interrupt(a0, a1, a2, framep) intr_restore(s); #endif atomic_add_int(&td->td_intr_nesting_level, 1); + #if KSTACK_GUARD_PAGES == 0 #ifndef SMP { @@ -231,8 +227,8 @@ fatal: printf(" pid = %d, comm = %s\n", curproc->p_pid, curproc->p_comm); printf("\n"); -#ifdef DDB - kdb_trap(mces, vector, param, ALPHA_KENTRY_MM, framep); +#ifdef KDB + kdb_trap(ALPHA_KENTRY_MM, mces, framep); #endif panic("machine check"); } diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 82c856d..ead24d3 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -100,6 +100,7 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/eventhandler.h> #include <sys/imgact.h> +#include <sys/kdb.h> #include <sys/sysproto.h> #include <sys/ktr.h> #include <sys/signalvar.h> @@ -145,7 +146,6 @@ __FBSDID("$FreeBSD$"); #include <machine/chipset.h> #include <machine/vmparam.h> #include <machine/elf.h> -#include <ddb/ddb.h> #include <alpha/alpha/db_instruction.h> #include <sys/vnode.h> #include <machine/sigframe.h> @@ -170,9 +170,7 @@ static char cpu_model[128]; SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, cpu_model, 0, ""); #ifdef DDB -/* start and end of kernel symbol table */ -void *ksym_start, *ksym_end; -db_regs_t ddb_regs; +extern vm_offset_t ksym_start, ksym_end; #endif int alpha_unaligned_print = 1; /* warn about unaligned accesses */ @@ -607,8 +605,8 @@ alpha_init(pfn, ptb, bim, bip, biv) */ kernstart = trunc_page(kernel_text) - 2 * PAGE_SIZE; #ifdef DDB - ksym_start = (void *)bootinfo.ssym; - ksym_end = (void *)bootinfo.esym; + ksym_start = bootinfo.ssym; + ksym_end = bootinfo.esym; kernend = (vm_offset_t)round_page(ksym_end); #else kernend = (vm_offset_t)round_page(_end); @@ -881,17 +879,10 @@ alpha_init(pfn, ptb, bim, bip, biv) * of some operations so needs to be after proc0/thread0/curthread * become valid. */ -#ifndef NO_SIO - if (platform.cons_init) { - platform.cons_init(); - promcndetach(); - } -#else if (platform.cons_init) platform.cons_init(); promcndetach(); cninit(); -#endif /* * Check to see if promcons needs to make_dev() now, @@ -932,11 +923,6 @@ alpha_init(pfn, ptb, bim, bip, biv) /* * Look at arguments passed to us and compute boothowto. */ - -#ifdef KADB - boothowto |= RB_KDB; -#endif -/* boothowto |= RB_KDB | RB_GDB; */ for (p = bootinfo.boot_flags; p && *p != '\0'; p++) { /* * Note that we'd really like to differentiate case here, @@ -956,7 +942,6 @@ alpha_init(pfn, ptb, bim, bip, biv) break; #endif -#if defined(DDB) case 'd': /* break into the kernel debugger ASAP */ case 'D': boothowto |= RB_KDB; @@ -965,7 +950,6 @@ alpha_init(pfn, ptb, bim, bip, biv) case 'G': boothowto |= RB_GDB; break; -#endif case 'h': /* always halt, never reboot */ case 'H': @@ -1026,12 +1010,13 @@ alpha_init(pfn, ptb, bim, bip, biv) /* * Initialize debuggers, and break into them if appropriate. */ -#ifdef DDB + if (getenv("boot_gdb") != NULL) + boothowto |= RB_GDB; kdb_init(); - if (boothowto & RB_KDB) { - printf("Boot flags requested debugger\n"); - breakpoint(); - } + +#ifdef KDB + if (boothowto & RB_KDB) + kdb_enter("Boot flags requested debugger\n"); #endif /* @@ -2246,14 +2231,6 @@ set_fpregs(td, fpregs) return (0); } -#ifndef DDB -void -Debugger(const char *msg) -{ - printf("Debugger(\"%s\") called.\n", msg); -} -#endif /* no DDB */ - static int sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS) { diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c index 886a2f8..4d3619e 100644 --- a/sys/alpha/alpha/trap.c +++ b/sys/alpha/alpha/trap.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> +#include <sys/kdb.h> #include <sys/ktr.h> #include <sys/sysproto.h> #include <sys/kernel.h> @@ -67,9 +68,6 @@ __FBSDID("$FreeBSD$"); #include <sys/ktrace.h> #endif -#ifdef DDB -#include <ddb/ddb.h> -#endif #include <alpha/alpha/db_instruction.h> /* for handle_opdec() */ unsigned long Sfloat_to_reg(unsigned int); @@ -285,6 +283,13 @@ trap(a0, a1, a2, entry, framep) #endif p = td->td_proc; +#ifdef KDB + if (kdb_active) { + kdb_reenter(); + return; + } +#endif + /* GIANT_REQUIRED; * Giant hasn't been acquired yet. @@ -367,20 +372,20 @@ trap(a0, a1, a2, entry, framep) * These are always fatal in kernel, and should never happen. */ if (!user) { -#ifdef DDB +#ifdef KDB /* - * ...unless, of course, DDB is configured; BUGCHK + * ...unless, of course, KDB is configured; BUGCHK * is used to invoke the kernel debugger, and we * might have set a breakpoint. */ if (a0 == ALPHA_IF_CODE_BUGCHK || a0 == ALPHA_IF_CODE_BPT) { - if (kdb_trap(a0, a1, a2, entry, framep)) + if (kdb_trap(entry, a0, framep)) goto out; } /* - * If we get here, DDB did _not_ handle the + * If we get here, KDB did _not_ handle the * trap, and we need to PANIC! */ #endif @@ -595,8 +600,8 @@ out: dopanic: printtrap(a0, a1, a2, entry, framep, 1, user); /* XXX dump registers */ -#ifdef DDB - kdb_trap(a0, a1, a2, entry, framep); +#ifdef KDB + kdb_trap(entry, a0, framep); #endif panic("trap"); } |