summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/amd64/amd64/db_interface.c16
-rw-r--r--sys/ddb/db_ps.c11
-rw-r--r--sys/i386/i386/db_interface.c16
3 files changed, 22 insertions, 21 deletions
diff --git a/sys/amd64/amd64/db_interface.c b/sys/amd64/amd64/db_interface.c
index 2ba81da..26635d3 100644
--- a/sys/amd64/amd64/db_interface.c
+++ b/sys/amd64/amd64/db_interface.c
@@ -58,7 +58,6 @@ int db_active;
db_regs_t ddb_regs;
static jmp_buf db_global_jmpbuf;
-static int db_global_jmpbuf_valid;
#ifdef __GNUC__
#define rss() ({u_short ss; __asm __volatile("mov %%ss,%0" : "=r" (ss)); ss;})
@@ -119,7 +118,7 @@ kdb_trap(type, code, regs)
* non-ddb functions. db_nofault only applies to memory accesses by
* internal ddb commands.
*/
- if (db_global_jmpbuf_valid)
+ if (db_active)
longjmp(db_global_jmpbuf, 1);
/*
@@ -154,16 +153,17 @@ kdb_trap(type, code, regs)
#endif /* SMP */
(void) setjmp(db_global_jmpbuf);
- db_global_jmpbuf_valid = TRUE;
- db_active++;
if (ddb_mode) {
- cndbctl(TRUE);
+ if (!db_active)
+ cndbctl(TRUE);
+ db_active = 1;
db_trap(type, code);
cndbctl(FALSE);
- } else
+ } else {
+ db_active = 1;
gdb_handle_exception(&ddb_regs, type, code);
- db_active--;
- db_global_jmpbuf_valid = FALSE;
+ }
+ db_active = 0;
#ifdef SMP
#ifdef CPUSTOP_ON_DDBBREAK
diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c
index 05c0778..7025ee3 100644
--- a/sys/ddb/db_ps.c
+++ b/sys/ddb/db_ps.c
@@ -120,14 +120,15 @@ db_ps(dummy1, dummy2, dummy3, dummy4)
}
db_printf("%5d %8p %8p %4d %5d %5d %07x %-4s",
p->p_pid, (volatile void *)p, (void *)p->p_uarea,
- p->p_ucred ? p->p_ucred->cr_ruid : 0, pp->p_pid,
- p->p_pgrp ? p->p_pgrp->pg_id : 0, p->p_flag, state);
+ p->p_ucred != NULL ? p->p_ucred->cr_ruid : 0, pp->p_pid,
+ p->p_pgrp != NULL ? p->p_pgrp->pg_id : 0, p->p_flag,
+ state);
if (p->p_flag & P_KSES) {
db_printf("(threaded) %s\n", p->p_comm);
FOREACH_THREAD_IN_PROC(p, td) {
db_printf( ". . . . . . . "
". thread %p . . . ", td);
- if (td->td_wchan) {
+ if (td->td_wchan != NULL) {
db_printf("SLP %6s %8p\n", td->td_wmesg,
(void *)td->td_wchan);
} else if (td->td_state == TDS_MTX) {
@@ -139,10 +140,10 @@ db_ps(dummy1, dummy2, dummy3, dummy4)
}
} else {
td = FIRST_THREAD_IN_PROC(p);
- if (td->td_wchan) {
+ if (td != NULL && td->td_wchan != NULL) {
db_printf(" %-6s %8p", td->td_wmesg,
(void *)td->td_wchan);
- } else if (td->td_state == TDS_MTX) {
+ } else if (td != NULL && td->td_state == TDS_MTX) {
db_printf(" %6s %8p", td->td_mtxname,
(void *)td->td_blocked);
} else {
diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c
index 2ba81da..26635d3 100644
--- a/sys/i386/i386/db_interface.c
+++ b/sys/i386/i386/db_interface.c
@@ -58,7 +58,6 @@ int db_active;
db_regs_t ddb_regs;
static jmp_buf db_global_jmpbuf;
-static int db_global_jmpbuf_valid;
#ifdef __GNUC__
#define rss() ({u_short ss; __asm __volatile("mov %%ss,%0" : "=r" (ss)); ss;})
@@ -119,7 +118,7 @@ kdb_trap(type, code, regs)
* non-ddb functions. db_nofault only applies to memory accesses by
* internal ddb commands.
*/
- if (db_global_jmpbuf_valid)
+ if (db_active)
longjmp(db_global_jmpbuf, 1);
/*
@@ -154,16 +153,17 @@ kdb_trap(type, code, regs)
#endif /* SMP */
(void) setjmp(db_global_jmpbuf);
- db_global_jmpbuf_valid = TRUE;
- db_active++;
if (ddb_mode) {
- cndbctl(TRUE);
+ if (!db_active)
+ cndbctl(TRUE);
+ db_active = 1;
db_trap(type, code);
cndbctl(FALSE);
- } else
+ } else {
+ db_active = 1;
gdb_handle_exception(&ddb_regs, type, code);
- db_active--;
- db_global_jmpbuf_valid = FALSE;
+ }
+ db_active = 0;
#ifdef SMP
#ifdef CPUSTOP_ON_DDBBREAK
OpenPOWER on IntegriCloud