Thrill  0.1
backtrace.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * tlx/backtrace.hpp
3  *
4  * Part of tlx - http://panthema.net/tlx
5  *
6  * Copyright (C) 2008-2017 Timo Bingmann <[email protected]>
7  *
8  * All rights reserved. Published under the Boost Software License, Version 1.0
9  ******************************************************************************/
10 
11 #ifndef TLX_BACKTRACE_HEADER
12 #define TLX_BACKTRACE_HEADER
13 
15 
16 #include <cstdio>
17 
18 namespace tlx {
19 
20 //! \name Stack Backtrace Printing
21 //! \{
22 
23 /*!
24  * Print a plain hex stack backtrace of the called function to FILE* out.
25  */
26 void print_raw_backtrace(FILE* out = stderr, unsigned int max_frames = 63);
27 
28 /*!
29  * Print a plain hex stack backtrace of the called function to FILE* out,
30  * prefixed with the given printf formatted output.
31  */
32 void print_raw_backtrace(FILE* out, unsigned int max_frames,
33  const char* fmt, ...)
35 
36 /*!
37  * Print a demangled stack backtrace of the caller function to FILE* out.
38  *
39  * \warning The binary has to be compiled with <tt>-rdynamic</tt> for meaningful
40  * output.
41  */
42 void print_cxx_backtrace(FILE* out = stderr, unsigned int max_frames = 63);
43 
44 /*!
45  * Install SIGSEGV signal handler and output backtrace on segmentation fault.
46  * Compile with `-rdynamic` for more useful output.
47  */
49 
50 //! \}
51 
52 } // namespace tlx
53 
54 #endif // !TLX_BACKTRACE_HEADER
55 
56 /******************************************************************************/
#define TLX_ATTRIBUTE_FORMAT_PRINTF(X, Y)
void print_cxx_backtrace(FILE *out, unsigned int max_frames)
Print a demangled stack backtrace of the caller function to FILE* out.
Definition: backtrace.cpp:73
void print_raw_backtrace(FILE *out, unsigned int max_frames, const char *fmt,...)
Print a plain hex stack backtrace of the called function to FILE* out, prefixed with the given printf...
Definition: backtrace.cpp:30
void enable_segv_backtrace()
Install SIGSEGV signal handler and output backtrace on segmentation fault.
Definition: backtrace.cpp:178