diff options
author | yokota <yokota@FreeBSD.org> | 2000-01-11 14:54:01 +0000 |
---|---|---|
committer | yokota <yokota@FreeBSD.org> | 2000-01-11 14:54:01 +0000 |
commit | 715966bf8adb1f06117b0690700bed09936230f4 (patch) | |
tree | 43bfbc350096f38a69febf5012643dcc32e4077e /sys/amd64 | |
parent | ddf2890cdfae4bd1cd3a719341689d029d64b580 (diff) | |
download | FreeBSD-src-715966bf8adb1f06117b0690700bed09936230f4.zip FreeBSD-src-715966bf8adb1f06117b0690700bed09936230f4.tar.gz |
Add a new mechanism, cndbctl(), to tell the console driver that
ddb is entered. Don't refer to `in_Debugger' to see if we
are in the debugger. (The variable used to be static in Debugger()
and wasn't updated if ddb is entered via traps and panic anyway.)
- Don't refer to `in_Debugger'.
- Add `db_active' to i386/i386/db_interface.d (as in
alpha/alpha/db_interface.c).
- Remove cnpollc() stub from ddb/db_input.c.
- Add the dbctl function to syscons, pcvt, and sio. (The function for
pcvt and sio is noop at the moment.)
Jointly developed by: bde and me
(The final version was tweaked by me and not reviewed by bde. Thus,
if there is any error in this commit, that is entirely of mine, not
his.)
Some changes were obtained from: NetBSD
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/db_interface.c | 16 | ||||
-rw-r--r-- | sys/amd64/amd64/trap.c | 6 |
2 files changed, 10 insertions, 12 deletions
diff --git a/sys/amd64/amd64/db_interface.c b/sys/amd64/amd64/db_interface.c index 2369154..839d9b7 100644 --- a/sys/amd64/amd64/db_interface.c +++ b/sys/amd64/amd64/db_interface.c @@ -52,6 +52,7 @@ extern jmp_buf db_jmpbuf; extern void gdb_handle_exception __P((db_regs_t *, int, int)); +int db_active; db_regs_t ddb_regs; static jmp_buf db_global_jmpbuf; @@ -132,8 +133,6 @@ kdb_trap(type, code, regs) ddb_regs.tf_ss = rss(); } - cnpollc(TRUE); - #ifdef SMP #ifdef CPUSTOP_ON_DDBBREAK @@ -153,10 +152,14 @@ kdb_trap(type, code, regs) (void) setjmp(db_global_jmpbuf); db_global_jmpbuf_valid = TRUE; - if (ddb_mode) + db_active++; + if (ddb_mode) { + cndbctl(TRUE); db_trap(type, code); - else + cndbctl(FALSE); + } else gdb_handle_exception(&ddb_regs, type, code); + db_active--; db_global_jmpbuf_valid = FALSE; #ifdef SMP @@ -181,8 +184,6 @@ kdb_trap(type, code, regs) #endif /* CPUSTOP_ON_DDBBREAK */ #endif /* SMP */ - cnpollc(FALSE); - regs->tf_eip = ddb_regs.tf_eip; regs->tf_eflags = ddb_regs.tf_eflags; regs->tf_eax = ddb_regs.tf_eax; @@ -296,12 +297,11 @@ db_write_bytes(addr, size, data) * Move this to machdep.c and allow it to be called if any debugger is * installed. */ -volatile int in_Debugger = 0; - void Debugger(msg) const char *msg; { + static volatile u_char in_Debugger; /* * XXX diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index e1bfac4..4199346 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -90,9 +90,7 @@ #include <machine/vm86.h> -#ifdef DDB - extern int in_Debugger, debugger_on_panic; -#endif +#include <ddb/ddb.h> #include "isa.h" #include "npx.h" @@ -900,7 +898,7 @@ trap_fatal(frame, eva) return; #endif #ifdef DDB - if ((debugger_on_panic || in_Debugger) && kdb_trap(type, 0, frame)) + if ((debugger_on_panic || db_active) && kdb_trap(type, 0, frame)) return; #endif printf("trap number = %d\n", type); |