summaryrefslogtreecommitdiffstats
path: root/include/sys/debug.h
diff options
context:
space:
mode:
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>2008-05-19 02:49:12 +0000
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>2008-05-19 02:49:12 +0000
commitcc7449ccd612ed8567e7a8a8574ea6df1d5faa7d (patch)
treeb93c2cf48f25df1de9cd8ec6505da74aaeb6df2e /include/sys/debug.h
parent6ab69573ffc79db6fcd0539218e96ded41fcafc1 (diff)
- Properly fix the debug support for all the ASSERT's, VERIFIES, etc can be
compiled out when doing performance runs. - Bite the bullet and fully autoconfize the debug options in the configure time parameters. By default all the debug support is disable in the core SPL build, but available to modules which enable it when building against the SPL. To enable particular SPL debug support use the follow configure options: --enable-debug Internal ASSERTs --enable-debug-kmem Detailed memory accounting --enable-debug-mutex Detailed mutex tracking --enable-debug_kstat Kstat info exported to /proc --enable-debug-callb Additional callb debug git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@111 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
Diffstat (limited to 'include/sys/debug.h')
-rw-r--r--include/sys/debug.h48
1 files changed, 44 insertions, 4 deletions
diff --git a/include/sys/debug.h b/include/sys/debug.h
index 39585ba19..b972e5e88 100644
--- a/include/sys/debug.h
+++ b/include/sys/debug.h
@@ -1,6 +1,10 @@
#ifndef _SPL_DEBUG_H
#define _SPL_DEBUG_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <linux/sched.h> /* THREAD_SIZE */
#include <linux/proc_fs.h>
@@ -159,6 +163,37 @@ struct page_collection {
#define SBUG() spl_debug_bug(__FILE__, __FUNCTION__, __LINE__, 0);
+#ifdef NDEBUG
+
+#define CDEBUG_STACK() (0)
+#define CDEBUG(mask, format, a...) ((void)0)
+#define CWARN(fmt, a...) ((void)0)
+#define CERROR(fmt, a...) ((void)0)
+#define CEMERG(fmt, a...) ((void)0)
+#define CONSOLE(mask, fmt, a...) ((void)0)
+
+#define ENTRY ((void)0)
+#define EXIT ((void)0)
+#define RETURN(x) return (x)
+#define GOTO(x, y) { ((void)(y)); goto x; }
+
+#define __ASSERT(x) ((void)0)
+#define __ASSERT_TAGE_INVARIANT(x) ((void)0)
+#define ASSERT(x) ((void)0)
+#define VERIFY(x) ((void)(x))
+
+#define VERIFY3_IMPL(x, y, z, t, f, c) if (x == z) ((void)0)
+
+#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%ld", (long))
+#define VERIFY3U(x,y,z) VERIFY3_IMPL(x, y, z, uint64_t, "%lu", (unsigned long))
+#define VERIFY3P(x,y,z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *))
+
+#define ASSERT3S(x,y,z) VERIFY3S(x, y, z)
+#define ASSERT3U(x,y,z) VERIFY3U(x, y, z)
+#define ASSERT3P(x,y,z) VERIFY3P(x, y, z)
+
+#else /* NDEBUG */
+
#ifdef __ia64__
#define CDEBUG_STACK() (THREAD_SIZE - \
((unsigned long)__builtin_dwarf_cfa() & \
@@ -259,10 +294,6 @@ do { \
#define VERIFY(x) ASSERT(x)
-#define spl_debug_msg(cdls, subsys, mask, file, fn, line, format, a...) \
- spl_debug_vmsg(cdls, subsys, mask, file, fn, \
- line, NULL, NULL, format, ##a)
-
#define __CDEBUG(cdls, subsys, mask, format, a...) \
do { \
CHECK_STACK(); \
@@ -322,6 +353,11 @@ do { \
#define ENTRY __ENTRY(DEBUG_SUBSYSTEM)
#define EXIT __EXIT(DEBUG_SUBSYSTEM)
+#endif /* NDEBUG */
+
+#define spl_debug_msg(cdls, subsys, mask, file, fn, line, format, a...) \
+ spl_debug_vmsg(cdls, subsys, mask, file, fn, \
+ line, NULL, NULL, format, ##a)
extern int spl_debug_vmsg(spl_debug_limit_state_t *cdls, int subsys, int mask,
const char *file, const char *fn, const int line,
@@ -341,4 +377,8 @@ extern void spl_debug_bug(char *file, const char *func, const int line, int flag
extern int spl_debug_clear_buffer(void);
extern int spl_debug_mark_buffer(char *text);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* SPL_DEBUG_H */