Debugger: Invert LLDB/Python startup order

Instead of starting LLDB through a Python script this now starts
LLDB directly. This did not work a while ago but seems fine nowaday.

Change-Id: I20e915070cd6addf260817c311f4160d010aa861
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
hjk
2015-01-30 12:36:04 +01:00
parent b23182fca2
commit aa39916c41
4 changed files with 44 additions and 107 deletions

View File

@@ -129,10 +129,9 @@ void LldbEngine::runCommand(const Command &command)
QTC_ASSERT(m_lldbProc.state() == QProcess::Running, notifyEngineIll());
++m_lastToken;
QByteArray token = QByteArray::number(m_lastToken);
QByteArray cmd = "{\"cmd\":\"" + command.function + "\","
+ command.args + "\"token\":" + token + "}\n";
showMessage(_(token + cmd), LogInput);
m_lldbProc.write(cmd);
QByteArray cmd = command.function + "({" + command.args + "})";
showMessage(_(token + cmd + '\n'), LogInput);
m_lldbProc.write("sc db." + cmd + "\n");
}
void LldbEngine::debugLastCommand()
@@ -246,16 +245,12 @@ void LldbEngine::startLldb()
connect(this, &LldbEngine::outputReady,
this, &LldbEngine::handleResponse, Qt::QueuedConnection);
QStringList args;
args.append(_("-i"));
args.append(ICore::resourcePath() + _("/debugger/lldbbridge.py"));
args.append(m_lldbCmd);
showMessage(_("STARTING LLDB: python ") + args.join(QLatin1Char(' ')));
showMessage(_("STARTING LLDB: ") + m_lldbCmd);
m_lldbProc.setEnvironment(startParameters().environment.toStringList());
if (!startParameters().workingDirectory.isEmpty())
m_lldbProc.setWorkingDirectory(startParameters().workingDirectory);
m_lldbProc.start(_("python"), args);
m_lldbProc.start(m_lldbCmd);
if (!m_lldbProc.waitForStarted()) {
const QString msg = tr("Unable to start LLDB \"%1\": %2")
@@ -265,6 +260,21 @@ void LldbEngine::startLldb()
if (!msg.isEmpty())
ICore::showWarningWithOptions(tr("Adapter start failed."), msg);
}
showMessage(_("ADAPTER STARTED"));
showStatusMessage(tr("Setting up inferior..."));
const QByteArray dumperSourcePath =
ICore::resourcePath().toLocal8Bit() + "/debugger/";
m_lldbProc.write("sc sys.path.insert(1, '" + dumperSourcePath + "')\n");
m_lldbProc.write("sc from lldbbridge import *\n");
m_lldbProc.write("sc print(dir())\n");
m_lldbProc.write("sc db = Dumper()\n");
m_lldbProc.write("sc db.report('lldbversion=\"%s\"' % lldb.SBDebugger.GetVersionString())\n");
showMessage(_("ENGINE SUCCESSFULLY STARTED"));
notifyEngineSetupOk();
}
void LldbEngine::setupInferior()
@@ -299,6 +309,8 @@ void LldbEngine::setupInferior()
cmd.arg("useTerminal", sp.useTerminal);
cmd.arg("startMode", sp.startMode);
attemptBreakpointSynchronizationHelper(&cmd);
cmd.beginList("processArgs");
foreach (const QString &arg, args.toUnixArgs())
cmd.arg(arg.toUtf8().toHex());
@@ -338,19 +350,7 @@ void LldbEngine::setupInferior()
void LldbEngine::runEngine()
{
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
Command cmd("handleBreakpoints");
if (attemptBreakpointSynchronizationHelper(&cmd)) {
runEngine2();
} else {
cmd.arg("continuation", "runEngine2");
runCommand(cmd);
}
}
void LldbEngine::runEngine2()
{
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state(); return);
showStatusMessage(tr("Running requested..."), 5000);
runCommand("runEngine");
}
@@ -446,8 +446,6 @@ void LldbEngine::handleResponse(const QByteArray &response)
refreshDisassembly(item);
else if (name == "memory")
refreshMemory(item);
else if (name == "continuation")
runContinuation(item);
else if (name == "full-backtrace")
showFullBacktrace(item);
else if (name == "statusmessage") {
@@ -465,12 +463,6 @@ void LldbEngine::showFullBacktrace(const GdbMi &data)
QString::fromUtf8(QByteArray::fromHex(data.data())));
}
void LldbEngine::runContinuation(const GdbMi &data)
{
const QByteArray target = data.data();
QMetaObject::invokeMethod(this, target, Qt::QueuedConnection);
}
void LldbEngine::executeRunToLine(const ContextData &data)
{
resetLocation();