]> git.tdb.fi Git - libs/core.git/blob - source/debug/backtrace.h
66e36f35cfa3637c8b52b497a9d84a4b47dce87d
[libs/core.git] / source / debug / backtrace.h
1 /* $Id$
2
3 This file is part of libmspcore
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_DEBUG_BACKTRACE_H_
9 #define MSP_DEBUG_BACKTRACE_H_
10
11 #include <list>
12 #include <ostream>
13 #include <string>
14
15 namespace Msp {
16 namespace Debug {
17
18 class Backtrace
19 {
20 public:
21         struct StackFrame
22         {
23                 void *address;
24                 std::string file;
25                 std::string symbol;
26         };
27
28 private:
29         std::list<StackFrame> frames;
30
31 public:
32         const std::list<StackFrame> &get_frames() const { return frames; }
33
34         static Backtrace create();
35 };
36
37 std::ostream &operator<<(std::ostream &, const Backtrace &);
38 std::ostream &operator<<(std::ostream &, const Backtrace::StackFrame &);
39
40 } // namespace Debug
41 } // namespace Msp
42
43 #endif