testlib: Spit out crash backtraces to stderr

Ensures that the backtrace is interleaved with the header and
footer that we print ourselves.

Change-Id: I728f4a05be31e345687cbb5fefe49f76dbe8ae36
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Tor Arne Vestbø 2020-10-23 12:26:09 +02:00
parent 419db858f5
commit addd3b5292

View File

@ -220,7 +220,7 @@ static void stackTrace()
#endif
#ifdef Q_OS_LINUX
char cmd[512];
qsnprintf(cmd, 512, "gdb --pid %d 2>/dev/null <<EOF\n"
qsnprintf(cmd, 512, "gdb --pid %d 1>&2 2>/dev/null <<EOF\n"
"set prompt\n"
"set height 0\n"
"thread apply all where full\n"
@ -233,7 +233,7 @@ static void stackTrace()
fprintf(stderr, "=== End of stack trace ===\n");
#elif defined(Q_OS_MACOS)
char cmd[512];
qsnprintf(cmd, 512, "lldb -p %d 2>/dev/null <<EOF\n"
qsnprintf(cmd, 512, "lldb -p %d 1>&2 2>/dev/null <<EOF\n"
"bt all\n"
"quit\n"
"EOF\n",