Enable unwind.h and dladdr as default backtrace implementation
* config option USE_UNWIND to enable/disable
This commit is contained in:
parent
0422cf9892
commit
a62fe8a3e9
@ -185,9 +185,7 @@ if(NOT IOS)
|
||||
check_include_files(syslog.h HAVE_SYSLOG_H)
|
||||
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
|
||||
check_include_files(sys/eventfd.h HAVE_SYS_EVENTFD_H)
|
||||
if (ANDROID)
|
||||
check_include_files(unwind.h HAVE_UNWIND_H)
|
||||
endif()
|
||||
check_include_files(unwind.h HAVE_UNWIND_H)
|
||||
if (HAVE_SYS_EVENTFD_H)
|
||||
check_symbol_exists(eventfd_read sys/eventfd.h WITH_EVENTFD_READ_WRITE)
|
||||
endif()
|
||||
|
@ -129,9 +129,13 @@ if (HAVE_EXECINFO_H)
|
||||
endif()
|
||||
|
||||
if (HAVE_UNWIND_H)
|
||||
list(APPEND SRCS
|
||||
unwind/debug.c
|
||||
unwind/debug.h)
|
||||
option(USE_UNWIND "Use unwind.h to generate backtraces" ON)
|
||||
if (USE_UNWIND)
|
||||
add_definitions(-DUSE_UNWIND)
|
||||
list(APPEND SRCS
|
||||
unwind/debug.c
|
||||
unwind/debug.h)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
winpr_module_add(${SRCS}
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <execinfo/debug.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_UNWIND_H)
|
||||
#if defined(USE_UNWIND_H)
|
||||
#include <unwind/debug.h>
|
||||
#endif
|
||||
|
||||
@ -89,7 +89,7 @@ void winpr_backtrace_free(void* buffer)
|
||||
if (!buffer)
|
||||
return;
|
||||
|
||||
#if defined(HAVE_UNWIND_H)
|
||||
#if defined(USE_UNWIND_H)
|
||||
winpr_unwind_backtrace_free(buffer);
|
||||
#elif defined(HAVE_EXECINFO_H)
|
||||
winpr_execinfo_backtrace_free(buffer);
|
||||
@ -104,7 +104,7 @@ void winpr_backtrace_free(void* buffer)
|
||||
|
||||
void* winpr_backtrace(DWORD size)
|
||||
{
|
||||
#if defined(HAVE_UNWIND_H)
|
||||
#if defined(USE_UNWIND_H)
|
||||
return winpr_unwind_backtrace(size);
|
||||
#elif defined(HAVE_EXECINFO_H)
|
||||
return winpr_execinfo_backtrace(size);
|
||||
@ -129,7 +129,7 @@ char** winpr_backtrace_symbols(void* buffer, size_t* used)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(HAVE_UNWIND_H)
|
||||
#if defined(USE_UNWIND_H)
|
||||
return winpr_unwind_backtrace_symbols(buffer, used);
|
||||
#elif defined(HAVE_EXECINFO_H)
|
||||
return winpr_execinfo_backtrace_symbols(buffer, used);
|
||||
@ -151,7 +151,7 @@ void winpr_backtrace_symbols_fd(void* buffer, int fd)
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(HAVE_EXECINFO_H) && !defined(HAVE_UNWIND_H)
|
||||
#if defined(HAVE_EXECINFO_H) && !defined(USE_UNWIND_H)
|
||||
winpr_execinfo_backtrace_symbols_fd(buffer, fd);
|
||||
#elif !defined(ANDROID)
|
||||
{
|
||||
|
@ -18,11 +18,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Required to test on linux
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
Loading…
Reference in New Issue
Block a user