libcom: detect uclibc support for backtrace()

This commit is contained in:
Michael Davidsaver
2019-07-06 13:43:58 -07:00
parent c8e5deca76
commit c70b1a9a29
@@ -7,12 +7,30 @@
* Author: Till Straumann <strauman@slac.stanford.edu>, 2011, 2014
*/
// pull in libc feature test macros
#include <stdlib.h>
// execinfo.h may not be present if uclibc is configured to omit backtrace()
#if !defined(__UCLIBC_MAJOR__) || defined(__UCLIBC_HAS_EXECINFO__)
# define HAS_EXECINFO 1
#else
# define HAS_EXECINFO 0
#endif
#if HAS_EXECINFO
#include <execinfo.h>
#endif
#define epicsExportSharedSymbols
#include "epicsStackTracePvt.h"
int epicsBackTrace(void **buf, int buf_sz)
{
#if HAS_EXECINFO
return backtrace(buf, buf_sz);
#else
return -1;
#endif
}