Fix application output of qtestlib projects when debugging with CDB

Tell QTestLib to use OutputDebugString for logging when "Run in
Terminal" is turned off. This way we are able to distinguish CDB's
output from the debuggee's output.

Task-number: QTCREATORBUG-16161
Change-Id: Ie5e6e4a0cbb853167766f782521101eff2e1963a
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Joerg Bornemann
2017-08-23 13:48:44 +02:00
parent 2605108f68
commit d954c944fe

View File

@@ -607,10 +607,17 @@ bool CdbEngine::launchCDB(const DebuggerRunParameters &sp, QString *errorMessage
m_outputBuffer.clear();
m_autoBreakPointCorrection = false;
const QStringList inferiorEnvironment = sp.inferior.environment.size() == 0 ?
QProcessEnvironment::systemEnvironment().toStringList() :
sp.inferior.environment.toStringList();
m_process.setEnvironment(mergeEnvironment(inferiorEnvironment, extensionFi.absolutePath()));
Utils::Environment inferiorEnvironment = sp.inferior.environment.size() == 0
? Utils::Environment::systemEnvironment() : sp.inferior.environment;
// Make sure that QTestLib uses OutputDebugString for logging.
const QString qtLoggingToConsoleKey = QStringLiteral("QT_LOGGING_TO_CONSOLE");
if (!sp.useTerminal && !inferiorEnvironment.hasKey(qtLoggingToConsoleKey))
inferiorEnvironment.set(qtLoggingToConsoleKey, QString(QLatin1Char('0')));
m_process.setEnvironment(mergeEnvironment(inferiorEnvironment.toStringList(),
extensionFi.absolutePath()));
if (!sp.inferior.workingDirectory.isEmpty())
m_process.setWorkingDirectory(sp.inferior.workingDirectory);