Adding backtrace support to FreeBSD from 10.x release. (#10256)

This commit is contained in:
David CARLIER 2018-06-04 15:05:13 +01:00 committed by radare
parent b119dad829
commit a20078d171
4 changed files with 19 additions and 4 deletions

View File

@ -97,7 +97,7 @@
#define __BSD__ 0
#define __UNIX__ 1
#endif
#if __KFBSD__ || defined(__NetBSD__) || defined(__OpenBSD__)
#if __KFBSD__ || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
#define __BSD__ 1
#define __UNIX__ 1
#endif

View File

@ -50,6 +50,13 @@ ifneq ($(shell expr "`uname -r`" : '[0-6]\.'), 2)
endif
endif
# FreeBSD 10.0 ships with backtrace(3) in -lexecinfo
ifeq (${BUILD_OS},freebsd)
ifneq ($(shell expr "`uname -r`" : '[0-9]\.'), 2)
LDFLAGS+=-lexecinfo
endif
endif
EXTRA_PRE+=sdb_version
EXTRA_PRE+=spp_config

View File

@ -9,6 +9,12 @@
# define NETBSD_WITH_BACKTRACE
# endif
#endif
#if defined(__FreeBSD__)
# include <sys/param.h>
# if __FreeBSD_version >= 1000000
# define FREEBSD_WITH_BACKTRACE
# endif
#endif
#include <sys/types.h>
#include <r_types.h>
#include <r_util.h>
@ -16,7 +22,8 @@
static char** env = NULL;
#if (__linux__ && __GNU_LIBRARY__) || defined(NETBSD_WITH_BACKTRACE)
#if (__linux__ && __GNU_LIBRARY__) || defined(NETBSD_WITH_BACKTRACE) || \
defined(FREEBSD_WITH_BACKTRACE)
# include <execinfo.h>
#endif
#if __APPLE__
@ -199,7 +206,8 @@ R_API char *r_sys_cmd_strf(const char *fmt, ...) {
#define APPLE_WITH_BACKTRACE 1
#endif
#if (__linux__ && __GNU_LIBRARY__) || (__APPLE__ && APPLE_WITH_BACKTRACE) || defined(NETBSD_WITH_BACKTRACE)
#if (__linux__ && __GNU_LIBRARY__) || (__APPLE__ && APPLE_WITH_BACKTRACE) || \
defined(NETBSD_WITH_BACKTRACE) || defined(FREEBSD_WITH_BACKTRACE)
#define HAVE_BACKTRACE 1
#endif

View File

@ -30,7 +30,7 @@
#define __BSD__ 0
#define __UNIX__ 1
#endif
#if __KFBSD__ || defined(__NetBSD__) || defined(__OpenBSD__)
#if __KFBSD__ || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
#define __BSD__ 1
#define __UNIX__ 1
#endif