]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Unconditionally enable debugging for libzpool
authorSerapheim Dimitropoulos <serapheim@delphix.com>
Fri, 10 Jul 2020 22:30:31 +0000 (15:30 -0700)
committerGitHub <noreply@github.com>
Fri, 10 Jul 2020 22:30:31 +0000 (15:30 -0700)
We already enable -DDEBUG unconditionally (meaning regardless
of this is a debug build or a performance build) for zdb and
ztest as they are mostly used for development and debugging.

This patch enables -DDEBUG for libzpool extending the debugging
checks for zdb, ztest, and a couple of other test utilities.

In addition to passing -DDEBUG we also enable -DZFS_DEBUG so
all assertion checks work s expected. We do so not only in
libzpool but in every utility that links to it, even if the
utility doesn't directly use any functionality wrapped in
ZFS_DEBUG macro definitions. The reason is that these utilities
may still include headers that contain structs that have more
fields when ZFS_DEBUG is defined. This can be a problem as
enabling that flag for libzpool but not for zdb can lead into
random problems (e.g. segmentation faults) as zdb may be have
an incorrect view of a struct passed to it by libzpool.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Closes #10549

cmd/raidz_test/Makefile.am
cmd/zdb/Makefile.am
cmd/zhack/Makefile.am
cmd/ztest/Makefile.am
lib/libzpool/Makefile.am
tests/zfs-tests/cmd/btree_test/Makefile.am

index ccfa7019cb08c9c616ea248286b6f6373070b6d9..72c914e641e475eec5c91d03b527bccfa80efdd3 100644 (file)
@@ -4,7 +4,7 @@ include $(top_srcdir)/config/Rules.am
 AM_CFLAGS += $(FRAME_LARGER_THAN)
 
 # Unconditionally enable ASSERTs
-AM_CPPFLAGS += -DDEBUG -UNDEBUG
+AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG
 
 bin_PROGRAMS = raidz_test
 
index 7a29e54f69dc29a768bd2d8eb705873851784250..b325cb060bd2d6411044efea0e4ece3d71925c31 100644 (file)
@@ -1,7 +1,7 @@
 include $(top_srcdir)/config/Rules.am
 
 # Unconditionally enable debugging for zdb
-AM_CPPFLAGS += -DDEBUG -UNDEBUG
+AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG
 
 sbin_PROGRAMS = zdb
 
index 6c5b5d096c8910350151d80d5d41ec05dd0250cc..5cddac32b5acb2dfe4e459739602c66351e13b26 100644 (file)
@@ -1,5 +1,8 @@
 include $(top_srcdir)/config/Rules.am
 
+# Unconditionally enable debugging for zhack
+AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG
+
 sbin_PROGRAMS = zhack
 
 zhack_SOURCES = \
index 40d029d9f36342ccbce15ce7fc9a37d0cec7c54f..6042b44d1ddeba15f674ada264b21bc1d0e9d94a 100644 (file)
@@ -7,7 +7,7 @@ AM_CFLAGS += $(NO_FORMAT_TRUNCATION)
 AM_CFLAGS += $(FRAME_LARGER_THAN)
 
 # Unconditionally enable ASSERTs
-AM_CPPFLAGS += -DDEBUG -UNDEBUG
+AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG
 
 sbin_PROGRAMS = ztest
 
index 6256d5e739b9bb4b4f297eb70d074c90f8c0ce33..7924a425d21df3f1a8f222833df8f01645c60ab3 100644 (file)
@@ -7,6 +7,9 @@ VPATH = \
        $(top_srcdir)/module/os/linux/zfs \
        $(top_srcdir)/lib/libzpool
 
+# Unconditionally enable debugging for libzpool
+AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG
+
 # Suppress unused but set variable warnings often due to ASSERTs
 AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE)
 
index 0bb8f9917345b3d0fde5af27b2126c7d320515e2..4c9a1a4cc29683351ff7333bd03cd1109edcf974 100644 (file)
@@ -22,7 +22,7 @@ DEFAULT_INCLUDES += \
        -I$(top_srcdir)/lib/libspl/include
 
 # Unconditionally enable ASSERTs
-AM_CPPFLAGS += -DDEBUG -UNDEBUG
+AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG
 
 pkgexec_PROGRAMS = btree_test
 btree_test_SOURCES = btree_test.c