Cppcheck
stacktrace.h
Go to the documentation of this file.
1 /*
2  * Cppcheck - A tool for static C/C++ code analysis
3  * Copyright (C) 2007-2024 Cppcheck team.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef STACKTRACE_H
20 #define STACKTRACE_H
21 
22 #include "config.h"
23 
24 #ifdef USE_UNIX_BACKTRACE_SUPPORT
25 
26 #include <cstdio>
27 
28 /*
29  * Try to print the callstack.
30  * That is very sensitive to the operating system, hardware, compiler and runtime.
31  * The code is not meant for production environment!
32  * One reason is named first: it's using functions not whitelisted for usage in a signal handler function.
33  *
34  * @param output the descriptor to write the trace to
35  * @param start_idx the frame index to start with
36  * @param demangling controls demangling of symbols
37  * @param maxdepth the maximum number of frames to list (32 at most or if -1)
38  * @param omit_above_own omit top frames which are above our own code (i.e. libc symbols)
39  */
40 void print_stacktrace(FILE* output, int start_idx, bool demangling, int maxdepth, bool omit_above_own);
41 
42 #endif
43 
44 #endif // STACKTRACE_H