X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Futil.cpp;h=18d0ce862df8e6b75556d5dbfe0b1909faf761aa;hb=09f2a990950512cbe418526d91838887a0dded2a;hp=e0ed34cdf44783d234a30c1a6d3dc56ee1b0c335;hpb=928d604ce64ea9be9adba61d0198faec36e2dd8f;p=novacoin.git diff --git a/src/util.cpp b/src/util.cpp index e0ed34c..18d0ce8 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2011 The Bitcoin developers -// Copyright (c) 2011 The PPCoin developers +// Copyright (c) 2011-2012 The PPCoin developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. #include "headers.h" @@ -13,6 +13,10 @@ #include #include +#ifndef WIN32 +#include +#endif + using namespace std; using namespace boost; @@ -154,7 +158,7 @@ int GetRandInt(int nMax) - +static FILE* fileout = NULL; inline int OutputDebugStringF(const char* pszFormat, ...) { @@ -170,8 +174,6 @@ inline int OutputDebugStringF(const char* pszFormat, ...) else { // print to debug.log - static FILE* fileout = NULL; - if (!fileout) { char pszFile[MAX_PATH+100]; @@ -681,6 +683,19 @@ void PrintException(std::exception* pex, const char* pszThread) throw; } +void LogStackTrace() { + printf("\n\n******* exception encountered *******\n"); + if (fileout) + { +#ifndef WIN32 + void* pszBuffer[32]; + size_t size; + size = backtrace(pszBuffer, 32); + backtrace_symbols_fd(pszBuffer, size, fileno(fileout)); +#endif + } +} + void ThreadOneMessageBox(string strMessage) { // Skip message boxes if one is already open @@ -1002,7 +1017,7 @@ string FormatVersion(int nVersion) string FormatFullVersion() { - string s = FormatVersion(VERSION) + pszSubVer; + string s = FormatVersion(PPCOIN_VERSION) + pszSubVer; if (VERSION_IS_BETA) { s += "-"; s += _("beta");