diff --git a/examples/backtrace_test.c b/examples/backtrace_test.c index 1ef599b..fba9442 100644 --- a/examples/backtrace_test.c +++ b/examples/backtrace_test.c @@ -26,6 +26,8 @@ #include "backtrace.h" +#define BT_MAX_DEPTH (128) + void f2(void) { diff --git a/libbacktrace/backtrace.c b/libbacktrace/backtrace.c index 446137b..718ded9 100644 --- a/libbacktrace/backtrace.c +++ b/libbacktrace/backtrace.c @@ -35,6 +35,12 @@ __attribute__((unused)) static const char *cvstag = "$backtrace$"; #define BT_GET_DEPTH (1) #define BT_ADD_CR (1) +#define BT_MAX_DEPTH (128) + +struct bt_frame { + Dl_info bt_dlinfo; + unsigned int line; +}; #define HANDLE_FRAME(depth, idx, btaddr) \ case depth: \ diff --git a/libbacktrace/backtrace.h b/libbacktrace/backtrace.h index c4ce701..dabd8a8 100644 --- a/libbacktrace/backtrace.h +++ b/libbacktrace/backtrace.h @@ -16,18 +16,25 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef _EXECINFO_H_ +#define _EXECINFO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __GNUC__ #error "this library must be compiled with gcc" #endif -#define BT_MAX_DEPTH (128) - -struct bt_frame { - Dl_info bt_dlinfo; - unsigned int line; -}; +#include /* compatability functions with libexecinfo and glibc */ int backtrace(void **, int); char **backtrace_symbols(void *const *, int); void backtrace_symbols_fd(void *const *, int, int); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/libbacktrace/shlib_version b/libbacktrace/shlib_version index 3d7c908..1edea46 100644 --- a/libbacktrace/shlib_version +++ b/libbacktrace/shlib_version @@ -1,2 +1,2 @@ -major=0 -minor=1 +major=1 +minor=0