tlx
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 <tb@panthema.net>
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
14
#include <
tlx/define/attribute_format_printf.hpp
>
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, ...)
34
TLX_ATTRIBUTE_FORMAT_PRINTF
(3, 4);
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
*/
48
void
enable_segv_backtrace
();
49
50
//! \}
51
52
}
// namespace tlx
53
54
#endif // !TLX_BACKTRACE_HEADER
55
56
/******************************************************************************/
tlx::print_raw_backtrace
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:38
tlx::print_cxx_backtrace
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:81
TLX_ATTRIBUTE_FORMAT_PRINTF
#define TLX_ATTRIBUTE_FORMAT_PRINTF(X, Y)
Definition:
attribute_format_printf.hpp:34
tlx
Definition:
exclusive_scan.hpp:17
tlx::enable_segv_backtrace
void enable_segv_backtrace()
Install SIGSEGV signal handler and output backtrace on segmentation fault.
Definition:
backtrace.cpp:186
attribute_format_printf.hpp
tlx
backtrace.hpp
Generated on Fri Jan 31 2020 00:00:00 for tlx by
1.8.17