MINOR: debug: make sure calls to ha_crash_now() are never merged
authorWilly Tarreau <w@1wt.eu>
Fri, 2 Feb 2024 16:05:36 +0000 (17:05 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 Feb 2024 10:42:04 +0000 (11:42 +0100)
commit8280287bb7320d2dc218bd529d9e13db25d7c253
treeac0c4e8defcb9100e000f9830d7426cec52fe561
parent7d2ee73d02f6383d1d68fe338e3089ad08913776
MINOR: debug: make sure calls to ha_crash_now() are never merged

As indicated in previous commit, we don't want calls to ha_crash_now()
to be merged, since it will make gdb return a wrong line number. This
was found to happen with gcc 4.7 and 4.8 in h3.c where 26 calls end up
as only 5 to 18 "ud2" instructions depending on optimizations. By
calling DO_NOT_FOLD() just before provoking the trap, we can reliably
avoid this folding problem. Note that this does not address the case
where abort() is used instead (DEBUG_USE_ABORT).

(cherry picked from commit 2bb192ba911a00d554db592bd5d80ab56e9c7398)
Signed-off-by: Willy Tarreau <w@1wt.eu>
include/haproxy/bug.h