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