Add support for stack traces in testlib on Mac
Use lldb to generate a stack trace. Change-Id: I30b0ab656dda66b6aaa05841df641bee004702f0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
parent
7ebec0fa84
commit
73a48c1618
@ -121,6 +121,17 @@ static void stackTrace()
|
||||
if (system(cmd) == -1)
|
||||
fprintf(stderr, "calling gdb failed\n");
|
||||
fprintf(stderr, "========= End of stack trace ==============\n");
|
||||
#elif defined(Q_OS_OSX)
|
||||
fprintf(stderr, "\n========= Received signal, dumping stack ==============\n");
|
||||
char cmd[512];
|
||||
qsnprintf(cmd, 512, "lldb -p %d 2>/dev/null <<EOF\n"
|
||||
"bt all\n"
|
||||
"quit\n"
|
||||
"EOF\n",
|
||||
(int)getpid());
|
||||
if (system(cmd) == -1)
|
||||
fprintf(stderr, "calling lldb failed\n");
|
||||
fprintf(stderr, "========= End of stack trace ==============\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user