]> git.tdb.fi Git - libs/core.git/blobdiff - source/debug/backtrace.h
Assimilate exceptions and RefPtr from mspmisc
[libs/core.git] / source / debug / backtrace.h
diff --git a/source/debug/backtrace.h b/source/debug/backtrace.h
new file mode 100644 (file)
index 0000000..c570ce5
--- /dev/null
@@ -0,0 +1,41 @@
+/* $Id$
+
+This file is part of libmspcore
+Copyright © 2007 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+#ifndef MSP_DEBUG_BACKTRACE_H_
+#define MSP_DEBUG_BACKTRACE_H_
+
+#include <list>
+#include <ostream>
+#include <string>
+
+namespace Msp {
+namespace Debug {
+
+class Backtrace
+{
+public:
+       struct StackFrame
+       {
+               void *address;
+               std::string symbol;
+
+               StackFrame(void *a, const std::string &s): address(a), symbol(s) { }
+       };
+       typedef std::list<StackFrame> FrameSeq;
+
+       const FrameSeq &get_frames() const { return frames; }
+
+       static Backtrace create();
+private:
+       FrameSeq frames;
+};
+
+std::ostream &operator<<(std::ostream &, const Backtrace &);
+
+} // namespace Debug
+} // namespace Msp
+
+#endif