Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libqf/libqfcore/src/core/exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Exception::Exception(const QString &_msg, const QString &_where)
m_where = _where;
m_msg = _msg;
m_what = m_msg.toUtf8();
m_stackTrace = StackTrace::stackTrace().join('\n');
m_stackTrace = qf::core::stackTrace().join('\n');
log();
}

Expand Down
21 changes: 13 additions & 8 deletions libqf/libqfcore/src/core/stacktrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

#include <QStringList>

#if defined Q_CC_GNU && !defined Q_CC_MINGW && !defined ANDROID
#include <cstdlib>
#include <execinfo.h>
#endif
namespace qf::core {

using namespace qf::core;
#if defined Q_CC_GNU && !defined Q_CC_MINGW && !defined Q_OS_ANDROID && !defined Q_OS_WASM

#include <cstdlib>
#include <execinfo.h>

QStringList StackTrace::stackTrace()
QStringList stackTrace()
{
#if defined Q_CC_GNU && !defined Q_CC_MINGW
const int max_frames = 100;
void* addrlist[max_frames]; // NOLINT(modernize-avoid-c-arrays)

Expand All @@ -33,8 +31,15 @@ QStringList StackTrace::stackTrace()

free(symbollist); // NOLINT(bugprone-multi-level-implicit-pointer-conversion,cppcoreguidelines-no-malloc,hicpp-no-malloc)
return sl_ret;
}

#else

QStringList stackTrace()
{
return {};
#endif
}

#endif

}
14 changes: 2 additions & 12 deletions libqf/libqfcore/src/core/stacktrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,10 @@

#include <QStringList>

namespace qf {
namespace core {
namespace qf::core {

/// Helper class generating the current stack trace
/**
Currently only Linux is supported.:((
*/
class QFCORE_DECL_EXPORT StackTrace
{
public:
static QStringList stackTrace();
};
QFCORE_DECL_EXPORT QStringList stackTrace();

}
}

#endif // QF_CORE_STACKTRACE_H