Add primitive LOCKDEBUG support.
This commit is contained in:
parent
0dde84e990
commit
fbd525a3da
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.42 2019/10/13 07:28:18 mrg Exp $
|
||||
# $NetBSD: Makefile,v 1.43 2020/03/09 01:54:31 christos Exp $
|
||||
|
||||
PROG= crash
|
||||
MAN= crash.8
|
||||
@ -30,6 +30,10 @@ REALCRASH=yes
|
||||
REALCRASH=no
|
||||
.endif
|
||||
|
||||
CPPFLAGS +=-DLOCKDEBUG
|
||||
CPPFLAGS.subr_lockdebug.c += -DCRASH -DDDB
|
||||
SRCS += subr_lockdebug.c
|
||||
|
||||
.if ${REALCRASH} != "no" # {
|
||||
|
||||
S= ${.CURDIR}/../../sys
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: crash.c,v 1.11 2017/01/10 20:57:26 christos Exp $ */
|
||||
/* $NetBSD: crash.c,v 1.12 2020/03/09 01:54:31 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: crash.c,v 1.11 2017/01/10 20:57:26 christos Exp $");
|
||||
__RCSID("$NetBSD: crash.c,v 1.12 2020/03/09 01:54:31 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <ddb/ddb.h>
|
||||
@ -73,9 +73,24 @@ static struct nlist nl[] = {
|
||||
{ .n_name = "_osrelease" },
|
||||
#define X_PANICSTR 1
|
||||
{ .n_name = "_panicstr" },
|
||||
#ifdef LOCKDEBUG
|
||||
#define X_LOCKDEBUG 2
|
||||
{ .n_name = "ld_all" },
|
||||
#endif
|
||||
{ .n_name = NULL },
|
||||
};
|
||||
|
||||
#ifdef LOCKDEBUG
|
||||
struct lockdebug;
|
||||
TAILQ_HEAD(, lockdebug) ld_all;
|
||||
#else
|
||||
void lockdebug_lock_print(void);
|
||||
void lockdebug_lock_print(void) {
|
||||
warnx("No lockdebug support compiled in");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
cleanup(void)
|
||||
{
|
||||
@ -412,6 +427,12 @@ main(int argc, char **argv)
|
||||
errx(EXIT_FAILURE, "cannot read osrelease: %s",
|
||||
kvm_geterr(kd));
|
||||
}
|
||||
#ifdef LOCKDEBUG
|
||||
if ((size_t)kvm_read(kd, nl[X_LOCKDEBUG].n_value, &ld_all,
|
||||
sizeof(ld_all)) != sizeof(ld_all))
|
||||
warn("Cannot read ld_all (no LOCKDEBUG kernel?): %s",
|
||||
kvm_geterr(kd));
|
||||
#endif
|
||||
printf("Crash version %s, image version %s.\n", osrelease, imgrelease);
|
||||
if (strcmp(osrelease, imgrelease) != 0) {
|
||||
printf("WARNING: versions differ, you may not be able to "
|
||||
|
Loading…
Reference in New Issue
Block a user