Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Use KASSERTMSG so if these trigger, we can see what...



details:   https://anonhg.NetBSD.org/src/rev/2b593a33413a
branches:  trunk
changeset: 765935:2b593a33413a
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Jun 11 01:07:33 2011 +0000

description:
Use KASSERTMSG so if these trigger, we can see what exactly caused them to fire.

diffstat:

 sys/kern/kern_mutex_obj.c |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 09b88c3d9cd2 -r 2b593a33413a sys/kern/kern_mutex_obj.c
--- a/sys/kern/kern_mutex_obj.c Sat Jun 11 00:59:44 2011 +0000
+++ b/sys/kern/kern_mutex_obj.c Sat Jun 11 01:07:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_mutex_obj.c,v 1.3 2011/05/13 22:16:43 rmind Exp $ */
+/*     $NetBSD: kern_mutex_obj.c,v 1.4 2011/06/11 01:07:33 matt Exp $  */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex_obj.c,v 1.3 2011/05/13 22:16:43 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex_obj.c,v 1.4 2011/06/11 01:07:33 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -106,8 +106,12 @@
 {
        struct kmutexobj *mo = (struct kmutexobj *)lock;
 
-       KASSERT(mo->mo_magic == MUTEX_OBJ_MAGIC);
-       KASSERT(mo->mo_refcnt > 0);
+       KASSERTMSG(mo->mo_magic == MUTEX_OBJ_MAGIC,
+           ("%s: lock %p: mo->mo_magic (%#x) != MUTEX_OBJ_MAGIC (%#x)",
+            __func__, mo, mo->mo_magic, MUTEX_OBJ_MAGIC));
+       KASSERTMSG(mo->mo_refcnt > 0,
+           ("%s: lock %p: mo->mo_refcnt (%#x) == 0",
+            __func__, mo, mo->mo_refcnt));
 
        atomic_inc_uint(&mo->mo_refcnt);
 }
@@ -123,8 +127,12 @@
 {
        struct kmutexobj *mo = (struct kmutexobj *)lock;
 
-       KASSERT(mo->mo_magic == MUTEX_OBJ_MAGIC);
-       KASSERT(mo->mo_refcnt > 0);
+       KASSERTMSG(mo->mo_magic == MUTEX_OBJ_MAGIC,
+           ("%s: lock %p: mo->mo_magic (%#x) != MUTEX_OBJ_MAGIC (%#x)",
+            __func__, mo, mo->mo_magic, MUTEX_OBJ_MAGIC));
+       KASSERTMSG(mo->mo_refcnt > 0,
+           ("%s: lock %p: mo->mo_refcnt (%#x) == 0",
+            __func__, mo, mo->mo_refcnt));
 
        if (atomic_dec_uint_nv(&mo->mo_refcnt) > 0) {
                return false;



Home | Main Index | Thread Index | Old Index