backtrace.h 1023 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* Copyright (c) 2013-2018, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. #ifndef TOR_BACKTRACE_H
  4. #define TOR_BACKTRACE_H
  5. /**
  6. * \file backtrace.h
  7. *
  8. * \brief Header for backtrace.c
  9. **/
  10. #include "orconfig.h"
  11. #include "lib/cc/compat_compiler.h"
  12. typedef void (*tor_log_fn)(int, unsigned, const char *fmt, ...)
  13. CHECK_PRINTF(3,4);
  14. void log_backtrace_impl(int severity, int domain, const char *msg,
  15. tor_log_fn logger);
  16. int configure_backtrace_handler(const char *tor_version);
  17. void clean_up_backtrace_handler(void);
  18. void dump_stack_symbols_to_error_fds(void);
  19. #define log_backtrace(sev, dom, msg) \
  20. log_backtrace_impl((sev), (dom), (msg), tor_log)
  21. #ifdef EXPOSE_CLEAN_BACKTRACE
  22. #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && \
  23. defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_SIGACTION)
  24. void clean_backtrace(void **stack, size_t depth, const ucontext_t *ctx);
  25. #endif
  26. #endif /* defined(EXPOSE_CLEAN_BACKTRACE) */
  27. #endif /* !defined(TOR_BACKTRACE_H) */