LLDB: Append 2 newlines after commands

For some reason, sometimes LLDB misses the first character of the next
command on Windows.

Task-number: QTCREATORBUG-14539
Change-Id: Ide78e0a0aa64ea4cbcaf6b55a0acdd548a1fa46c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Orgad Shaneh
2020-08-27 23:51:56 +03:00
committed by Orgad Shaneh
parent b41ea23233
commit b55cc28264
2 changed files with 12 additions and 4 deletions

View File

@@ -151,7 +151,7 @@ void LldbEngine::runCommand(const DebuggerCommand &command)
}
showMessage(msg, LogInput);
m_commandForToken[currentToken()] = cmd;
m_lldbProc.write("script theDumper." + function.toUtf8() + "\n");
executeCommand("script theDumper." + function.toUtf8());
}
void LldbEngine::debugLastCommand()
@@ -168,6 +168,13 @@ void LldbEngine::handleAttachedToCore()
updateLocals();
}
void LldbEngine::executeCommand(const QByteArray &command)
{
// For some reason, sometimes LLDB misses the first character of the next command on Windows
// if passing only 1 LF.
m_lldbProc.write(command + "\n\n");
}
void LldbEngine::shutdownInferior()
{
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
@@ -228,13 +235,13 @@ void LldbEngine::setupEngine()
const QByteArray dumperSourcePath =
ICore::resourcePath().toLocal8Bit() + "/debugger/";
m_lldbProc.write("script sys.path.insert(1, '" + dumperSourcePath + "')\n");
executeCommand("script sys.path.insert(1, '" + dumperSourcePath + "')");
// This triggers reportState("enginesetupok") or "enginesetupfailed":
m_lldbProc.write("script from lldbbridge import *\n");
executeCommand("script from lldbbridge import *");
QString commands = nativeStartupCommands();
if (!commands.isEmpty())
m_lldbProc.write(commands.toLocal8Bit() + '\n');
executeCommand(commands.toLocal8Bit());
const QString path = stringSetting(ExtraDumperFile);

View File

@@ -131,6 +131,7 @@ private:
void runCommand(const DebuggerCommand &cmd) override;
void debugLastCommand() override;
void handleAttachedToCore();
void executeCommand(const QByteArray &command);
private:
DebuggerCommand m_lastDebuggableCommand;