| 1 | From 8046a5c74c371cb2f4b755df1feed1c2fd3cde1d Mon Sep 17 00:00:00 2001
|
| 2 | From: fossdd <[email protected]>
|
| 3 | Date: Sun, 13 Jul 2025 01:58:27 +0200
|
| 4 | Subject: [PATCH 1/2] no-execinfo.h
|
| 5 |
|
| 6 | Signed-off-by: fossdd <[email protected]>
|
| 7 | ---
|
| 8 | src/libs/utils/qtcassert.cpp | 4 +++-
|
| 9 | .../qmldesigner/libs/designercore/exceptions/exception.cpp | 6 +++++-
|
| 10 | 2 files changed, 8 insertions(+), 2 deletions(-)
|
| 11 |
|
| 12 | diff --git a/src/libs/utils/qtcassert.cpp b/src/libs/utils/qtcassert.cpp
|
| 13 | index 78baa41a4a8..846ca3137ae 100644
|
| 14 | |
| 15 | |
| 16 | @@ -11,7 +11,9 @@
|
| 17 | #if defined(Q_OS_UNIX)
|
| 18 | #include <stdio.h>
|
| 19 | #include <signal.h>
|
| 20 | +#ifdef __GLIBC__
|
| 21 | #include <execinfo.h>
|
| 22 | +#endif
|
| 23 | #elif defined(_MSC_VER)
|
| 24 | #ifdef QTCREATOR_PCH_H
|
| 25 | #define CALLBACK WINAPI
|
| 26 | @@ -29,7 +31,7 @@ void dumpBacktrace(int maxdepth)
|
| 27 | const int ArraySize = 1000;
|
| 28 | if (maxdepth < 0 || maxdepth > ArraySize)
|
| 29 | maxdepth = ArraySize;
|
| 30 | -#if defined(Q_OS_UNIX)
|
| 31 | +#if defined(Q_OS_UNIX) && defined(__GLIBC__)
|
| 32 | void *bt[ArraySize] = {nullptr};
|
| 33 | int size = backtrace(bt, maxdepth);
|
| 34 | char **lines = backtrace_symbols(bt, size);
|
| 35 | diff --git a/src/plugins/qmldesigner/libs/designercore/exceptions/exception.cpp b/src/plugins/qmldesigner/libs/designercore/exceptions/exception.cpp
|
| 36 | index b27a5b9b409..11524ee07a1 100644
|
| 37 | |
| 38 | |
| 39 | @@ -4,7 +4,9 @@
|
| 40 | #include "exception.h"
|
| 41 |
|
| 42 | #ifdef Q_OS_LINUX
|
| 43 | -#include <execinfo.h>
|
| 44 | +#ifdef __GLIBC__
|
| 45 | +#include <execinfo.>
|
| 46 | +#endif
|
| 47 | #include <cxxabi.h>
|
| 48 | #endif
|
| 49 |
|
| 50 | @@ -31,12 +33,14 @@ bool Exception::warnAboutException()
|
| 51 |
|
| 52 | namespace {
|
| 53 | #if defined(__cpp_lib_stacktrace) && __cpp_lib_stacktrace >= 202011L
|
| 54 | +#ifdef __GLIBC__
|
| 55 | QString getBackTrace()
|
| 56 | {
|
| 57 | auto trace = std::stacktrace::current();
|
| 58 | return QString::fromStdString(std::to_string(trace));
|
| 59 | }
|
| 60 | #endif
|
| 61 | +#endif
|
| 62 | } // namespace
|
| 63 |
|
| 64 | QString Exception::defaultDescription(const Sqlite::source_location &sourceLocation)
|
| 65 | --
|
| 66 | 2.50.1
|
| 67 |
|