QTest::CrashHandler: reorganize Unix header blocks

Change-Id: Ib45e7e913fcc2e00f198fffdcc216e9f74c97e15
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Thiago Macieira 2025-05-14 22:34:46 -07:00
parent cf0c73e9fe
commit 2ef4ea3319

View File

@ -21,12 +21,6 @@
#include <stdio.h>
#include <stdlib.h>
#if defined(Q_OS_LINUX)
#include <sys/prctl.h>
#include <sys/types.h>
#include <fcntl.h>
#endif
#include <errno.h>
#if __has_include(<paths.h>)
# include <paths.h>
@ -41,16 +35,6 @@
# include <sys/resource.h>
# endif
# ifndef _PATH_DEFPATH
# define _PATH_DEFPATH "/usr/bin:/bin"
# endif
# ifndef SIGSTKSZ
# define SIGSTKSZ 0 /* we have code to set the minimum */
# endif
# ifndef SA_RESETHAND
# define SA_RESETHAND 0
# endif
#if defined(Q_OS_MACOS)
#include <QtCore/private/qcore_mac_p.h>
#include <QtTest/private/qtestutil_macos_p.h>
@ -59,12 +43,30 @@
#include <mach/task.h>
#include <mach/mach_init.h>
#include <CoreFoundation/CFPreferences.h>
#define CSR_ALLOW_UNRESTRICTED_FS (1 << 1)
#endif
#if defined(Q_OS_LINUX)
#include <sys/prctl.h>
#include <sys/types.h>
#include <fcntl.h>
#endif
#if defined(Q_OS_WASM)
#include <emscripten.h>
#endif
#ifndef _PATH_DEFPATH
# define _PATH_DEFPATH "/usr/bin:/bin"
#endif
#ifndef SIGSTKSZ
# define SIGSTKSZ 0 /* we have code to set the minimum */
#endif
#ifndef SA_RESETHAND
# define SA_RESETHAND 0
#endif
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
@ -285,8 +287,7 @@ void prepareStackTrace()
// where LLDB will hang and fail to provide a valid stack trace.
# if defined(Q_PROCESSOR_ARM)
return;
#else
#define CSR_ALLOW_UNRESTRICTED_FS (1 << 1)
# else
std::optional<uint32_t> sipConfiguration = qt_mac_sipConfiguration();
if (!sipConfiguration || !(*sipConfiguration & CSR_ALLOW_UNRESTRICTED_FS))
return;