File indexing completed on 2025-01-18 10:17:36
0001
0002
0003
0004
0005 #pragma once
0006
0007 #include <ostream>
0008 #include <string>
0009 #include <atomic>
0010 #include <array>
0011
0012
0013 class JBacktrace {
0014 static const int MAX_FRAMES = 100;
0015 std::array<void*, MAX_FRAMES> m_buffer;
0016 int m_frame_count = 0;
0017 int m_frames_to_omit = 0;
0018 std::atomic_bool m_ready {false};
0019
0020 public:
0021
0022 JBacktrace() = default;
0023 ~JBacktrace() = default;
0024 JBacktrace(const JBacktrace& other);
0025 JBacktrace(JBacktrace&& other);
0026 JBacktrace& operator=(const JBacktrace&);
0027
0028 void WaitForCapture() const;
0029 void Capture(int frames_to_omit=0);
0030 void Reset();
0031 std::string ToString() const;
0032 void Format(std::ostream& os) const;
0033 std::string AddrToLineInfo(const char* filename, size_t offset) const;
0034
0035 };
0036
0037