summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-11-16 19:26:05 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2021-11-18 18:13:20 +0100
commit4515c5e4fc17500cd42e19619ffb3bc6bee46425 (patch)
tree393b88bc2f0b979d139365f432484de2d3aaf62c /src/testlib
parent2ad5fd36fb0b77040113e93323911fbd5c3ccb49 (diff)
Use a QVarLengthArray for FatalSignalHandler's alternate stack
The stack needs to be at least SIGSTKSZ, which isn't constexpr, so we can't allocate it at compile time. However, we can resize(SIGSTKSZ) a QVarLengthArray that's probably big enough anyway. At the same time, increase the compile-time size to 32k, to match what our Catch2 harness for the self-test uses. Change-Id: I3a34ece73901dd402672cd6fe4da66923f1932c8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestcase.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 4cb9067c69..239b2ed2dd 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1691,11 +1691,12 @@ public:
// interfere with normal .bss symbols
__attribute__((section(".lbss.altstack"), aligned(4096)))
# endif
- static char alternate_stack[16 * 1024];
+ static QVarLengthArray<char, 32 * 1024> alternateStack;
+ alternateStack.resize(qMax(SIGSTKSZ, alternateStack.size()));
stack_t stack;
stack.ss_flags = 0;
- stack.ss_size = sizeof alternate_stack;
- stack.ss_sp = alternate_stack;
+ stack.ss_size = alternateStack.size();
+ stack.ss_sp = alternateStack.data();
sigaltstack(&stack, nullptr);
act.sa_flags |= SA_ONSTACK;
# endif