Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/crash Add primitive LOCKDEBUG support.



details:   https://anonhg.NetBSD.org/src/rev/8d4e5a3a38e3
branches:  trunk
changeset: 745697:8d4e5a3a38e3
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Mar 09 01:54:31 2020 +0000

description:
Add primitive LOCKDEBUG support.

diffstat:

 usr.sbin/crash/Makefile |   6 +++++-
 usr.sbin/crash/crash.c  |  25 +++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 3 deletions(-)

diffs (76 lines):

diff -r d3000b50f024 -r 8d4e5a3a38e3 usr.sbin/crash/Makefile
--- a/usr.sbin/crash/Makefile   Mon Mar 09 01:53:11 2020 +0000
+++ b/usr.sbin/crash/Makefile   Mon Mar 09 01:54:31 2020 +0000
@@ -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=no
 .endif
 
+CPPFLAGS +=-DLOCKDEBUG
+CPPFLAGS.subr_lockdebug.c += -DCRASH -DDDB
+SRCS += subr_lockdebug.c
+
 .if ${REALCRASH} != "no"       # {
 
 S=             ${.CURDIR}/../../sys
diff -r d3000b50f024 -r 8d4e5a3a38e3 usr.sbin/crash/crash.c
--- a/usr.sbin/crash/crash.c    Mon Mar 09 01:53:11 2020 +0000
+++ b/usr.sbin/crash/crash.c    Mon Mar 09 01:54:31 2020 +0000
@@ -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 @@
        { .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 @@
                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 "



Home | Main Index | Thread Index | Old Index