ipcenginehost.cpp 19.5 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
2
**
hjk's avatar
hjk committed
3 4
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
7
**
hjk's avatar
hjk committed
8 9 10 11 12 13 14
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
15 16
**
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17 18 19 20 21 22 23 24 25
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
con's avatar
con committed
26 27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
28
****************************************************************************/
29 30

#include "ipcenginehost.h"
31

32
#include "ipcengineguest.h"
Friedemann Kleint's avatar
Friedemann Kleint committed
33
#include "debuggerstartparameters.h"
34 35
#include "breakhandler.h"
#include "breakpoint.h"
36
#include "disassemblerlines.h"
37 38 39 40 41 42
#include "moduleshandler.h"
#include "registerhandler.h"
#include "stackhandler.h"
#include "watchhandler.h"
#include "watchutils.h"
#include "threadshandler.h"
43 44
#include "disassembleragent.h"
#include "memoryagent.h"
45
#include "debuggerstreamops.h"
46
#include "debuggercore.h"
47

48 49
#include <utils/qtcassert.h>

50 51 52 53 54
#include <QSysInfo>
#include <QDebug>
#include <QFileInfo>
#include <QTimer>
#include <QLocalSocket>
55 56 57 58 59 60 61 62 63 64 65

#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
#define SET_NATIVE_BYTE_ORDER(x) x.setByteOrder(QDataStream::LittleEndian)
#else
#define SET_NATIVE_BYTE_ORDER(x) x.setByteOrder(QDataStream::BigEndian)
#endif

namespace Debugger {
namespace Internal {

IPCEngineHost::IPCEngineHost (const DebuggerStartParameters &startParameters)
66
    : DebuggerEngine(startParameters)
hjk's avatar
hjk committed
67
    , m_localGuest(0)
68 69 70 71
    , m_nextMessagePayloadSize(0)
    , m_cookie(1)
    , m_device(0)
{
72
    connect(this, SIGNAL(stateChanged(Debugger::DebuggerState)), SLOT(m_stateChanged(Debugger::DebuggerState)));
73 74 75 76 77 78 79
}

IPCEngineHost::~IPCEngineHost()
{
    delete m_device;
}

hjk's avatar
hjk committed
80
void IPCEngineHost::setLocalGuest(IPCEngineGuest *guest)
81
{
hjk's avatar
hjk committed
82
    m_localGuest = guest;
83 84
}

hjk's avatar
hjk committed
85
void IPCEngineHost::setGuestDevice(QIODevice *device)
86 87 88 89 90
{
    if (m_device) {
        disconnect(m_device, SIGNAL(readyRead()), this, SLOT(readyRead()));
        delete m_device;
    }
hjk's avatar
hjk committed
91
    m_device = device;
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
    if (m_device)
        connect(m_device, SIGNAL(readyRead()), this, SLOT(readyRead()));
}

void IPCEngineHost::setupEngine()
{
    QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
    rpcCall(SetupEngine);
}

void IPCEngineHost::setupInferior()
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
        s << QFileInfo(startParameters().executable).absoluteFilePath();
        s << startParameters().processArgs;
111
        s << startParameters().environment.toStringList();
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
    }
    rpcCall(SetupInferior, p);
}

void IPCEngineHost::runEngine()
{
    QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
    rpcCall(RunEngine);
}

void IPCEngineHost::shutdownInferior()
{
    QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
    rpcCall(ShutdownInferior);
}

void IPCEngineHost::shutdownEngine()
{
    rpcCall(ShutdownEngine);
}

void IPCEngineHost::detachDebugger()
{
    rpcCall(DetachDebugger);
}

void IPCEngineHost::executeStep()
{
    rpcCall(ExecuteStep);
}

void IPCEngineHost::executeStepOut()
{
    rpcCall(ExecuteStepOut);
}

void IPCEngineHost::executeNext()
{
    rpcCall(ExecuteNext);
}

void IPCEngineHost::executeStepI()
{
    rpcCall(ExecuteStepI);
}

void IPCEngineHost::executeNextI()
{
    rpcCall(ExecuteNextI);
}

void IPCEngineHost::continueInferior()
{
    QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
    resetLocation();
    rpcCall(ContinueInferior);
}

void IPCEngineHost::interruptInferior()
{
    QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state());
    rpcCall(InterruptInferior);
}

176
void IPCEngineHost::executeRunToLine(const ContextData &data)
177 178 179 180 181
{
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
182 183
        s << data.fileName;
        s << quint64(data.lineNumber);
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
    }
    rpcCall(ExecuteRunToLine, p);
}

void IPCEngineHost::executeRunToFunction(const QString &functionName)
{
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
        s << functionName;
    }
    rpcCall(ExecuteRunToFunction, p);
}

199
void IPCEngineHost::executeJumpToLine(const ContextData &data)
200 201 202 203 204
{
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
205 206
        s << data.fileName;
        s << quint64(data.lineNumber);
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
    }
    rpcCall(ExecuteJumpToLine, p);
}

void IPCEngineHost::activateFrame(int index)
{
    resetLocation();
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
        s << quint64(index);
    }
    rpcCall(ActivateFrame, p);
}

hjk's avatar
hjk committed
223
void IPCEngineHost::selectThread(ThreadId id)
224 225
{
    resetLocation();
hjk's avatar
hjk committed
226
    QTC_ASSERT(id.isValid(), return);
227 228 229 230
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
hjk's avatar
hjk committed
231
        s << id.raw();
232 233 234 235
    }
    rpcCall(SelectThread, p);
}

236
void IPCEngineHost::fetchDisassembler(DisassemblerAgent *v)
237
{
238
    quint64 address = v->location().address();
239 240 241 242 243 244 245 246 247 248
    m_frameToDisassemblerAgent.insert(address, v);
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
        s << address;
    }
    rpcCall(Disassemble, p);
}

249
void IPCEngineHost::insertBreakpoint(BreakpointModelId id)
250
{
251
    breakHandler()->notifyBreakpointInsertProceeding(id);
252 253 254 255
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
256 257
        s << id;
        s << breakHandler()->breakpointData(id);
258 259 260 261
    }
    rpcCall(AddBreakpoint, p);
}

262
void IPCEngineHost::removeBreakpoint(BreakpointModelId id)
263
{
264
    breakHandler()->notifyBreakpointRemoveProceeding(id);
265 266 267 268 269 270 271 272 273
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
        s << id;
    }
    rpcCall(RemoveBreakpoint, p);
}

274
void IPCEngineHost::changeBreakpoint(BreakpointModelId id)
275
{
276
    breakHandler()->notifyBreakpointChangeProceeding(id);
277 278 279 280
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
281 282
        s << id;
        s << breakHandler()->breakpointData(id);
283 284 285 286
    }
    rpcCall(RemoveBreakpoint, p);
}

287 288
void IPCEngineHost::updateWatchData(const WatchData &data,
            const WatchUpdateFlags &flags)
289 290 291 292 293 294 295 296 297 298 299
{
    Q_UNUSED(flags);
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
        s << data;
    }
    rpcCall(RequestUpdateWatchData, p);
}

300 301 302 303 304 305 306 307 308 309 310
void IPCEngineHost::fetchFrameSource(qint64 id)
{
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
        s << id;
    }
    rpcCall(FetchFrameSource, p);
}

311 312 313
void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
{
    switch (f) {
Friedemann Kleint's avatar
Friedemann Kleint committed
314
        default: {
315
            showMessage(QLatin1String("IPC Error: unhandled id in guest to host call"));
Friedemann Kleint's avatar
Friedemann Kleint committed
316 317 318 319
            const QString logMessage = tr("Fatal engine shutdown. Incompatible binary or IPC error.");
            showMessage(logMessage, LogError);
            showStatusMessage(logMessage);
    }
320
            nuke();
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
            break;
        case IPCEngineGuest::NotifyEngineSetupOk:
            notifyEngineSetupOk();
            break;
        case IPCEngineGuest::NotifyEngineSetupFailed:
            notifyEngineSetupFailed();
            break;
        case IPCEngineGuest::NotifyEngineRunFailed:
            notifyEngineRunFailed();
            break;
        case IPCEngineGuest::NotifyInferiorSetupOk:
            attemptBreakpointSynchronization();
            notifyInferiorSetupOk();
            break;
        case IPCEngineGuest::NotifyInferiorSetupFailed:
            notifyInferiorSetupFailed();
            break;
        case IPCEngineGuest::NotifyEngineRunAndInferiorRunOk:
            notifyEngineRunAndInferiorRunOk();
            break;
        case IPCEngineGuest::NotifyEngineRunAndInferiorStopOk:
            notifyEngineRunAndInferiorStopOk();
            break;
        case IPCEngineGuest::NotifyInferiorRunRequested:
            notifyInferiorRunRequested();
            break;
        case IPCEngineGuest::NotifyInferiorRunOk:
            notifyInferiorRunOk();
            break;
        case IPCEngineGuest::NotifyInferiorRunFailed:
            notifyInferiorRunFailed();
            break;
        case IPCEngineGuest::NotifyInferiorStopOk:
            notifyInferiorStopOk();
            break;
        case IPCEngineGuest::NotifyInferiorSpontaneousStop:
            notifyInferiorSpontaneousStop();
            break;
        case IPCEngineGuest::NotifyInferiorStopFailed:
            notifyInferiorStopFailed();
            break;
        case IPCEngineGuest::NotifyInferiorExited:
            notifyInferiorExited();
            break;
        case IPCEngineGuest::NotifyInferiorShutdownOk:
            notifyInferiorShutdownOk();
            break;
        case IPCEngineGuest::NotifyInferiorShutdownFailed:
            notifyInferiorShutdownFailed();
            break;
        case IPCEngineGuest::NotifyEngineSpontaneousShutdown:
            notifyEngineSpontaneousShutdown();
            break;
        case IPCEngineGuest::NotifyEngineShutdownOk:
            notifyEngineShutdownOk();
            break;
        case IPCEngineGuest::NotifyEngineShutdownFailed:
            notifyEngineShutdownFailed();
            break;
        case IPCEngineGuest::NotifyInferiorIll:
            notifyInferiorIll();
            break;
        case IPCEngineGuest::NotifyEngineIll:
            notifyEngineIll();
            break;
        case IPCEngineGuest::NotifyInferiorPid:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                quint64 pid;
                s >> pid;
                notifyInferiorPid(pid);
            }
            break;
        case IPCEngineGuest::ShowStatusMessage:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                QString msg;
                qint64 timeout;
                s >> msg;
                s >> timeout;
                showStatusMessage(msg, timeout);
            }
            break;
        case IPCEngineGuest::ShowMessage:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                QString msg;
                qint16 channel;
                qint64 timeout;
                s >> msg;
                s >> channel;
                s >> timeout;
                showMessage(msg, channel, timeout);
            }
            break;
        case IPCEngineGuest::CurrentFrameChanged:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                quint64 token;
                s >> token;

                resetLocation();
                StackHandler *sh = stackHandler();
                sh->setCurrentIndex(token);
429
                if (!sh->currentFrame().isUsable() || QFileInfo(sh->currentFrame().file).exists())
430
                    gotoLocation(Location(sh->currentFrame(), true));
431
                else if (!m_sourceAgents.contains(sh->currentFrame().file))
432
                    fetchFrameSource(token);
433 434
                foreach(SourceAgent *agent, m_sourceAgents.values())
                    agent->updateLocationMarker();
435 436 437 438 439 440 441 442
            }
            break;
        case IPCEngineGuest::CurrentThreadChanged:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                quint64 token;
                s >> token;
hjk's avatar
hjk committed
443
                threadsHandler()->setCurrentThread(ThreadId(token));
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
            }
            break;
        case IPCEngineGuest::ListFrames:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                StackFrames frames;
                s >> frames;
                stackHandler()->setFrames(frames);
            }
            break;
        case IPCEngineGuest::ListThreads:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                Threads threads;
                s >> threads;
                threadsHandler()->setThreads(threads);
            }
            break;
        case IPCEngineGuest::Disassembled:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                quint64 pc;
469
                DisassemblerLines lines;
470
                s >> pc;
471
                s >> lines;
472
                DisassemblerAgent *view = m_frameToDisassemblerAgent.take(pc);
473 474
                if (view)
                    view->setContents(lines);
475 476 477 478 479 480 481 482 483 484 485
            }
            break;
        case IPCEngineGuest::UpdateWatchData:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                bool fullCycle;
                qint64 count;
                QList<WatchData> wd;
                s >> fullCycle;
                s >> count;
hjk's avatar
hjk committed
486
                for (qint64 i = 0; i < count; ++i) {
487 488 489 490 491 492 493
                    WatchData d;
                    s >> d;
                    wd.append(d);
                }
                WatchHandler *wh = watchHandler();
                if (!wh)
                    break;
hjk's avatar
hjk committed
494
                wh->insertData(wd);
495 496 497 498
            }
            break;
        case IPCEngineGuest::NotifyAddBreakpointOk:
            {
499
                attemptBreakpointSynchronization();
500 501
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
hjk's avatar
hjk committed
502 503
                quint64 d;
                s >> d;
504
                BreakpointModelId id = BreakpointModelId::fromInternalId(d);
Arvid Ephraim Picciani's avatar
Arvid Ephraim Picciani committed
505
                breakHandler()->notifyBreakpointInsertOk(id);
506
            }
507
            break;
508 509 510 511
        case IPCEngineGuest::NotifyAddBreakpointFailed:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
hjk's avatar
hjk committed
512 513
                quint64 d;
                s >> d;
514
                BreakpointModelId id = BreakpointModelId::fromInternalId(d);
Arvid Ephraim Picciani's avatar
Arvid Ephraim Picciani committed
515
                breakHandler()->notifyBreakpointInsertFailed(id);
516
            }
517
            break;
518 519 520 521
        case IPCEngineGuest::NotifyRemoveBreakpointOk:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
hjk's avatar
hjk committed
522 523
                quint64 d;
                s >> d;
524
                BreakpointModelId id = BreakpointModelId::fromInternalId(d);
Arvid Ephraim Picciani's avatar
Arvid Ephraim Picciani committed
525
                breakHandler()->notifyBreakpointRemoveOk(id);
526
            }
527
            break;
528 529 530 531
        case IPCEngineGuest::NotifyRemoveBreakpointFailed:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
hjk's avatar
hjk committed
532 533
                quint64 d;
                s >> d;
534
                BreakpointModelId id = BreakpointModelId::fromInternalId(d);
Arvid Ephraim Picciani's avatar
Arvid Ephraim Picciani committed
535
                breakHandler()->notifyBreakpointRemoveFailed(id);
536
            }
537
            break;
538 539 540 541
        case IPCEngineGuest::NotifyChangeBreakpointOk:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
hjk's avatar
hjk committed
542 543
                quint64 d;
                s >> d;
544
                BreakpointModelId id = BreakpointModelId::fromInternalId(d);
Arvid Ephraim Picciani's avatar
Arvid Ephraim Picciani committed
545
                breakHandler()->notifyBreakpointChangeOk(id);
546
            }
547
            break;
548 549 550 551
        case IPCEngineGuest::NotifyChangeBreakpointFailed:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
hjk's avatar
hjk committed
552 553
                quint64 d;
                s >> d;
554
                BreakpointModelId id = BreakpointModelId::fromInternalId(d);
Arvid Ephraim Picciani's avatar
Arvid Ephraim Picciani committed
555
                breakHandler()->notifyBreakpointChangeFailed(id);
556
            }
557
            break;
558 559 560 561
        case IPCEngineGuest::NotifyBreakpointAdjusted:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
hjk's avatar
hjk committed
562
                quint64 dd;
563
                BreakpointParameters d;
hjk's avatar
hjk committed
564
                s >> dd >> d;
565
                BreakpointModelId id = BreakpointModelId::fromInternalId(dd);
Arvid Ephraim Picciani's avatar
Arvid Ephraim Picciani committed
566
                breakHandler()->notifyBreakpointAdjusted(id, d);
567
            }
568
            break;
569 570 571 572 573
        case IPCEngineGuest::FrameSourceFetched:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                qint64 token;
574
                QString path;
575
                QString source;
576 577 578 579 580 581
                s >> token >> path >> source;
                SourceAgent *agent = new SourceAgent(this);
                agent->setSourceProducerName(startParameters().connParams.host);
                agent->setContent(path, source);
                m_sourceAgents.insert(path, agent);
                agent->updateLocationMarker();
582 583
            }
            break;
584 585 586
    }
}

587
void IPCEngineHost::m_stateChanged(Debugger::DebuggerState state)
588 589 590 591 592 593 594 595 596 597 598 599 600
{
    QByteArray p;
    {
        QDataStream s(&p, QIODevice::WriteOnly);
        SET_NATIVE_BYTE_ORDER(s);
        s << (qint64)state;
    }
    rpcCall(StateChanged, p);

}

void IPCEngineHost::rpcCall(Function f, QByteArray payload)
{
hjk's avatar
hjk committed
601 602
    if (m_localGuest) {
        QMetaObject::invokeMethod(m_localGuest,
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618
                "rpcCallback",
                Qt::QueuedConnection,
                Q_ARG(quint64, f),
                Q_ARG(QByteArray, payload));
    } else if (m_device) {
        QByteArray header;
        {
            QDataStream s(&header, QIODevice::WriteOnly);
            SET_NATIVE_BYTE_ORDER(s);
            s << m_cookie++;
            s << (quint64) f;
            s << (quint64) payload.size();
        }
        m_device->write(header);
        m_device->write(payload);
        m_device->putChar('T');
619 620 621
        QLocalSocket *sock = qobject_cast<QLocalSocket *>(m_device);
        if (sock)
            sock->flush();
622 623 624 625 626 627 628 629
    }
}

void IPCEngineHost::readyRead()
{
    QDataStream s(m_device);
    SET_NATIVE_BYTE_ORDER(s);
    if (!m_nextMessagePayloadSize) {
hjk's avatar
hjk committed
630
        if (quint64(m_device->bytesAvailable ()) < 3 * sizeof(quint64))
631 632 633 634
            return;
        s >> m_nextMessageCookie;
        s >> m_nextMessageFunction;
        s >> m_nextMessagePayloadSize;
hjk's avatar
hjk committed
635
        m_nextMessagePayloadSize += 1; // Terminator and "got header" marker.
636 637 638 639 640 641 642 643 644 645 646
    }

    quint64 ba = m_device->bytesAvailable();
    if (ba < m_nextMessagePayloadSize)
        return;

    QByteArray payload = m_device->read(m_nextMessagePayloadSize - 1);

    char terminator;
    m_device->getChar(&terminator);
    if (terminator != 'T') {
Jarek Kobus's avatar
Jarek Kobus committed
647
        showStatusMessage(tr("Fatal engine shutdown. Incompatible binary or IPC error."));
648
        showMessage(QLatin1String("IPC Error: terminator missing"));
649
        nuke();
650 651 652 653
        return;
    }
    rpcCallback(m_nextMessageFunction, payload);
    m_nextMessagePayloadSize = 0;
hjk's avatar
hjk committed
654
    if (quint64(m_device->bytesAvailable()) >= 3 * sizeof(quint64))
655 656 657 658 659 660 661
        QTimer::singleShot(0, this, SLOT(readyRead()));
}

} // namespace Internal
} // namespace Debugger