1 /**
2  * SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
3  *
4  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5  */
6 
7 #include "core_debug.h"
8 
9 #if defined(__GNU_LIBRARY__)
10 #include <execinfo.h>
11 #include <stdlib.h>
12 #include <unistd.h>
13 #endif
14 
logBacktrace()15 void logBacktrace()
16 {
17 #if defined(__GNU_LIBRARY__)
18     void* array[32];
19     size_t size = backtrace (array, 32);
20     char** strings = backtrace_symbols (array, size);
21     backtrace_symbols_fd(array, size, STDERR_FILENO);
22     free (strings);
23 #endif
24 }
25