From: Willy Tarreau Date: Tue, 11 Aug 2026 11:56:44 +0000 (+0200) Subject: MINOR: debug: force complain's backtrace to be a tail jump instead of a tail call X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=431b6b1cd92a54f4a53b66a5ff27a64381ff9a23;p=thirdparty%2Fhaproxy.git MINOR: debug: force complain's backtrace to be a tail jump instead of a tail call We can make complain_with_dbg() and complain() disappear from the backtrace by forcing tail call elimination on these functions, since ha_backtrace_to_stderr() is called last and with a compatible return code. Thanks to this, backtraces are clean again: WARNING: check condition "one > zero" matched at src/debug.c:1170 (please report to developers) This was triggered on purpose from the CLI 'debug dev check' command. call trace(13): | 0x6ea2c0 <09 9a 00 e8 b0 ef ff ff]: debug_parse_cli_check+0x40/0x42 > complain_with_dbg | 0x69724a main+0x251280 | 0x710830 <00 0f 29 45 c0 ff 52 18]: task_process_applet+0x340/0xd84 | 0x7b595b <00 00 4c 89 d7 41 ff d1]: run_tasks_from_lists+0x43b/0xbdb | 0x7b651a <8d 7d b0 e8 06 f0 ff ff]: process_runnable_tasks+0x41a/0xaae > run_tasks_from_lists | 0x70344e <01 00 00 e8 b2 2c 0b 00]: run_poll_loop+0xae/0x522 > process_runnable_tasks | 0x703b4f <00 00 00 e8 51 f8 ff ff]: run_thread_poll_loop+0x27f/0x4ba > run_poll_loop | 0x44703f <46 b2 00 e8 91 c8 2b 00]: main+0x133f/0x1d75 > run_thread_poll_loop --- diff --git a/src/debug.c b/src/debug.c index 0b15465b2..20b15a761 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1094,7 +1094,7 @@ static void _complain(uint details, const char *msg, struct debug_count *dbg) } /* the exported function */ -void complain(uint details, const char *msg) +eliminate_tail_calls void complain(uint details, const char *msg) { _complain(details, msg, NULL); @@ -1106,7 +1106,7 @@ void complain(uint details, const char *msg) } /* the same, for use with a debug_count struct */ -void complain_with_dbg(struct debug_count *dbg) +eliminate_tail_calls void complain_with_dbg(struct debug_count *dbg) { if (_HA_ATOMIC_FETCH_ADD(&dbg->count, 1) && dbg->type == DBG_BUG_ONCE) return;