]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEBUG: rename DEBUG_GLITCHES to DEBUG_COUNTERS and enable it by default
authorWilly Tarreau <w@1wt.eu>
Mon, 14 Apr 2025 15:32:10 +0000 (17:32 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 14 Apr 2025 17:02:13 +0000 (19:02 +0200)
Till now the per-line glitches counters were only enabled with the
confusingly named DEBUG_GLITCHES (which would not turn glitches off
when disabled). Let's instead change it to DEBUG_COUNTERS and make sure
it's enabled by default (though it can still be disabled with
-DDEBUG_GLITCHES=0 just like for DEBUG_STRICT). It will later be
expanded to cover more counters.

Makefile
doc/management.txt
include/haproxy/bug.h
include/haproxy/defaults.h
src/debug.c

index 4b87a6a094568c2495defaf73dcf24d5130dd26b..fee5a8952c1006d1d69aef5c19d76919c4d32889 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -263,7 +263,7 @@ endif
 # 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_GLITCHES, DEBUG_STRESS, DEBUG_UNIT.
+# DEBUG_COUNTERS, DEBUG_STRESS, DEBUG_UNIT.
 DEBUG =
 
 #### Trace options
index 56d6a882cd74d713f715ded8a5f60459f053c8fe..191c0c49937a22af06bdc1c806b2cbab98bcfedc 100644 (file)
@@ -2001,7 +2001,7 @@ commit ssl crl-file <crlfile>
 
 debug counters [reset|show|all|bug|chk|cnt|glt|?]*
   List internal counters placed in the code, which may vary depending on some
-  build options. Some of them depend on DEBUG_STRICT, others on DEBUG_GLITCHES.
+  build options. Some of them depend on DEBUG_STRICT, others on DEBUG_COUNTERS.
   The command takes a combination of multiple arguments, some defining actions
   and others defining filters:
     - bug     enables listing the counters for BUG_ON() statements
index 47ac02565b0dbba39fd9333e46472be9b77bdf58..a2c5438264688d590098f23ead93d56a699586e8 100644 (file)
@@ -231,17 +231,17 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt  HA_SECTION_S
                1; /* let's return the true condition */                        \
        }) : 0)
 
-/* DEBUG_GLITCHES enables counting the number of glitches per line of code. The
+/* DEBUG_COUNTERS 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)
+# if !defined(DEBUG_COUNTERS) || (DEBUG_COUNTERS == 0)
 #  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
+# endif
 
 #else /* USE_OBSOLETE_LINKER not defined below  */
 # define __DBG_COUNT(cond, file, line, type, ...) do { } while (0)
index eec78132be96a9726c4cab3c1e8fe3d084d6f649..c08b48e1d03329e9e84bb31b8677126f931c3a5a 100644 (file)
 # define DEBUG_STRICT 1
 #endif
 
+/* Let's make DEBUG_COUNTERS default to 1 to have glitches counters by default */
+#ifndef DEBUG_COUNTERS
+# define DEBUG_COUNTERS 1
+#endif
+
 #if !defined(DEBUG_MEMORY_POOLS)
 # define DEBUG_MEMORY_POOLS 1
 #endif
index c991f96cb154d1d232dd26fb8e8b08da9a8d0e1b..d3229e6b96d35861a46d722ba9be2a0fef2dd26b 100644 (file)
@@ -2282,7 +2282,7 @@ static int debug_parse_cli_counters(char **args, char *payload, struct appctx *a
                        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 DEBUG_STRICT > 0 || defined(DEBUG_GLITCHES)
+#if (DEBUG_STRICT > 0) || (DEBUG_COUNTERS > 0)
        ctx->start = &__start_dbg_cnt;
        ctx->stop  = &__stop_dbg_cnt;
 #endif