diff --git a/Makefile b/Makefile index 48c595511..c0645093c 100644 --- a/Makefile +++ b/Makefile @@ -106,6 +106,7 @@ # SUBVERS : add a sub-version (eg: platform, model, ...). # VERDATE : force haproxy's release date. # VTEST_PROGRAM : location of the vtest program to run reg-tests. +# DEBUG_USE_ABORT: use abort() for program termination, see include/haproxy/bug.h for details # verbosity: pass V=1 for verbose shell invocation V = 0 diff --git a/include/haproxy/bug.h b/include/haproxy/bug.h index a008126f5..ad2018b13 100644 --- a/include/haproxy/bug.h +++ b/include/haproxy/bug.h @@ -37,10 +37,15 @@ #define DPRINTF(x...) #endif -/* This abort is more efficient than abort() because it does not mangle the - * stack and stops at the exact location we need. - */ +#ifdef DEBUG_USE_ABORT +/* abort() is better recognized by code analysis tools */ +#define ABORT_NOW() abort() +#else +/* More efficient than abort() because it does not mangle the + * stack and stops at the exact location we need. + */ #define ABORT_NOW() (*(volatile int*)1=0) +#endif /* BUG_ON: complains if is true when DEBUG_STRICT or DEBUG_STRICT_NOCRASH * are set, does nothing otherwise. With DEBUG_STRICT in addition it immediately