mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
DEBUG: cleanup back trace generation
Most BUG()/ABORT() macros were duplicating the same code to call the backtrace production to stderr, better place that into a new DUMP_TRACE() macro.
This commit is contained in:
parent
edd426871f
commit
1ea8bc4c48
@ -38,14 +38,16 @@
|
|||||||
#define DPRINTF(x...)
|
#define DPRINTF(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DUMP_TRACE() do { extern void ha_backtrace_to_stderr(void); ha_backtrace_to_stderr(); } while (0)
|
||||||
|
|
||||||
#ifdef DEBUG_USE_ABORT
|
#ifdef DEBUG_USE_ABORT
|
||||||
/* abort() is better recognized by code analysis tools */
|
/* abort() is better recognized by code analysis tools */
|
||||||
#define ABORT_NOW() do { extern void ha_backtrace_to_stderr(void); ha_backtrace_to_stderr(); abort(); } while (0)
|
#define ABORT_NOW() do { DUMP_TRACE(); abort(); } while (0)
|
||||||
#else
|
#else
|
||||||
/* More efficient than abort() because it does not mangle the
|
/* More efficient than abort() because it does not mangle the
|
||||||
* stack and stops at the exact location we need.
|
* stack and stops at the exact location we need.
|
||||||
*/
|
*/
|
||||||
#define ABORT_NOW() do { extern void ha_backtrace_to_stderr(void); ha_backtrace_to_stderr(); (*(volatile int*)1=0); } while (0)
|
#define ABORT_NOW() do { DUMP_TRACE(); (*(volatile int*)1=0); } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* BUG_ON: complains if <cond> is true when DEBUG_STRICT or DEBUG_STRICT_NOCRASH
|
/* BUG_ON: complains if <cond> is true when DEBUG_STRICT or DEBUG_STRICT_NOCRASH
|
||||||
@ -56,7 +58,7 @@
|
|||||||
#if defined(DEBUG_STRICT)
|
#if defined(DEBUG_STRICT)
|
||||||
#define CRASH_NOW() ABORT_NOW()
|
#define CRASH_NOW() ABORT_NOW()
|
||||||
#else
|
#else
|
||||||
#define CRASH_NOW() do { extern void ha_backtrace_to_stderr(void); ha_backtrace_to_stderr(); } while (0)
|
#define CRASH_NOW() do { DUMP_TRACE(); } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BUG_ON(cond) _BUG_ON(cond, __FILE__, __LINE__)
|
#define BUG_ON(cond) _BUG_ON(cond, __FILE__, __LINE__)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user