2019-07-22 20:29:39 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
|
2019-07-22 20:29:39 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2019-07-22 20:29:39 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "core_debug.h"
|
|
|
|
|
|
|
|
#if defined(__GNU_LIBRARY__)
|
|
|
|
#include <execinfo.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void logBacktrace()
|
|
|
|
{
|
|
|
|
#if defined(__GNU_LIBRARY__)
|
2022-09-10 22:23:52 +01:00
|
|
|
void *array[32];
|
|
|
|
size_t size = backtrace(array, 32);
|
|
|
|
char **strings = backtrace_symbols(array, size);
|
2019-07-22 20:29:39 +01:00
|
|
|
backtrace_symbols_fd(array, size, STDERR_FILENO);
|
2022-09-10 22:23:52 +01:00
|
|
|
free(strings);
|
2019-07-22 20:29:39 +01:00
|
|
|
#endif
|
|
|
|
}
|