diff options
author | Bruce Evans <bde@FreeBSD.org> | 2002-08-31 04:25:44 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 2002-08-31 04:25:44 +0000 |
commit | efdfb8fea378321c4fb8578e6f76704450a2707d (patch) | |
tree | 6496da2e417fd05735f3de0655a5fb6b373de639 /sys/i386/i386/db_interface.c | |
parent | 31cdffc6d867f50c9e535aa100cf9af439b53d64 (diff) | |
download | src-efdfb8fea378321c4fb8578e6f76704450a2707d.tar.gz src-efdfb8fea378321c4fb8578e6f76704450a2707d.zip |
db_ps.c:
Don't attempt to follow null pointers for zombie processes in db_ps().
Style fix: use explicit an comparison with NULL for all null pointer
checks in db_ps() instead of for half of them.
db_interface.c:
Fixed ddb's handling of traps from with ddb on i386's only.
This was mostly fixed in rev.1.27 (by longjmp()'ing back to the top
level) but was completly broken in rev.1.48 (by not unwinding the new
state (mainly db_active) either before or after the longjmp(). This
mostly never worked for other arches, since rev.1.27 has not been ported
and lower level longjmp()'s only handle traps for memory accesses. All
cases should be handled at a lower level to provided better control and
simplify unwinding of state.
Implementation details: don't pretend to maintain db_active in a nested
way -- ddb cannot be reentered in a nested way. Use db_active instead
of the db_global_jmpbuf_valid flag and longjmp()'s return value for things
related to reentering ddb. [re]entering is still not atomic enough.
Notes
Notes:
svn path=/head/; revision=102667
Diffstat (limited to 'sys/i386/i386/db_interface.c')
-rw-r--r-- | sys/i386/i386/db_interface.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c index 2ba81daeefee..26635d3eddf5 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 |