X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fdebug%2Fbacktrace.cpp;fp=source%2Fdebug%2Fbacktrace.cpp;h=2078996c41d234bb138f8cb29c4805e7894cd9ab;hb=521cf1db00f8ce2d9f9494dca503d6c17d89ac2f;hp=0000000000000000000000000000000000000000;hpb=80bbee2f401b4af71cb1b80508bdb0d2bb61fa40;p=libs%2Fcore.git diff --git a/source/debug/backtrace.cpp b/source/debug/backtrace.cpp new file mode 100644 index 0000000..2078996 --- /dev/null +++ b/source/debug/backtrace.cpp @@ -0,0 +1,45 @@ +/* $Id$ + +This file is part of libmspcore +Copyright © 2007 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ +#include +#include "backtrace.h" + +using namespace std; + +namespace Msp { +namespace Debug { + +Backtrace Backtrace::create() +{ +#ifndef WIN32 + void *addresses[50]; + int count=::backtrace(addresses, 50); + + char **symbols=backtrace_symbols(addresses, count); + + Backtrace bt; + for(int i=0; iaddress<<" in "<symbol<<'\n'; + + return out; +} + +} // namespace Debug +} // namespace Msp