tor  0.4.1.0-alpha-dev
backtrace.h
Go to the documentation of this file.
1 /* Copyright (c) 2013-2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
4 #ifndef TOR_BACKTRACE_H
5 #define TOR_BACKTRACE_H
6 
13 #include "orconfig.h"
14 #include "lib/cc/compat_compiler.h"
15 
16 typedef void (*tor_log_fn)(int, unsigned, const char *fmt, ...)
17  CHECK_PRINTF(3,4);
18 
19 void log_backtrace_impl(int severity, int domain, const char *msg,
20  tor_log_fn logger);
21 int configure_backtrace_handler(const char *tor_version);
23 void dump_stack_symbols_to_error_fds(void);
24 
25 #define log_backtrace(sev, dom, msg) \
26  log_backtrace_impl((sev), (dom), (msg), tor_log)
27 
28 #ifdef EXPOSE_CLEAN_BACKTRACE
29 #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && \
30  defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_SIGACTION)
31 void clean_backtrace(void **stack, size_t depth, const ucontext_t *ctx);
32 #endif
33 #endif /* defined(EXPOSE_CLEAN_BACKTRACE) */
34 
35 #endif /* !defined(TOR_BACKTRACE_H) */
int configure_backtrace_handler(const char *tor_version)
Definition: backtrace.c:269
void clean_up_backtrace_handler(void)
Definition: backtrace.c:283
Utility macros to handle different features and behavior in different compilers.