fixed explicit BACKTRACE order
and automatic linux backtrace detection : __GLIBC__ must be tested after #include <features.h>
This commit is contained in:
parent
1e0c5466c5
commit
e0ab6b61b7
@ -134,8 +134,10 @@ else
|
||||
LZ4_MSG := $(NO_LZ4_MSG)
|
||||
endif
|
||||
|
||||
# enable backtrace symbol names for Linux & Darwin
|
||||
BACKTRACE ?= 0
|
||||
# explicit backtrace enable/disable for Linux & Darwin
|
||||
ifeq ($(BACKTRACE), 0)
|
||||
DEBUGFLAGS += -DBACKTRACE_ENABLE=0
|
||||
endif
|
||||
ifeq (,$(filter Windows%, $(OS)))
|
||||
ifeq ($(BACKTRACE), 1)
|
||||
DEBUGFLAGS += -DBACKTRACE_ENABLE=1
|
||||
|
@ -20,12 +20,6 @@
|
||||
# define _POSIX_SOURCE 1 /* disable %llu warnings with MinGW on Windows */
|
||||
#endif
|
||||
|
||||
#if !defined(BACKTRACE_ENABLE) \
|
||||
&& ((defined(__linux__) && defined(__GLIBC__)) \
|
||||
|| (defined(__APPLE__) && defined(__MACH__)) )
|
||||
# define BACKTRACE_ENABLE 1
|
||||
#endif
|
||||
|
||||
|
||||
/*-*************************************
|
||||
* Includes
|
||||
@ -38,9 +32,6 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h> /* errno */
|
||||
#include <signal.h>
|
||||
#if defined(BACKTRACE_ENABLE) && (BACKTRACE_ENABLE >= 1)
|
||||
# include <execinfo.h> /* backtrace, backtrace_symbols */
|
||||
#endif
|
||||
|
||||
#if defined (_MSC_VER)
|
||||
# include <sys/stat.h>
|
||||
@ -168,8 +159,17 @@ static void clearHandler(void)
|
||||
/*-*********************************************************
|
||||
* Termination signal trapping (Print debug stack trace)
|
||||
***********************************************************/
|
||||
#if !defined(BACKTRACE_ENABLE) \
|
||||
&& ((defined(__linux__) && defined(__GLIBC__)) \
|
||||
|| (defined(__APPLE__) && defined(__MACH__)) )
|
||||
# define BACKTRACE_ENABLE 1
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BACKTRACE_ENABLE) && (BACKTRACE_ENABLE>=1)
|
||||
|
||||
#include <execinfo.h> /* backtrace, backtrace_symbols */
|
||||
|
||||
#define MAX_STACK_FRAMES 50
|
||||
|
||||
static void ABRThandler(int sig) {
|
||||
|
Loading…
Reference in New Issue
Block a user