Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ddb If we are DIAGNOSTIC don't try to go further if we f...
details: https://anonhg.NetBSD.org/src/rev/597940aba1bd
branches: trunk
changeset: 771759:597940aba1bd
user: christos <christos%NetBSD.org@localhost>
date: Sat Dec 03 16:25:49 2011 +0000
description:
If we are DIAGNOSTIC don't try to go further if we failed to take the
lock, because we are going to trigger a KASSERT. Also hold the lock
longer and take the proc lock for kpsignal(). Maybe we should add
mutex_steal() and mutex_return() for the debugger? Lock correction
suggestion from jmcneill.
diffstat:
sys/ddb/db_xxx.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
diffs (52 lines):
diff -r 226807a7ef20 -r 597940aba1bd sys/ddb/db_xxx.c
--- a/sys/ddb/db_xxx.c Sat Dec 03 10:53:09 2011 +0000
+++ b/sys/ddb/db_xxx.c Sat Dec 03 16:25:49 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_xxx.c,v 1.65 2011/12/02 23:57:58 christos Exp $ */
+/* $NetBSD: db_xxx.c,v 1.66 2011/12/03 16:25:49 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.65 2011/12/02 23:57:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.66 2011/12/03 16:25:49 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_kgdb.h"
@@ -108,19 +108,29 @@
}
/* We might stop when the mutex is held or when not */
t = mutex_tryenter(proc_lock);
+#ifdef DIAGNOSTIC
+ if (!t) {
+ db_error("could not acquire proc_lock mutex\n");
+ /*NOTREACHED*/
+ }
+#endif
p = proc_find((pid_t)pid);
- if (t)
- mutex_exit(proc_lock);
if (p == NULL) {
- db_error("no such proc\n");
- /*NOTREACHED*/
+ if (t)
+ mutex_exit(proc_lock);
+ db_error("no such proc\n");
+ /*NOTREACHED*/
}
KSI_INIT(&ksi);
ksi.ksi_signo = sig;
ksi.ksi_code = SI_USER;
ksi.ksi_pid = 0;
ksi.ksi_uid = 0;
+ mutex_enter(p->p_lock);
kpsignal2(p, &ksi);
+ mutex_exit(p->p_lock);
+ if (t)
+ mutex_exit(proc_lock);
#else
db_printf("This command is not currently supported.\n");
#endif
Home |
Main Index |
Thread Index |
Old Index