MINOR: debug: make ABORT_NOW() store the caller's line number when using abort
authorWilly Tarreau <w@1wt.eu>
Fri, 2 Feb 2024 16:09:09 +0000 (17:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 Feb 2024 10:42:04 +0000 (11:42 +0100)
commit0779c69fcd3b8d1bbe6d3eabcef5112f6f658f4b
treebd55eb66603e853fb17273f02eb6efba4e83f6b3
parent8280287bb7320d2dc218bd529d9e13db25d7c253
MINOR: debug: make ABORT_NOW() store the caller's line number when using abort

Placing DO_NOT_FOLD() before abort() only works in -O2 but not in -Os which
continues to place only 5 calls to abort() in h3.o for call places. The
approach taken here is to replace abort() with a new function that wraps
it and stores the line number in the stack. This slightly increases the
code size (+0.1%) but when unwinding a crash, the line number remains
present now. This is a very low cost, especially if we consider that
DEBUG_USE_ABORT is almost only used by code coverage tools and occasional
debugging sessions.

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