aboutsummaryrefslogtreecommitdiff
path: root/src/lib/err/backtrace.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/err/backtrace.h')
-rw-r--r--src/lib/err/backtrace.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lib/err/backtrace.h b/src/lib/err/backtrace.h
new file mode 100644
index 0000000000..0a145fc92d
--- /dev/null
+++ b/src/lib/err/backtrace.h
@@ -0,0 +1,29 @@
+/* Copyright (c) 2013-2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef TOR_BACKTRACE_H
+#define TOR_BACKTRACE_H
+
+#include "orconfig.h"
+#include "common/compat_compiler.h"
+
+typedef void (*tor_log_fn)(int, unsigned, const char *fmt, ...)
+ CHECK_PRINTF(3,4);
+
+void log_backtrace_impl(int severity, int domain, const char *msg,
+ tor_log_fn logger);
+int configure_backtrace_handler(const char *tor_version);
+void clean_up_backtrace_handler(void);
+void dump_stack_symbols_to_error_fds(void);
+
+#define log_backtrace(sev, dom, msg) \
+ log_backtrace_impl((sev), (dom), (msg), tor_log)
+
+#ifdef EXPOSE_CLEAN_BACKTRACE
+#if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && \
+ defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_SIGACTION)
+void clean_backtrace(void **stack, size_t depth, const ucontext_t *ctx);
+#endif
+#endif /* defined(EXPOSE_CLEAN_BACKTRACE) */
+
+#endif /* !defined(TOR_BACKTRACE_H) */