From ca70a1c0151feb987c0d0e693eb8837005a4dda7 Mon Sep 17 00:00:00 2001 From: rafal Date: Fri, 7 Nov 2008 02:40:35 +0000 Subject: [PATCH] Pass / log return address in a few more places; proposed on tech-kern and ok'd by ad@ about 6 months ago. --- sys/kern/subr_lockdebug.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/sys/kern/subr_lockdebug.c b/sys/kern/subr_lockdebug.c index 78744ac51021..0bcc9ed15705 100644 --- a/sys/kern/subr_lockdebug.c +++ b/sys/kern/subr_lockdebug.c @@ -1,4 +1,4 @@ -/* $NetBSD: subr_lockdebug.c,v 1.37 2008/06/30 20:14:09 matt Exp $ */ +/* $NetBSD: subr_lockdebug.c,v 1.38 2008/11/07 02:40:35 rafal Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.37 2008/06/30 20:14:09 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.38 2008/11/07 02:40:35 rafal Exp $"); #include "opt_ddb.h" @@ -184,13 +184,13 @@ lockdebug_unlock_cpus(void) * Find a lockdebug structure by a pointer to a lock and return it locked. */ static inline lockdebug_t * -lockdebug_lookup(volatile void *lock) +lockdebug_lookup(volatile void *lock, uintptr_t where) { lockdebug_t *ld; ld = lockdebug_lookup1(lock); if (ld == NULL) - panic("lockdebug_lookup: uninitialized lock (lock=%p)", lock); + panic("lockdebug_lookup: uninitialized lock (lock=%p, from=%08lx)", lock, where); return ld; } @@ -316,7 +316,7 @@ lockdebug_free(volatile void *lock) s = splhigh(); __cpu_simple_lock(&ld_mod_lk); - ld = lockdebug_lookup(lock); + ld = lockdebug_lookup(lock, (uintptr_t) __builtin_return_address(0)); if (ld == NULL) { __cpu_simple_unlock(&ld_mod_lk); panic("lockdebug_free: destroying uninitialized object %p" @@ -423,7 +423,7 @@ lockdebug_wantlock(volatile void *lock, uintptr_t where, bool shared, return; s = splhigh(); - if ((ld = lockdebug_lookup(lock)) == NULL) { + if ((ld = lockdebug_lookup(lock, where)) == NULL) { splx(s); return; } @@ -472,7 +472,7 @@ lockdebug_locked(volatile void *lock, void *cvlock, uintptr_t where, return; s = splhigh(); - if ((ld = lockdebug_lookup(lock)) == NULL) { + if ((ld = lockdebug_lookup(lock, where)) == NULL) { splx(s); return; } @@ -529,7 +529,7 @@ lockdebug_unlocked(volatile void *lock, uintptr_t where, int shared) return; s = splhigh(); - if ((ld = lockdebug_lookup(lock)) == NULL) { + if ((ld = lockdebug_lookup(lock, where)) == NULL) { splx(s); return; } @@ -605,7 +605,7 @@ lockdebug_wakeup(volatile void *lock, uintptr_t where) s = splhigh(); /* Find the CV... */ - if ((ld = lockdebug_lookup(lock)) == NULL) { + if ((ld = lockdebug_lookup(lock, where)) == NULL) { splx(s); return; } @@ -818,7 +818,8 @@ lockdebug_abort(volatile void *lock, lockops_t *ops, const char *func, int s; s = splhigh(); - if ((ld = lockdebug_lookup(lock)) != NULL) { + if ((ld = lockdebug_lookup(lock, + (uintptr_t) __builtin_return_address(0))) != NULL) { lockdebug_abort1(ld, s, func, msg, true); return; }