X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fdebug%2Fbacktrace.cpp;h=de1f76e910611ee6dd95be1fadcda9dc727e4ff8;hp=643fdf2bb03288dd16cdd3605e473d675541a479;hb=f24e7b96e76b63c9b9b8a6bce4c7a9db64276ea8;hpb=55a79fbe96a87183fa4e11049eb161943636b1dd diff --git a/source/debug/backtrace.cpp b/source/debug/backtrace.cpp index 643fdf2..de1f76e 100644 --- a/source/debug/backtrace.cpp +++ b/source/debug/backtrace.cpp @@ -1,10 +1,6 @@ -/* $Id$ - -This file is part of libmspcore -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ -#ifndef WIN32 +// Must include something to test for glibc +#include +#if !defined(_WIN32) && defined(__GLIBC__) #include #include #endif @@ -18,31 +14,27 @@ namespace Debug { Backtrace Backtrace::create() { -#ifndef WIN32 +#if !defined(_WIN32) && defined(__GLIBC__) void *addresses[50]; - int count=::backtrace(addresses, 50); - - //char **symbols=backtrace_symbols(addresses, count); + int count = ::backtrace(addresses, 50); Backtrace bt; Dl_info dli; for(int i=0; iaddress<<" in "<symbol<<" from "<file<<'\n'; + for(const Backtrace::StackFrame &f: bt.get_frames()) + out<