Backtrace.h 797 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef C10_UTIL_BACKTRACE_H_
  2. #define C10_UTIL_BACKTRACE_H_
  3. #include <cstddef>
  4. #include <memory>
  5. #include <string>
  6. #include <typeinfo>
  7. #include <c10/macros/Macros.h>
  8. #include <c10/util/Lazy.h>
  9. namespace c10 {
  10. // Symbolizing the backtrace can be expensive; pass it around as a lazy string
  11. // so it is symbolized only if actually needed.
  12. using Backtrace = std::shared_ptr<const LazyValue<std::string>>;
  13. // DEPRECATED: Prefer get_lazy_backtrace().
  14. C10_API std::string get_backtrace(
  15. size_t frames_to_skip = 0,
  16. size_t maximum_number_of_frames = 64,
  17. bool skip_python_frames = true);
  18. C10_API Backtrace get_lazy_backtrace(
  19. size_t frames_to_skip = 0,
  20. size_t maximum_number_of_frames = 64,
  21. bool skip_python_frames = true);
  22. } // namespace c10
  23. #endif // C10_UTIL_BACKTRACE_H_