From eb6553d92362dbd1e96a721933b8835cd2a59a1e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 19 Oct 2015 09:48:27 +0200 Subject: [PATCH] Fix POSIX backtrace compile --- src/platforms/posix/px4_layer/px4_log.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/platforms/posix/px4_layer/px4_log.c b/src/platforms/posix/px4_layer/px4_log.c index b0cfb4c087..074ae8b466 100644 --- a/src/platforms/posix/px4_layer/px4_log.c +++ b/src/platforms/posix/px4_layer/px4_log.c @@ -1,13 +1,16 @@ #include #include +#ifdef __PX4_POSIX #include +#endif __EXPORT int __px4_log_level_current = PX4_LOG_LEVEL_AT_RUN_TIME; -__EXPORT const char *__px4_log_level_str[_PX4_LOG_LEVEL_PANIC+1] = { "INFO", "DEBUG", "WARN", "ERROR", "PANIC" }; +__EXPORT const char *__px4_log_level_str[_PX4_LOG_LEVEL_PANIC + 1] = { "INFO", "DEBUG", "WARN", "ERROR", "PANIC" }; void px4_backtrace() { +#ifdef __PX4_POSIX void *buffer[10]; char **callstack; int bt_size; @@ -16,11 +19,12 @@ void px4_backtrace() bt_size = backtrace(buffer, 10); callstack = backtrace_symbols(buffer, bt_size); - PX4_INFO("Backtrace:", bt_size); + PX4_INFO("Backtrace: %d", bt_size); - for(idx=0; idx < bt_size; idx++) + for (idx = 0; idx < bt_size; idx++) { PX4_INFO("%s", callstack[idx]); + } free(callstack); +#endif } -