diff options
author | Cristian Adam <cristian.adam@qt.io> | 2019-09-19 11:53:11 +0200 |
---|---|---|
committer | Cristian Adam <cristian.adam@qt.io> | 2019-09-19 10:43:12 +0000 |
commit | ccab8354551ab1e0b4c79bba66469e32945a750b (patch) | |
tree | 1c36555cb15794dcb2d10faeedde36ed3277a772 /src/tools/clangbackend | |
parent | f275a1fa28230568d23ddf071eaf6638a59b662f (diff) | |
download | qt-creator-ccab8354551ab1e0b4c79bba66469e32945a750b.tar.gz |
Debugging: Enable Windows debugging for clang tools
On Windows the debugging of clang tools is not working due to the
nature of how processes are started.
This makes it possible to use DebugViewer or DebugViewPP
Change-Id: I2c1e4bb7a8fafd6f07570e5d2ba4df5b44e9d44d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/tools/clangbackend')
-rw-r--r-- | src/tools/clangbackend/clangbackendmain.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/tools/clangbackend/clangbackendmain.cpp b/src/tools/clangbackend/clangbackendmain.cpp index 1e95db3ef3..76aff06d3b 100644 --- a/src/tools/clangbackend/clangbackendmain.cpp +++ b/src/tools/clangbackend/clangbackendmain.cpp @@ -57,25 +57,11 @@ QString processArguments(QCoreApplication &application) } #ifdef Q_OS_WIN -struct MessageHandler { - MessageHandler(QtMessageHandler handler) - { - defaultHandler = qInstallMessageHandler(handler); - } - - ~MessageHandler() - { - qInstallMessageHandler(defaultHandler); - } - - static QtMessageHandler defaultHandler; -}; - -QtMessageHandler MessageHandler::defaultHandler = nullptr; - -static void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) +extern "C" void OutputDebugStringW(const wchar_t* msg); +static void messageOutput(QtMsgType type, const QMessageLogContext &/*context*/, + const QString &msg) { - MessageHandler::defaultHandler(type, context, msg); + OutputDebugStringW(msg.toStdWString().c_str()); std::wcout << msg.toStdWString() << std::endl; if (type == QtFatalMsg) abort(); @@ -85,7 +71,7 @@ static void messageOutput(QtMsgType type, const QMessageLogContext &context, con int main(int argc, char *argv[]) { #ifdef Q_OS_WIN - MessageHandler messageHandler(&messageOutput); + qInstallMessageHandler(&messageOutput); #endif QCoreApplication::setOrganizationName(QStringLiteral("QtProject")); QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org")); |