Utils: Add a QString-based write to QtcProcess

Centralize some boiler plate and warn about best-guessed cases.

Keep the QByteArray based access as writeRaw()

Fixes: QTCREATORBUG-27445
Change-Id: I948d80fba78b36cf85cc73664175ab05eb7707d4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2022-04-27 14:19:49 +02:00
parent 93401c9c81
commit aa3bdcb427
17 changed files with 54 additions and 38 deletions

View File

@@ -153,7 +153,7 @@ void LldbEngine::runCommand(const DebuggerCommand &command)
}
showMessage(msg, LogInput);
m_commandForToken[currentToken()] = cmd;
executeCommand("script theDumper." + function.toUtf8());
executeCommand("script theDumper." + function);
}
void LldbEngine::debugLastCommand()
@@ -170,7 +170,7 @@ void LldbEngine::handleAttachedToCore()
updateLocals();
}
void LldbEngine::executeCommand(const QByteArray &command)
void LldbEngine::executeCommand(const QString &command)
{
// For some reason, sometimes LLDB misses the first character of the next command on Windows
// if passing only 1 LF.
@@ -242,14 +242,13 @@ void LldbEngine::setupEngine()
const DebuggerRunParameters &rp = runParameters();
executeCommand("script sys.path.insert(1, '" + rp.dumperPath.path().toLocal8Bit() + "')");
executeCommand("script sys.path.insert(1, '" + rp.dumperPath.path() + "')");
// This triggers reportState("enginesetupok") or "enginesetupfailed":
executeCommand("script from lldbbridge import *");
QString commands = nativeStartupCommands();
if (!commands.isEmpty())
executeCommand(commands.toLocal8Bit());
executeCommand(commands);
const QString path = debuggerSettings()->extraDumperFile.value();
if (!path.isEmpty() && QFileInfo(path).isReadable()) {