Tor  0.4.7.0-alpha-dev
backtrace.h
Go to the documentation of this file.
1 /* Copyright (c) 2013-2021, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
4 #ifndef TOR_BACKTRACE_H
5 #define TOR_BACKTRACE_H
6 
7 /**
8  * \file backtrace.h
9  *
10  * \brief Header for backtrace.c
11  **/
12 
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 const char *get_tor_backtrace_version(void);
28 
29 #define log_backtrace(sev, dom, msg) \
30  log_backtrace_impl((sev), (dom), (msg), tor_log)
31 
32 #ifdef BACKTRACE_PRIVATE
33 #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && \
34  defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_SIGACTION)
35 void clean_backtrace(void **stack, size_t depth, const ucontext_t *ctx);
36 #endif
37 #endif /* defined(BACKTRACE_PRIVATE) */
38 
39 #endif /* !defined(TOR_BACKTRACE_H) */
int configure_backtrace_handler(const char *tor_version)
Definition: backtrace.c:330
const char * get_tor_backtrace_version(void)
Definition: backtrace.c:323
void clean_up_backtrace_handler(void)
Definition: backtrace.c:359
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
Integer definitions used throughout Tor.