Clang: Disable printing stack traces by default

Printing the stack strace in the event of a crash is very useful, but in
the worst case it can also result in a deadlock, without any trace being
printed, rendering the clangbackend completely useless.

For example, if a thread allocates memory (lock) and another thread
crashes right then, clang's stack trace printer is invoked, which
(unfortunately) also tries to allocate memory (deadlock). This was
observed with QTCREATORBUG-21559.

The stack trace printer should be fixed in clang. Until then, disable
printing stack traces by default and allow to enable when explicitly
requested (QTC_CLANG_ENABLE_STACKTRACES=1).

Task-number: QTCREATORBUG-21559
Change-Id: I418cea7f3d70bc8a9cae333b3858228650307c6e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-11-23 11:28:10 +01:00
parent b61d11a446
commit a4cf0ad109

View File

@@ -80,7 +80,9 @@ int main(int argc, char *argv[])
const QString connection = processArguments(application);
clang_enableStackTraces();
// Printing the stack strace might dead lock as clang's stack printer allocates memory.
if (qEnvironmentVariableIntValue("QTC_CLANG_ENABLE_STACKTRACES"))
clang_enableStackTraces();
ClangCodeModelServer clangCodeModelServer;
ConnectionServer<ClangCodeModelServer, ClangCodeModelClientProxy> connectionServer;