aports/testing/qt-creator/no-execinfo.h.patch

68 lines
2.0 KiB
Diff

From 8046a5c74c371cb2f4b755df1feed1c2fd3cde1d Mon Sep 17 00:00:00 2001
From: fossdd <fossdd@pwned.life>
Date: Sun, 13 Jul 2025 01:58:27 +0200
Subject: [PATCH 1/2] no-execinfo.h
Signed-off-by: fossdd <fossdd@pwned.life>
---
src/libs/utils/qtcassert.cpp | 4 +++-
.../qmldesigner/libs/designercore/exceptions/exception.cpp | 6 +++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/libs/utils/qtcassert.cpp b/src/libs/utils/qtcassert.cpp
index 78baa41a4a8..846ca3137ae 100644
--- a/src/libs/utils/qtcassert.cpp
+++ b/src/libs/utils/qtcassert.cpp
@@ -11,7 +11,9 @@
#if defined(Q_OS_UNIX)
#include <stdio.h>
#include <signal.h>
+#ifdef __GLIBC__
#include <execinfo.h>
+#endif
#elif defined(_MSC_VER)
#ifdef QTCREATOR_PCH_H
#define CALLBACK WINAPI
@@ -29,7 +31,7 @@ void dumpBacktrace(int maxdepth)
const int ArraySize = 1000;
if (maxdepth < 0 || maxdepth > ArraySize)
maxdepth = ArraySize;
-#if defined(Q_OS_UNIX)
+#if defined(Q_OS_UNIX) && defined(__GLIBC__)
void *bt[ArraySize] = {nullptr};
int size = backtrace(bt, maxdepth);
char **lines = backtrace_symbols(bt, size);
diff --git a/src/plugins/qmldesigner/libs/designercore/exceptions/exception.cpp b/src/plugins/qmldesigner/libs/designercore/exceptions/exception.cpp
index b27a5b9b409..11524ee07a1 100644
--- a/src/plugins/qmldesigner/libs/designercore/exceptions/exception.cpp
+++ b/src/plugins/qmldesigner/libs/designercore/exceptions/exception.cpp
@@ -4,7 +4,9 @@
#include "exception.h"
#ifdef Q_OS_LINUX
-#include <execinfo.h>
+#ifdef __GLIBC__
+#include <execinfo.>
+#endif
#include <cxxabi.h>
#endif
@@ -31,12 +33,14 @@ bool Exception::warnAboutException()
namespace {
#if defined(__cpp_lib_stacktrace) && __cpp_lib_stacktrace >= 202011L
+#ifdef __GLIBC__
QString getBackTrace()
{
auto trace = std::stacktrace::current();
return QString::fromStdString(std::to_string(trace));
}
#endif
+#endif
} // namespace
QString Exception::defaultDescription(const Sqlite::source_location &sourceLocation)
--
2.50.1