X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fdebug%2Fbacktrace.h;fp=source%2Fdebug%2Fbacktrace.h;h=c570ce5d0746f0dd31106132f052ae8d2c715426;hp=0000000000000000000000000000000000000000;hb=521cf1db00f8ce2d9f9494dca503d6c17d89ac2f;hpb=80bbee2f401b4af71cb1b80508bdb0d2bb61fa40 diff --git a/source/debug/backtrace.h b/source/debug/backtrace.h new file mode 100644 index 0000000..c570ce5 --- /dev/null +++ b/source/debug/backtrace.h @@ -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 +#include +#include + +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 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