]> git.tdb.fi Git - libs/core.git/blob - source/debug/backtrace.h
Fix an integer rounding error in Profiler
[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 file;
24                 std::string symbol;
25
26                 //StackFrame(void *a, const std::string &s): address(a), symbol(s) { }
27         };
28         typedef std::list<StackFrame> FrameSeq;
29
30         const FrameSeq &get_frames() const { return frames; }
31
32         static Backtrace create();
33 private:
34         FrameSeq frames;
35 };
36
37 std::ostream &operator<<(std::ostream &, const Backtrace &);
38
39 } // namespace Debug
40 } // namespace Msp
41
42 #endif