# DEBUG_MEM_STATS, DEBUG_DONT_SHARE_POOLS, DEBUG_FD, DEBUG_POOL_INTEGRITY,
# DEBUG_NO_POOLS, DEBUG_FAIL_ALLOC, DEBUG_STRICT_ACTION=[0-3], DEBUG_HPACK,
# DEBUG_AUTH, DEBUG_SPOE, DEBUG_UAF, DEBUG_THREAD, DEBUG_STRICT, DEBUG_DEV,
-# DEBUG_TASK, DEBUG_MEMORY_POOLS, DEBUG_POOL_TRACING, DEBUG_QPACK, DEBUG_LIST.
+# DEBUG_TASK, DEBUG_MEMORY_POOLS, DEBUG_POOL_TRACING, DEBUG_QPACK, DEBUG_LIST,
+# DEBUG_GLITCHES.
DEBUG =
#### Trace options
DBG_BUG,
DBG_BUG_ONCE,
DBG_COUNT_IF,
+ DBG_GLITCH,
DBG_COUNTER_TYPES // must be last
};
1; /* let's return the true condition */ \
}) : 0); } while (0)
+/* DEBUG_GLITCHES enables counting the number of glitches per line of code. The
+ * condition is empty (nothing to write there), except maybe __VA_ARGS at the
+ * end.
+ */
+# if !defined(DEBUG_GLITCHES)
+# define _COUNT_GLITCH(file, line, ...) do { } while (0)
+# else
+# define _COUNT_GLITCH(file, line, ...) do { \
+ __DBG_COUNT(, file, line, DBG_GLITCH, __VA_ARGS__); \
+ } while (0)
+# endif
#else /* USE_OBSOLETE_LINKER not defined below */
# define __DBG_COUNT(cond, file, line, type, ...) do { } while (0)
# define _COUNT_IF(cond, file, line, ...) do { } while (0)
+# define _COUNT_GLITCH(file, line, ...) do { } while (0)
#endif
+/* reports a glitch for current file and line, optionally with an explanation */
+#define COUNT_GLITCH(...) _COUNT_GLITCH(__FILE__, __LINE__, __VA_ARGS__)
+
/* This is the generic low-level macro dealing with conditional warnings and
* bugs. The caller decides whether to crash or not and what prefix and suffix
* to pass. The macro returns the boolean value of the condition as an int for
ctx->types |= 1 << DBG_COUNT_IF;
continue;
}
+ else if (strcmp(args[arg], "glt") == 0) {
+ ctx->types |= 1 << DBG_GLITCH;
+ continue;
+ }
else
- return cli_err(appctx, "Expects an optional action ('reset','show'), optional types ('bug','chk','cnt') and optionally 'all' to even dump null counters.\n");
+ return cli_err(appctx, "Expects an optional action ('reset','show'), optional types ('bug','chk','cnt','glt') and optionally 'all' to even dump null counters.\n");
}
if (action == 1) { // reset
[DBG_BUG] = "BUG",
[DBG_BUG_ONCE] = "CHK",
[DBG_COUNT_IF] = "CNT",
+ [DBG_GLITCH] = "GLT",
};
struct dev_cnt_ctx *ctx = appctx->svcctx;
struct debug_count *ptr;