summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcrashhandler_unix.cpp
diff options
context:
space:
mode:
authorThiago Macieira <[email protected]>2025-05-14 22:34:46 -0700
committerThiago Macieira <[email protected]>2025-05-23 20:36:45 -0700
commit2ef4ea3319fbccdc15954399337c9256f67932c4 (patch)
treef6a24b40c751adfd04a03772a2ba92a61f99682e /src/testlib/qtestcrashhandler_unix.cpp
parentcf0c73e9fe12827d7ca3027f72573340154db02a (diff)
QTest::CrashHandler: reorganize Unix header blocks
Change-Id: Ib45e7e913fcc2e00f198fffdcc216e9f74c97e15 Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
Diffstat (limited to 'src/testlib/qtestcrashhandler_unix.cpp')
-rw-r--r--src/testlib/qtestcrashhandler_unix.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/testlib/qtestcrashhandler_unix.cpp b/src/testlib/qtestcrashhandler_unix.cpp
index 23ba8287d81..92ad16ceb97 100644
--- a/src/testlib/qtestcrashhandler_unix.cpp
+++ b/src/testlib/qtestcrashhandler_unix.cpp
@@ -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;