2011-02-18 10:36:52 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2011-02-18 10:36:52 +01:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2011-02-18 10:36:52 +01:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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.
|
2011-02-18 10:36:52 +01:00
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2011-02-18 10:36:52 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2011-02-18 10:36:52 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2011-02-18 10:36:52 +01:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
2010-08-18 13:54:12 +02:00
|
|
|
|
2011-01-14 17:08:59 +01:00
|
|
|
#include "qmlcppengine.h"
|
2011-02-24 16:50:15 +01:00
|
|
|
#include "debuggerruncontrolfactory.h"
|
2011-01-14 17:08:59 +01:00
|
|
|
#include "debuggercore.h"
|
|
|
|
|
#include "debuggerstartparameters.h"
|
2011-01-19 17:34:28 +01:00
|
|
|
#include "stackhandler.h"
|
2011-02-21 17:01:40 +01:00
|
|
|
#include "qmlengine.h"
|
2012-02-15 12:35:43 +01:00
|
|
|
#include "qtmessageloghandler.h"
|
2010-08-18 13:54:12 +02:00
|
|
|
|
2011-09-16 15:00:41 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2011-01-14 14:25:02 +01:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QMainWindow>
|
2011-07-12 14:18:48 +02:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
namespace Debugger {
|
2011-01-11 11:06:15 +01:00
|
|
|
namespace Internal {
|
2010-08-18 13:54:12 +02:00
|
|
|
|
2011-01-19 10:48:39 +01:00
|
|
|
enum { debug = 0 };
|
|
|
|
|
|
|
|
|
|
#define EDEBUG(s) do { if (debug) qDebug() << s; } while (0)
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
const int ConnectionWaitTimeMs = 5000;
|
|
|
|
|
|
2011-02-21 17:01:40 +01:00
|
|
|
QmlEngine *createQmlEngine(const DebuggerStartParameters &,
|
2011-01-12 12:10:12 +01:00
|
|
|
DebuggerEngine *masterEngine);
|
2010-08-18 13:54:12 +02:00
|
|
|
|
2011-02-24 16:50:15 +01:00
|
|
|
DebuggerEngine *createQmlCppEngine(const DebuggerStartParameters &sp,
|
|
|
|
|
DebuggerEngineType slaveEngineType,
|
|
|
|
|
QString *errorMessage)
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
QmlCppEngine *newEngine = new QmlCppEngine(sp, slaveEngineType, errorMessage);
|
2010-10-27 15:23:30 +02:00
|
|
|
if (newEngine->cppEngine())
|
2010-10-06 17:18:31 +02:00
|
|
|
return newEngine;
|
2010-10-27 15:23:30 +02:00
|
|
|
delete newEngine;
|
|
|
|
|
return 0;
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
2010-10-27 15:23:30 +02:00
|
|
|
|
2011-01-19 17:34:28 +01:00
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// QmlCppEnginePrivate
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class QmlCppEnginePrivate : public QObject
|
2010-11-22 10:20:31 +01:00
|
|
|
{
|
2011-01-19 17:34:28 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
2010-11-15 17:09:28 +01:00
|
|
|
public:
|
2011-01-19 17:34:28 +01:00
|
|
|
QmlCppEnginePrivate(QmlCppEngine *parent,
|
|
|
|
|
const DebuggerStartParameters &sp);
|
2010-11-15 17:09:28 +01:00
|
|
|
~QmlCppEnginePrivate() {}
|
2010-09-13 13:30:35 +02:00
|
|
|
|
2010-11-15 17:09:28 +01:00
|
|
|
private:
|
2011-01-19 17:34:28 +01:00
|
|
|
friend class QmlCppEngine;
|
|
|
|
|
QmlCppEngine *q;
|
2011-02-21 17:01:40 +01:00
|
|
|
QmlEngine *m_qmlEngine;
|
2010-09-13 13:30:35 +02:00
|
|
|
DebuggerEngine *m_cppEngine;
|
|
|
|
|
DebuggerEngine *m_activeEngine;
|
|
|
|
|
};
|
|
|
|
|
|
2011-01-19 17:34:28 +01:00
|
|
|
|
|
|
|
|
QmlCppEnginePrivate::QmlCppEnginePrivate(QmlCppEngine *parent,
|
|
|
|
|
const DebuggerStartParameters &sp)
|
2011-02-24 16:50:15 +01:00
|
|
|
: q(parent), m_qmlEngine(createQmlEngine(sp, q)),
|
2011-09-16 15:00:41 +02:00
|
|
|
m_cppEngine(0), m_activeEngine(0)
|
2010-09-13 13:30:35 +02:00
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
setObjectName(QLatin1String("QmlCppEnginePrivate"));
|
2011-01-19 17:34:28 +01:00
|
|
|
}
|
2011-01-14 14:25:02 +01:00
|
|
|
|
2011-01-19 17:34:28 +01:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// QmlCppEngine
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2011-02-24 16:50:15 +01:00
|
|
|
QmlCppEngine::QmlCppEngine(const DebuggerStartParameters &sp,
|
|
|
|
|
DebuggerEngineType slaveEngineType,
|
|
|
|
|
QString *errorMessage)
|
2011-10-12 16:28:33 +02:00
|
|
|
: DebuggerEngine(sp, DebuggerLanguages(CppLanguage) | QmlLanguage), d(new QmlCppEnginePrivate(this, sp))
|
2011-01-19 17:34:28 +01:00
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
setObjectName(QLatin1String("QmlCppEngine"));
|
|
|
|
|
d->m_cppEngine = DebuggerRunControlFactory::createEngine(slaveEngineType, sp, this, errorMessage);
|
|
|
|
|
if (!d->m_cppEngine) {
|
2011-03-01 17:07:15 +01:00
|
|
|
*errorMessage = tr("The slave debugging engine required for combined QML/C++-Debugging could not be created: %1").arg(*errorMessage);
|
2011-02-24 16:50:15 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
d->m_activeEngine = d->m_cppEngine;
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QmlCppEngine::~QmlCppEngine()
|
|
|
|
|
{
|
2010-11-16 16:17:16 +01:00
|
|
|
delete d->m_qmlEngine;
|
|
|
|
|
delete d->m_cppEngine;
|
2011-09-16 15:00:41 +02:00
|
|
|
delete d;
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-17 10:08:57 +01:00
|
|
|
bool QmlCppEngine::setToolTipExpression(const QPoint & mousePos,
|
2011-02-11 15:00:13 +01:00
|
|
|
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2011-02-17 10:08:57 +01:00
|
|
|
return d->m_activeEngine->setToolTipExpression(mousePos, editor, ctx);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-26 10:10:00 +01:00
|
|
|
void QmlCppEngine::updateWatchData(const WatchData &data,
|
|
|
|
|
const WatchUpdateFlags &flags)
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_activeEngine->updateWatchData(data, flags);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::watchPoint(const QPoint &point)
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_cppEngine->watchPoint(point);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2010-12-14 12:29:32 +01:00
|
|
|
void QmlCppEngine::fetchMemory(MemoryAgent *ma, QObject *obj,
|
2010-08-18 13:54:12 +02:00
|
|
|
quint64 addr, quint64 length)
|
|
|
|
|
{
|
2010-12-14 12:29:32 +01:00
|
|
|
d->m_cppEngine->fetchMemory(ma, obj, addr, length);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2010-12-14 12:29:32 +01:00
|
|
|
void QmlCppEngine::fetchDisassembler(DisassemblerAgent *da)
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2010-12-14 12:29:32 +01:00
|
|
|
d->m_cppEngine->fetchDisassembler(da);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::activateFrame(int index)
|
|
|
|
|
{
|
2011-10-17 17:45:15 +02:00
|
|
|
if (state() != InferiorStopOk && state() != InferiorUnrunnable)
|
|
|
|
|
return;
|
|
|
|
|
|
2012-02-23 17:14:46 +01:00
|
|
|
d->m_activeEngine->activateFrame(index);
|
|
|
|
|
|
2011-02-02 13:35:42 +01:00
|
|
|
stackHandler()->setCurrentIndex(index);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::reloadModules()
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_cppEngine->reloadModules();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::examineModules()
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_cppEngine->examineModules();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::loadSymbols(const QString &moduleName)
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_cppEngine->loadSymbols(moduleName);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::loadAllSymbols()
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_cppEngine->loadAllSymbols();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::requestModuleSymbols(const QString &moduleName)
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_cppEngine->requestModuleSymbols(moduleName);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::reloadRegisters()
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_cppEngine->reloadRegisters();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::reloadSourceFiles()
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_cppEngine->reloadSourceFiles();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::reloadFullStack()
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_cppEngine->reloadFullStack();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::setRegisterValue(int regnr, const QString &value)
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_cppEngine->setRegisterValue(regnr, value);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2012-01-12 20:28:17 +01:00
|
|
|
|
|
|
|
|
bool QmlCppEngine::hasCapability(unsigned cap) const
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
|
|
|
|
// ### this could also be an OR of both engines' capabilities
|
2012-01-12 20:28:17 +01:00
|
|
|
bool hasCap = d->m_cppEngine->hasCapability(cap);
|
2011-08-04 14:25:38 +02:00
|
|
|
if (d->m_activeEngine != d->m_cppEngine) {
|
2012-03-29 11:03:54 +02:00
|
|
|
//Some capabilities cannot be handled by QML Engine
|
|
|
|
|
//Expand this list as and when required
|
2012-01-12 20:28:17 +01:00
|
|
|
if (cap == AddWatcherWhileRunningCapability)
|
|
|
|
|
hasCap = hasCap || d->m_qmlEngine->hasCapability(cap);
|
2012-03-29 11:03:54 +02:00
|
|
|
if (cap == WatchWidgetsCapability ||
|
|
|
|
|
cap == DisassemblerCapability ||
|
|
|
|
|
cap == OperateByInstructionCapability ||
|
|
|
|
|
cap == ReverseSteppingCapability)
|
2012-01-12 20:28:17 +01:00
|
|
|
hasCap = hasCap && d->m_qmlEngine->hasCapability(cap);
|
2011-08-04 14:25:38 +02:00
|
|
|
}
|
2012-01-12 20:28:17 +01:00
|
|
|
return hasCap;
|
2011-02-28 10:58:21 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-30 07:52:41 +02:00
|
|
|
bool QmlCppEngine::isSynchronous() const
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
return d->m_activeEngine->isSynchronous();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2010-09-01 17:36:09 +02:00
|
|
|
QByteArray QmlCppEngine::qtNamespace() const
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
return d->m_cppEngine->qtNamespace();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::createSnapshot()
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_cppEngine->createSnapshot();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::updateAll()
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_activeEngine->updateAll();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::attemptBreakpointSynchronization()
|
|
|
|
|
{
|
2011-09-29 16:49:18 +02:00
|
|
|
d->m_cppEngine->attemptBreakpointSynchronization();
|
|
|
|
|
|
|
|
|
|
switch (d->m_qmlEngine->state()) {
|
|
|
|
|
case InferiorRunOk:
|
|
|
|
|
case InferiorRunRequested:
|
|
|
|
|
case InferiorStopOk: // fall through
|
|
|
|
|
case InferiorStopRequested:
|
|
|
|
|
d->m_qmlEngine->attemptBreakpointSynchronization();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2011-08-03 14:48:56 +02:00
|
|
|
}
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:25:30 +02:00
|
|
|
bool QmlCppEngine::acceptsBreakpoint(BreakpointModelId id) const
|
2010-10-05 11:01:14 +02:00
|
|
|
{
|
2010-11-10 16:33:11 +01:00
|
|
|
return d->m_cppEngine->acceptsBreakpoint(id)
|
|
|
|
|
|| d->m_qmlEngine->acceptsBreakpoint(id);
|
2010-10-05 11:01:14 +02:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
void QmlCppEngine::selectThread(int index)
|
|
|
|
|
{
|
2012-03-26 17:30:57 +02:00
|
|
|
d->m_activeEngine->selectThread(index);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-26 10:10:00 +01:00
|
|
|
void QmlCppEngine::assignValueInDebugger(const WatchData *data,
|
|
|
|
|
const QString &expr, const QVariant &value)
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2010-11-26 10:10:00 +01:00
|
|
|
d->m_activeEngine->assignValueInDebugger(data, expr, value);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-23 12:33:04 +01:00
|
|
|
void QmlCppEngine::notifyInferiorIll()
|
|
|
|
|
{
|
|
|
|
|
//This will eventually shutdown the engine
|
|
|
|
|
//Set final state to avoid quitDebugger() being called
|
|
|
|
|
//after this call
|
|
|
|
|
setTargetState(DebuggerFinished);
|
|
|
|
|
|
|
|
|
|
//Call notifyInferiorIll of cpp engine
|
|
|
|
|
//as qml engine will follow state transitions
|
|
|
|
|
//of cpp engine
|
|
|
|
|
d->m_cppEngine->notifyInferiorIll();
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
void QmlCppEngine::detachDebugger()
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_qmlEngine->detachDebugger();
|
|
|
|
|
d->m_cppEngine->detachDebugger();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::executeStep()
|
2011-01-14 17:08:59 +01:00
|
|
|
{
|
2011-10-13 11:06:07 +02:00
|
|
|
// TODO: stepping from qml -> cpp requires more thought
|
|
|
|
|
// if (d->m_activeEngine == d->m_qmlEngine) {
|
|
|
|
|
// QTC_CHECK(d->m_cppEngine->state() == InferiorRunOk);
|
|
|
|
|
// if (d->m_cppEngine->setupQmlStep(true))
|
|
|
|
|
// return; // Wait for callback to readyToExecuteQmlStep()
|
|
|
|
|
// } else {
|
|
|
|
|
// notifyInferiorRunRequested();
|
|
|
|
|
// d->m_cppEngine->executeStep();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
notifyInferiorRunRequested();
|
|
|
|
|
d->m_activeEngine->executeStep();
|
2011-01-14 17:08:59 +01:00
|
|
|
}
|
|
|
|
|
|
2011-01-19 14:34:25 +01:00
|
|
|
void QmlCppEngine::readyToExecuteQmlStep()
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2011-01-14 14:25:02 +01:00
|
|
|
notifyInferiorRunRequested();
|
2011-01-19 14:34:25 +01:00
|
|
|
d->m_qmlEngine->executeStep();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::executeStepOut()
|
|
|
|
|
{
|
2011-01-14 14:25:02 +01:00
|
|
|
notifyInferiorRunRequested();
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_activeEngine->executeStepOut();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::executeNext()
|
|
|
|
|
{
|
2011-01-14 14:25:02 +01:00
|
|
|
notifyInferiorRunRequested();
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_activeEngine->executeNext();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::executeStepI()
|
|
|
|
|
{
|
2011-01-14 14:25:02 +01:00
|
|
|
notifyInferiorRunRequested();
|
2011-01-12 12:10:12 +01:00
|
|
|
d->m_activeEngine->executeStepI();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::executeNextI()
|
|
|
|
|
{
|
2011-01-14 14:25:02 +01:00
|
|
|
notifyInferiorRunRequested();
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_activeEngine->executeNextI();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::executeReturn()
|
|
|
|
|
{
|
2011-01-14 14:25:02 +01:00
|
|
|
notifyInferiorRunRequested();
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_activeEngine->executeReturn();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::continueInferior()
|
|
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("\nMASTER CONTINUE INFERIOR"
|
|
|
|
|
<< d->m_cppEngine->state() << d->m_qmlEngine->state());
|
2011-01-14 14:25:02 +01:00
|
|
|
notifyInferiorRunRequested();
|
|
|
|
|
if (d->m_cppEngine->state() == InferiorStopOk) {
|
|
|
|
|
d->m_cppEngine->continueInferior();
|
|
|
|
|
} else if (d->m_qmlEngine->state() == InferiorStopOk) {
|
|
|
|
|
d->m_qmlEngine->continueInferior();
|
2010-11-15 17:09:28 +01:00
|
|
|
} else {
|
2011-01-14 14:25:02 +01:00
|
|
|
QTC_ASSERT(false, qDebug() << "MASTER CANNOT CONTINUE INFERIOR"
|
|
|
|
|
<< d->m_cppEngine->state() << d->m_qmlEngine->state());
|
|
|
|
|
notifyEngineIll();
|
2010-11-15 17:09:28 +01:00
|
|
|
}
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::interruptInferior()
|
|
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("\nMASTER INTERRUPT INFERIOR");
|
2011-04-18 16:49:41 +02:00
|
|
|
d->m_cppEngine->requestInterruptInferior();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::requestInterruptInferior()
|
|
|
|
|
{
|
2011-02-25 15:27:13 +01:00
|
|
|
EDEBUG("\nMASTER REQUEST INTERRUPT INFERIOR");
|
2010-11-15 17:09:28 +01:00
|
|
|
DebuggerEngine::requestInterruptInferior();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-23 10:16:11 +01:00
|
|
|
void QmlCppEngine::executeRunToLine(const ContextData &data)
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2011-02-23 10:16:11 +01:00
|
|
|
d->m_activeEngine->executeRunToLine(data);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::executeRunToFunction(const QString &functionName)
|
|
|
|
|
{
|
2010-09-13 13:30:35 +02:00
|
|
|
d->m_activeEngine->executeRunToFunction(functionName);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-23 10:16:11 +01:00
|
|
|
void QmlCppEngine::executeJumpToLine(const ContextData &data)
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2011-02-23 10:16:11 +01:00
|
|
|
d->m_activeEngine->executeJumpToLine(data);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::executeDebuggerCommand(const QString &command)
|
|
|
|
|
{
|
2011-08-10 17:03:33 +02:00
|
|
|
if (d->m_qmlEngine->state() == InferiorStopOk) {
|
|
|
|
|
d->m_qmlEngine->executeDebuggerCommand(command);
|
|
|
|
|
} else {
|
|
|
|
|
d->m_cppEngine->executeDebuggerCommand(command);
|
|
|
|
|
}
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-15 12:35:43 +01:00
|
|
|
bool QmlCppEngine::evaluateScriptExpression(const QString &expression)
|
|
|
|
|
{
|
|
|
|
|
return d->m_qmlEngine->evaluateScriptExpression(expression);
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-15 17:09:28 +01:00
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
|
|
2011-01-14 14:25:02 +01:00
|
|
|
void QmlCppEngine::setupEngine()
|
2010-11-15 17:09:28 +01:00
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("\nMASTER SETUP ENGINE");
|
2011-02-08 16:17:13 +01:00
|
|
|
d->m_activeEngine = d->m_cppEngine;
|
2011-01-14 18:16:40 +01:00
|
|
|
d->m_qmlEngine->setupSlaveEngine();
|
|
|
|
|
d->m_cppEngine->setupSlaveEngine();
|
2012-01-31 13:23:05 +01:00
|
|
|
|
|
|
|
|
if (startParameters().requestRemoteSetup)
|
|
|
|
|
notifyEngineRequestRemoteSetup();
|
2011-01-14 14:25:02 +01:00
|
|
|
}
|
2010-11-15 17:09:28 +01:00
|
|
|
|
2011-01-14 14:25:02 +01:00
|
|
|
void QmlCppEngine::notifyEngineRunAndInferiorRunOk()
|
|
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("\nMASTER NOTIFY ENGINE RUN AND INFERIOR RUN OK");
|
2011-01-14 14:25:02 +01:00
|
|
|
DebuggerEngine::notifyEngineRunAndInferiorRunOk();
|
2010-11-15 17:09:28 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
void QmlCppEngine::notifyInferiorRunOk()
|
|
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("\nMASTER NOTIFY INFERIOR RUN OK");
|
2010-08-18 13:54:12 +02:00
|
|
|
DebuggerEngine::notifyInferiorRunOk();
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-14 14:25:02 +01:00
|
|
|
void QmlCppEngine::notifyInferiorSpontaneousStop()
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("\nMASTER SPONTANEOUS STOP OK");
|
2011-01-14 14:25:02 +01:00
|
|
|
DebuggerEngine::notifyInferiorSpontaneousStop();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2011-01-14 14:25:02 +01:00
|
|
|
void QmlCppEngine::notifyInferiorShutdownOk()
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("\nMASTER INFERIOR SHUTDOWN OK");
|
2011-01-14 14:25:02 +01:00
|
|
|
DebuggerEngine::notifyInferiorShutdownOk();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2011-01-14 14:25:02 +01:00
|
|
|
void QmlCppEngine::setupInferior()
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("\nMASTER SETUP INFERIOR");
|
2011-01-14 18:16:40 +01:00
|
|
|
d->m_qmlEngine->setupSlaveInferior();
|
|
|
|
|
d->m_cppEngine->setupSlaveInferior();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2011-01-14 14:25:02 +01:00
|
|
|
void QmlCppEngine::runEngine()
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("\nMASTER RUN ENGINE");
|
2011-01-14 18:16:40 +01:00
|
|
|
d->m_qmlEngine->runSlaveEngine();
|
|
|
|
|
d->m_cppEngine->runSlaveEngine();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2011-01-14 14:25:02 +01:00
|
|
|
void QmlCppEngine::shutdownInferior()
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("\nMASTER SHUTDOWN INFERIOR");
|
2012-03-02 10:59:55 +01:00
|
|
|
d->m_cppEngine->shutdownInferior();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-15 17:09:28 +01:00
|
|
|
void QmlCppEngine::shutdownEngine()
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("\nMASTER SHUTDOWN ENGINE");
|
2011-01-14 18:16:40 +01:00
|
|
|
d->m_cppEngine->shutdownSlaveEngine();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2012-01-19 14:42:16 +01:00
|
|
|
void QmlCppEngine::quitDebugger()
|
|
|
|
|
{
|
|
|
|
|
EDEBUG("\nMASTER QUIT DEBUGGER");
|
|
|
|
|
d->m_cppEngine->quitDebugger();
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-18 14:58:01 +01:00
|
|
|
void QmlCppEngine::abortDebugger()
|
|
|
|
|
{
|
|
|
|
|
EDEBUG("\nMASTER ABORT DEBUGGER");
|
|
|
|
|
d->m_cppEngine->abortDebugger();
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-14 14:25:02 +01:00
|
|
|
void QmlCppEngine::setState(DebuggerState newState, bool forced)
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("SET MASTER STATE: " << newState);
|
|
|
|
|
EDEBUG(" CPP STATE: " << d->m_cppEngine->state());
|
|
|
|
|
EDEBUG(" QML STATE: " << d->m_qmlEngine->state());
|
2011-01-14 14:25:02 +01:00
|
|
|
DebuggerEngine::setState(newState, forced);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2011-01-14 14:25:02 +01:00
|
|
|
void QmlCppEngine::slaveEngineStateChanged
|
|
|
|
|
(DebuggerEngine *slaveEngine, const DebuggerState newState)
|
2010-11-15 17:09:28 +01:00
|
|
|
{
|
2012-01-31 13:23:05 +01:00
|
|
|
DebuggerEngine *otherEngine = (slaveEngine == d->m_cppEngine)
|
|
|
|
|
? d->m_qmlEngine : d->m_cppEngine;
|
|
|
|
|
|
|
|
|
|
QTC_CHECK(otherEngine != slaveEngine);
|
2010-08-18 13:54:12 +02:00
|
|
|
|
2012-01-31 13:23:05 +01:00
|
|
|
if (debug) {
|
2011-10-20 18:37:38 +02:00
|
|
|
EDEBUG("GOT SLAVE STATE: " << slaveEngine << newState);
|
|
|
|
|
EDEBUG(" OTHER ENGINE: " << otherEngine << otherEngine->state());
|
|
|
|
|
EDEBUG(" COMBINED ENGINE: " << this << state() << isDying());
|
|
|
|
|
}
|
2012-01-19 14:42:16 +01:00
|
|
|
|
|
|
|
|
// Idea is to follow the state of the cpp engine, except where we are stepping in QML.
|
|
|
|
|
// That is, when the QmlEngine moves between InferiorStopOk, and InferiorRunOk, InferiorStopOk ...
|
|
|
|
|
//
|
|
|
|
|
// Accordingly, the 'active engine' is the cpp engine until the qml engine enters the
|
|
|
|
|
// InferiorStopOk state. The cpp engine becomes the active one again as soon as it itself enters
|
|
|
|
|
// the InferiorStopOk state.
|
2011-01-14 14:25:02 +01:00
|
|
|
|
2011-09-29 16:49:18 +02:00
|
|
|
if (slaveEngine == d->m_cppEngine) {
|
|
|
|
|
switch (newState) {
|
2012-01-19 14:42:16 +01:00
|
|
|
case DebuggerNotReady: {
|
2011-09-29 16:49:18 +02:00
|
|
|
// Can this ever happen?
|
|
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case EngineSetupRequested: {
|
|
|
|
|
// set by queueSetupEngine()
|
|
|
|
|
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case EngineSetupFailed: {
|
2011-09-29 16:49:18 +02:00
|
|
|
qmlEngine()->quitDebugger();
|
|
|
|
|
notifyEngineSetupFailed();
|
|
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case EngineSetupOk: {
|
2010-11-15 17:09:28 +01:00
|
|
|
notifyEngineSetupOk();
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorSetupRequested: {
|
|
|
|
|
// set by queueSetupInferior()
|
|
|
|
|
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorSetupFailed: {
|
2011-09-29 16:49:18 +02:00
|
|
|
qmlEngine()->quitDebugger();
|
2011-02-02 10:42:32 +01:00
|
|
|
notifyInferiorSetupFailed();
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorSetupOk: {
|
2011-01-14 14:25:02 +01:00
|
|
|
notifyInferiorSetupOk();
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case EngineRunRequested: {
|
|
|
|
|
// set by queueRunEngine()
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case EngineRunFailed: {
|
2011-09-29 16:49:18 +02:00
|
|
|
qmlEngine()->quitDebugger();
|
2011-02-02 10:42:32 +01:00
|
|
|
notifyEngineRunFailed();
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorUnrunnable: {
|
|
|
|
|
qmlEngine()->quitDebugger();
|
2011-09-29 16:49:18 +02:00
|
|
|
notifyInferiorUnrunnable();
|
|
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorRunRequested: {
|
|
|
|
|
// might be set already by notifyInferiorRunRequested()
|
|
|
|
|
QTC_ASSERT(state() == InferiorRunRequested
|
|
|
|
|
|| state() == InferiorStopOk, qDebug() << state());
|
|
|
|
|
if (state() != InferiorRunRequested)
|
|
|
|
|
notifyInferiorRunRequested();
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorRunOk: {
|
|
|
|
|
QTC_ASSERT(state() == EngineRunRequested
|
|
|
|
|
|| state() == InferiorRunRequested, qDebug() << state());
|
2011-09-29 16:49:18 +02:00
|
|
|
if (state() == EngineRunRequested)
|
2011-01-14 18:47:44 +01:00
|
|
|
notifyEngineRunAndInferiorRunOk();
|
2011-09-29 16:49:18 +02:00
|
|
|
else if (state() == InferiorRunRequested)
|
2011-01-14 18:47:44 +01:00
|
|
|
notifyInferiorRunOk();
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorRunFailed: {
|
2011-09-29 16:49:18 +02:00
|
|
|
qmlEngine()->quitDebugger();
|
|
|
|
|
notifyInferiorRunFailed();
|
|
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorStopRequested: {
|
|
|
|
|
if (d->m_activeEngine == cppEngine()) {
|
|
|
|
|
// might be set by doInterruptInferior()
|
|
|
|
|
QTC_ASSERT(state() == InferiorStopRequested
|
|
|
|
|
|| state() == InferiorRunOk, qDebug() << state());
|
|
|
|
|
if (state() == InferiorRunOk)
|
|
|
|
|
setState(InferiorStopRequested);
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
// we're debugging qml, but got an abort ...
|
|
|
|
|
QTC_ASSERT(state() == InferiorRunOk
|
|
|
|
|
|| state() == InferiorStopOk
|
|
|
|
|
|| state() == InferiorRunRequested, qDebug() << state());
|
|
|
|
|
|
|
|
|
|
if (state() == InferiorRunOk) {
|
|
|
|
|
setState(InferiorStopRequested);
|
|
|
|
|
} else if (state() == InferiorStopOk) {
|
|
|
|
|
notifyInferiorRunRequested();
|
|
|
|
|
notifyInferiorRunOk();
|
|
|
|
|
setState(InferiorStopRequested);
|
|
|
|
|
} else if (state() == InferiorRunRequested) {
|
|
|
|
|
notifyInferiorRunOk();
|
|
|
|
|
setState(InferiorStopRequested);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-01-14 14:25:02 +01:00
|
|
|
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorStopOk: {
|
2011-09-29 16:49:18 +02:00
|
|
|
if (isDying()) {
|
|
|
|
|
EDEBUG("... CPP ENGINE STOPPED DURING SHUTDOWN ");
|
2012-01-19 14:42:16 +01:00
|
|
|
QTC_ASSERT(state() == InferiorStopRequested
|
|
|
|
|
|| state() == InferiorRunOk
|
|
|
|
|
|| state() == InferiorStopOk, qDebug() << state());
|
|
|
|
|
|
|
|
|
|
// Just to make sure, we're shutting down anyway ...
|
|
|
|
|
d->m_activeEngine = cppEngine();
|
|
|
|
|
|
2011-09-29 16:49:18 +02:00
|
|
|
if (state() == InferiorStopRequested)
|
2012-01-19 14:42:16 +01:00
|
|
|
setState(InferiorStopOk);
|
|
|
|
|
// otherwise we're probably inside notifyInferiorStopOk already
|
2011-01-14 14:25:02 +01:00
|
|
|
} else {
|
2011-09-29 16:49:18 +02:00
|
|
|
if (d->m_activeEngine != cppEngine()) {
|
2011-10-06 17:05:38 +02:00
|
|
|
showStatusMessage(tr("C++ debugger activated"));
|
2011-09-29 16:49:18 +02:00
|
|
|
d->m_activeEngine = cppEngine();
|
|
|
|
|
}
|
2012-01-19 14:42:16 +01:00
|
|
|
|
|
|
|
|
QTC_ASSERT(state() == InferiorStopRequested
|
|
|
|
|
|| state() == InferiorRunRequested
|
|
|
|
|
|| state() == EngineRunRequested
|
|
|
|
|
|| state() == InferiorRunOk
|
|
|
|
|
|| state() == InferiorStopOk, qDebug() << state());
|
2011-09-29 16:49:18 +02:00
|
|
|
switch (state()) {
|
|
|
|
|
case InferiorStopRequested:
|
|
|
|
|
EDEBUG("... CPP ENGINE STOPPED EXPECTEDLY");
|
|
|
|
|
notifyInferiorStopOk();
|
|
|
|
|
break;
|
|
|
|
|
case EngineRunRequested:
|
|
|
|
|
EDEBUG("... CPP ENGINE STOPPED ON STARTUP");
|
|
|
|
|
notifyEngineRunAndInferiorStopOk();
|
|
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
case InferiorRunOk:
|
2011-09-29 16:49:18 +02:00
|
|
|
EDEBUG("... CPP ENGINE STOPPED SPONTANEOUSLY");
|
|
|
|
|
notifyInferiorSpontaneousStop();
|
|
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
case InferiorRunRequested:
|
|
|
|
|
// can happen if qml engine was active
|
|
|
|
|
notifyInferiorRunFailed();
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2011-09-29 16:49:18 +02:00
|
|
|
}
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorStopFailed: {
|
|
|
|
|
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state());
|
2011-09-29 16:49:18 +02:00
|
|
|
notifyInferiorStopFailed();
|
|
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorExitOk: {
|
2012-03-02 11:32:53 +01:00
|
|
|
// InferiorExitOk will be called through notifyInferiorExited
|
|
|
|
|
// when InferiorShutDownOk is reached
|
2012-03-06 09:10:57 +01:00
|
|
|
qmlEngine()->quitDebugger();
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorShutdownRequested: {
|
|
|
|
|
// might be set by queueShutdownInferior() already
|
|
|
|
|
QTC_ASSERT(state() == InferiorShutdownRequested
|
|
|
|
|
|| state() == InferiorStopOk, qDebug() << state());
|
|
|
|
|
if (state() == InferiorStopOk)
|
|
|
|
|
setState(InferiorShutdownRequested);
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorShutdownFailed: {
|
|
|
|
|
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
|
2011-09-29 16:49:18 +02:00
|
|
|
notifyInferiorShutdownFailed();
|
|
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case InferiorShutdownOk: {
|
2011-09-29 16:49:18 +02:00
|
|
|
if (state() == InferiorShutdownRequested)
|
2011-01-14 19:32:47 +01:00
|
|
|
notifyInferiorShutdownOk();
|
2012-03-02 11:32:53 +01:00
|
|
|
else {
|
|
|
|
|
// we got InferiorExitOk before, but ignored it ...
|
|
|
|
|
notifyInferiorExited();
|
|
|
|
|
}
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case EngineShutdownRequested: {
|
|
|
|
|
// set by queueShutdownEngine()
|
|
|
|
|
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state());
|
2012-03-06 09:10:57 +01:00
|
|
|
qmlEngine()->quitDebugger();
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
case EngineShutdownFailed: {
|
|
|
|
|
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state());
|
2011-09-29 16:49:18 +02:00
|
|
|
notifyEngineShutdownFailed();
|
|
|
|
|
break;
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
2011-09-29 16:49:18 +02:00
|
|
|
case EngineShutdownOk: {
|
2012-01-19 14:42:16 +01:00
|
|
|
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state());
|
2011-01-14 17:34:42 +01:00
|
|
|
notifyEngineShutdownOk();
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2012-01-19 14:42:16 +01:00
|
|
|
case DebuggerFinished: {
|
|
|
|
|
// set by queueFinishDebugger()
|
|
|
|
|
QTC_ASSERT(state() == DebuggerFinished, qDebug() << state());
|
2011-09-29 16:49:18 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
2011-09-29 16:49:18 +02:00
|
|
|
} else {
|
|
|
|
|
// QML engine state change
|
|
|
|
|
if (newState == InferiorStopOk) {
|
2012-01-19 14:42:16 +01:00
|
|
|
if (isDying()) {
|
|
|
|
|
EDEBUG("... QML ENGINE STOPPED DURING SHUTDOWN ");
|
|
|
|
|
|
|
|
|
|
// Just to make sure, we're shutting down anyway ...
|
|
|
|
|
d->m_activeEngine = cppEngine();
|
|
|
|
|
|
|
|
|
|
if (state() == InferiorStopRequested)
|
|
|
|
|
notifyInferiorStopOk();
|
|
|
|
|
// otherwise we're probably inside notifyInferiorStopOk already
|
|
|
|
|
} else {
|
|
|
|
|
if (d->m_activeEngine != qmlEngine()) {
|
|
|
|
|
showStatusMessage(tr("QML debugger activated"));
|
|
|
|
|
d->m_activeEngine = qmlEngine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QTC_ASSERT(state() == InferiorRunOk
|
|
|
|
|
|| state() == InferiorStopRequested, qDebug() << state());
|
|
|
|
|
|
|
|
|
|
if (state() == InferiorRunOk)
|
|
|
|
|
notifyInferiorSpontaneousStop();
|
|
|
|
|
else
|
|
|
|
|
notifyInferiorStopOk();
|
2011-09-29 16:49:18 +02:00
|
|
|
}
|
2012-01-19 14:42:16 +01:00
|
|
|
|
2011-09-29 16:49:18 +02:00
|
|
|
} else if (newState == InferiorRunOk) {
|
2012-01-19 14:42:16 +01:00
|
|
|
if (d->m_activeEngine == qmlEngine()) {
|
|
|
|
|
QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state());
|
2011-09-29 16:49:18 +02:00
|
|
|
notifyInferiorRunOk();
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
2012-02-23 13:03:22 +01:00
|
|
|
} else if (newState == EngineRunFailed) {
|
2012-03-02 11:32:53 +01:00
|
|
|
if (d->m_cppEngine->targetState() != DebuggerFinished)
|
|
|
|
|
d->m_cppEngine->quitDebugger();
|
2011-09-29 16:49:18 +02:00
|
|
|
}
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-10 12:41:44 +01:00
|
|
|
void QmlCppEngine::handleRemoteSetupDone(int gdbServerPort, int qmlPort)
|
|
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("MASTER REMOTE SETUP DONE");
|
2012-01-31 13:23:05 +01:00
|
|
|
notifyEngineRemoteSetupDone();
|
|
|
|
|
|
|
|
|
|
cppEngine()->handleRemoteSetupDone(gdbServerPort, qmlPort);
|
|
|
|
|
qmlEngine()->handleRemoteSetupDone(gdbServerPort, qmlPort);
|
2010-12-10 12:41:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::handleRemoteSetupFailed(const QString &message)
|
|
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("MASTER REMOTE SETUP FAILED");
|
2012-01-31 13:23:05 +01:00
|
|
|
notifyEngineRemoteSetupFailed();
|
|
|
|
|
|
|
|
|
|
cppEngine()->handleRemoteSetupFailed(message);
|
2010-12-10 12:41:44 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-21 17:01:40 +01:00
|
|
|
void QmlCppEngine::showMessage(const QString &msg, int channel, int timeout) const
|
|
|
|
|
{
|
2011-04-20 15:52:44 +02:00
|
|
|
if (channel == AppOutput || channel == AppError || channel == AppStuff) {
|
2011-02-21 17:01:40 +01:00
|
|
|
// message is from CppEngine, allow qml engine to process
|
|
|
|
|
d->m_qmlEngine->filterApplicationMessage(msg, channel);
|
|
|
|
|
}
|
|
|
|
|
DebuggerEngine::showMessage(msg, channel, timeout);
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-12 17:26:18 +02:00
|
|
|
void QmlCppEngine::resetLocation()
|
|
|
|
|
{
|
|
|
|
|
if (d->m_qmlEngine)
|
|
|
|
|
d->m_qmlEngine->resetLocation();
|
|
|
|
|
if (d->m_cppEngine)
|
|
|
|
|
d->m_cppEngine->resetLocation();
|
2011-10-17 17:45:15 +02:00
|
|
|
|
|
|
|
|
DebuggerEngine::resetLocation();
|
2011-10-12 17:26:18 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-15 12:35:43 +01:00
|
|
|
Internal::QtMessageLogHandler *QmlCppEngine::qtMessageLogHandler() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_qmlEngine->qtMessageLogHandler();
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
DebuggerEngine *QmlCppEngine::cppEngine() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_cppEngine;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-21 16:39:45 +02:00
|
|
|
DebuggerEngine *QmlCppEngine::qmlEngine() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_qmlEngine;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-03 12:07:32 +01:00
|
|
|
} // namespace Internal
|
2010-08-18 13:54:12 +02:00
|
|
|
} // namespace Debugger
|
2011-01-19 17:34:28 +01:00
|
|
|
|
|
|
|
|
#include "qmlcppengine.moc"
|