Fix POSIX backtrace compile

This commit is contained in:
Lorenz Meier
2015-10-19 09:48:27 +02:00
parent 8e82ced5a4
commit eb6553d923

View File

@@ -1,13 +1,16 @@
#include <stdlib.h>
#include <px4_log.h>
#ifdef __PX4_POSIX
#include <execinfo.h>
#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
}