tor  0.4.2.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 #include "lib/cc/torint.h"
16 #include "lib/defs/logging_types.h"
17 
18 typedef void (*tor_log_fn)(int, log_domain_mask_t, const char *fmt, ...)
19  CHECK_PRINTF(3,4);
20 
21 void log_backtrace_impl(int severity, log_domain_mask_t domain,
22  const char *msg,
23  tor_log_fn logger);
24 int configure_backtrace_handler(const char *tor_version);
26 void dump_stack_symbols_to_error_fds(void);
27 
28 #define log_backtrace(sev, dom, msg) \
29  log_backtrace_impl((sev), (dom), (msg), tor_log)
30 
31 #ifdef EXPOSE_CLEAN_BACKTRACE
32 #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && \
33  defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_SIGACTION)
34 void clean_backtrace(void **stack, size_t depth, const ucontext_t *ctx);
35 #endif
36 #endif /* defined(EXPOSE_CLEAN_BACKTRACE) */
37 
38 #endif /* !defined(TOR_BACKTRACE_H) */
Integer definitions used throughout Tor.
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.
Global definition for types used by logging systems.
uint64_t log_domain_mask_t
Definition: logging_types.h:21