forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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"));
|
||||
|
@@ -247,8 +247,10 @@ struct Data // because we have a cycle dependency
|
||||
};
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
extern "C" void OutputDebugStringW(const wchar_t* msg);
|
||||
static void messageOutput(QtMsgType type, const QMessageLogContext &, const QString &msg)
|
||||
{
|
||||
OutputDebugStringW(msg.toStdWString().c_str());
|
||||
std::wcout << msg.toStdWString() << std::endl;
|
||||
if (type == QtFatalMsg)
|
||||
abort();
|
||||
|
@@ -131,8 +131,10 @@ struct Data // because we have a cycle dependency
|
||||
};
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
extern "C" void OutputDebugStringW(const wchar_t* msg);
|
||||
static void messageOutput(QtMsgType type, const QMessageLogContext &, const QString &msg)
|
||||
{
|
||||
OutputDebugStringW(msg.toStdWString().c_str());
|
||||
std::wcout << msg.toStdWString() << std::endl;
|
||||
if (type == QtFatalMsg)
|
||||
abort();
|
||||
|
Reference in New Issue
Block a user