Commit 72e04e65 authored by Arvid Ephraim Picciani's avatar Arvid Ephraim Picciani
Browse files

lldb: flush socket after terminator to prevent severe lag

parent b19b2a71
......@@ -15,7 +15,6 @@ int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
Debugger::Internal::LldbEngineGuest lldb;
QLocalSocket s;
......@@ -34,8 +33,10 @@ int main(int argc, char **argv)
lldb.addBreakpoint(0, bp);
lldb.runEngine();
}else {
qDebug() << "guest connected";
s.connectToServer(QLatin1String("/tmp/qtcreator-debuggeripc"));
s.waitForConnected();
qDebug() << "guest connected";
app.connect(&s, SIGNAL(disconnected ()), &app, SLOT(quit()));
lldb.setHostDevice(&s);
}
......
......@@ -39,6 +39,7 @@
#include <QFileInfo>
#include <QTimer>
#include <utils/qtcassert.h>
#include <QLocalSocket>
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
#define SET_NATIVE_BYTE_ORDER(x) x.setByteOrder(QDataStream::LittleEndian)
......@@ -99,6 +100,9 @@ void IPCEngineGuest::rpcCall(Function f, QByteArray payload)
}
m_device->write(payload);
m_device->putChar('T');
QLocalSocket *sock = qobject_cast<QLocalSocket *>(m_device);
if (sock)
sock->flush();
}
}
......
......@@ -46,6 +46,7 @@
#include <QFileInfo>
#include <QTimer>
#include <utils/qtcassert.h>
#include <QLocalSocket>
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
#define SET_NATIVE_BYTE_ORDER(x) x.setByteOrder(QDataStream::LittleEndian)
......@@ -566,6 +567,9 @@ void IPCEngineHost::rpcCall(Function f, QByteArray payload)
m_device->write(header);
m_device->write(payload);
m_device->putChar('T');
QLocalSocket *sock = qobject_cast<QLocalSocket *>(m_device);
if (sock)
sock->flush();
}
}
......
......@@ -63,6 +63,8 @@ namespace Internal {
LldbEngineHost::LldbEngineHost(const DebuggerStartParameters &startParameters)
:IPCEngineHost(startParameters)
{
showMessage(QLatin1String("setting up coms"));
QLocalServer *s = new QLocalServer(this);
s->removeServer(QLatin1String("/tmp/qtcreator-debuggeripc"));
s->listen(QLatin1String("/tmp/qtcreator-debuggeripc"));
......@@ -73,18 +75,22 @@ LldbEngineHost::LldbEngineHost(const DebuggerStartParameters &startParameters)
connect(m_guestProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(finished(int, QProcess::ExitStatus)));
showStatusMessage(QLatin1String("starting qtcreator-lldb"));
QString a = Core::ICore::instance()->resourcePath() + QLatin1String("/qtcreator-lldb");
m_guestProcess->start(a, QStringList());
if (!m_guestProcess->waitForStarted()) {
showStatusMessage(tr("lldb failed to start"));
showStatusMessage(tr("qtcreator-lldb failed to start"));
notifyEngineIll();
return;
}
showMessage(QLatin1String("connecting"));
s->waitForNewConnection(-1);
QLocalSocket *f = s->nextPendingConnection();
s->close(); // wtf race in accept
showMessage(QLatin1String("connected"));
setGuestDevice(f);
}
......@@ -98,7 +104,7 @@ LldbEngineHost::~LldbEngineHost()
void LldbEngineHost::finished(int, QProcess::ExitStatus)
{
showStatusMessage(QLatin1String("lldb crashed"));
showStatusMessage(tr("lldb crashed"));
notifyEngineIll();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment