From 48be45cd2dce9ef153e5bab2492dba00fa3ab0f1 Mon Sep 17 00:00:00 2001 From: Paul Zuchowski <31706010+PaulZ-98@users.noreply.github.com> Date: Wed, 27 Nov 2019 13:45:56 -0500 Subject: [PATCH] Implement -A (ignore ASSERTs) for zdb The command line switch -A (ignore ASSERTs) has always been available in zdb but was never connected up to the correct global variable. There are times when you need zdb to ignore asserts and keep dumping out whatever information it can get despite the ASSERT(s) failing. It was always intended to be part of zdb but was incomplete. Reviewed-by: Brian Behlendorf Signed-off-by: Paul Zuchowski Closes #9610 --- lib/libspl/include/assert.h | 10 ++++++++++ lib/libzpool/kernel.c | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h index f615fbdfe..b7b406850 100644 --- a/lib/libspl/include/assert.h +++ b/lib/libspl/include/assert.h @@ -33,11 +33,18 @@ #include #include +#ifndef _KERNEL +int aok; +#endif + static inline int libspl_assert(const char *buf, const char *file, const char *func, int line) { fprintf(stderr, "%s\n", buf); fprintf(stderr, "ASSERT at %s:%d:%s()", file, line, func); + if (aok) { + return (0); + } abort(); } @@ -52,6 +59,9 @@ libspl_assertf(const char *file, const char *func, int line, char *format, ...) fprintf(stderr, "\n"); fprintf(stderr, "ASSERT at %s:%d:%s()", file, line, func); va_end(args); + if (aok) { + return; + } abort(); } diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c index da172449c..5d80f9e78 100644 --- a/lib/libzpool/kernel.c +++ b/lib/libzpool/kernel.c @@ -47,7 +47,6 @@ * Emulation of kernel services in userland. */ -int aok; uint64_t physmem; vnode_t *rootdir = (vnode_t *)0xabcd1234; char hw_serial[HW_HOSTID_LEN];