]> git.tdb.fi Git - libs/core.git/blob - source/debug/backtrace.h
Assimilate exceptions and RefPtr from mspmisc
[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 #ifndef MSP_DEBUG_BACKTRACE_H_
8 #define MSP_DEBUG_BACKTRACE_H_
9
10 #include <list>
11 #include <ostream>
12 #include <string>
13
14 namespace Msp {
15 namespace Debug {
16
17 class Backtrace
18 {
19 public:
20         struct StackFrame
21         {
22                 void *address;
23                 std::string symbol;
24
25                 StackFrame(void *a, const std::string &s): address(a), symbol(s) { }
26         };
27         typedef std::list<StackFrame> FrameSeq;
28
29         const FrameSeq &get_frames() const { return frames; }
30
31         static Backtrace create();
32 private:
33         FrameSeq frames;
34 };
35
36 std::ostream &operator<<(std::ostream &, const Backtrace &);
37
38 } // namespace Debug
39 } // namespace Msp
40
41 #endif