mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 04:33:10 +08:00
Fix POSIX backtrace compile
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user