Prefer more cache-efficient containers
[libs/core.git] / source / debug / backtrace.h
1 #ifndef MSP_DEBUG_BACKTRACE_H_
2 #define MSP_DEBUG_BACKTRACE_H_
3
4 #include <ostream>
5 #include <string>
6 #include <vector>
7
8 namespace Msp {
9 namespace Debug {
10
11 class Backtrace
12 {
13 public:
14         struct StackFrame
15         {
16                 void *address;
17                 std::string file;
18                 std::string symbol;
19         };
20
21 private:
22         std::vector<StackFrame> frames;
23
24 public:
25         const std::vector<StackFrame> &get_frames() const { return frames; }
26
27         static Backtrace create();
28 };
29
30 std::ostream &operator<<(std::ostream &, const Backtrace &);
31 std::ostream &operator<<(std::ostream &, const Backtrace::StackFrame &);
32
33 } // namespace Debug
34 } // namespace Msp
35
36 #endif