File indexing completed on 2024-04-14 04:51:40

0001 /**
0002  * SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #include "core_debug.h"
0008 
0009 #if defined(__GNU_LIBRARY__)
0010 #include <execinfo.h>
0011 #include <stdlib.h>
0012 #include <unistd.h>
0013 #endif
0014 
0015 void logBacktrace()
0016 {
0017 #if defined(__GNU_LIBRARY__)
0018     void *array[32];
0019     size_t size = backtrace(array, 32);
0020     char **strings = backtrace_symbols(array, size);
0021     backtrace_symbols_fd(array, size, STDERR_FILENO);
0022     free(strings);
0023 #endif
0024 }