X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Flogbacktrace_unix.cpp;h=0f16edd0be692e78c1c22c2abb2fc5b6e061869f;hp=11e2550e1e07d1f2a16f90644e6f25265b8caeaf;hb=HEAD;hpb=9fc57dc2c000e80fb8bd746a090e2e8210e1278e diff --git a/src/common/logbacktrace_unix.cpp b/src/common/logbacktrace_unix.cpp index 11e2550e..0f16edd0 100644 --- a/src/common/logbacktrace_unix.cpp +++ b/src/common/logbacktrace_unix.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2013 by the Quassel Project * + * Copyright (C) 2005-2022 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -20,22 +20,24 @@ #include "quassel.h" -#if defined(HAVE_EXECINFO) && !defined(Q_OS_MAC) -# define BUILD_CRASHHANDLER -# include -# include -# include -# include -# include -# include +#if defined(HAVE_BACKTRACE) && !defined(Q_OS_MAC) +# define BUILD_CRASHHANDLER +# include +# include +# include + +# include +# include + +# include "backtrace_config.h" #endif -void Quassel::logBacktrace(const QString &filename) +void Quassel::logBacktrace(const QString& filename) { #ifndef BUILD_CRASHHANDLER Q_UNUSED(filename) #else - void *callstack[128]; + void* callstack[128]; int i, frames = backtrace(callstack, 128); QFile dumpFile(filename); @@ -54,15 +56,15 @@ void Quassel::logBacktrace(const QString &filename) // void *dli_saddr; /* Exact value of nearest symbol. */ // } Dl_info; - #if __LP64__ +# ifdef __LP64__ int addrSize = 16; - #else +# else int addrSize = 8; - #endif +# endif QString funcName; if (info.dli_sname) { - char *func = abi::__cxa_demangle(info.dli_sname, 0, 0, 0); + char* func = abi::__cxa_demangle(info.dli_sname, nullptr, nullptr, nullptr); if (func) { funcName = QString(func); free(func); @@ -84,10 +86,11 @@ void Quassel::logBacktrace(const QString &filename) fileName = fileName.mid(slashPos + 1); } - QString debugLine = QString("#%1 %2 0x%3 %4").arg(i, 3, 10) - .arg(fileName, -20) - .arg((ulong)(callstack[i]), addrSize, 16, QLatin1Char('0')) - .arg(funcName); + QString debugLine = QString("#%1 %2 0x%3 %4") + .arg(i, 3, 10) + .arg(fileName, -20) + .arg((ulong)(callstack[i]), addrSize, 16, QLatin1Char('0')) + .arg(funcName); dumpStream << debugLine << "\n"; qDebug() << qPrintable(debugLine);