2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-02-18 10:36:52 +01:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-02-18 10:36:52 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-02-18 10:36:52 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
2011-02-18 10:36:52 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2011-02-18 10:36:52 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02: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 "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-11-23 13:35:44 +01:00
|
|
|
#include "watchhandler.h"
|
2010-08-18 13:54:12 +02:00
|
|
|
|
2011-01-14 14:25:02 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2013-03-26 11:32:14 +01:00
|
|
|
#include <texteditor/itexteditor.h>
|
2012-03-30 15:30:46 +02:00
|
|
|
#include <qmljseditor/qmljseditorconstants.h>
|
|
|
|
|
#include <cppeditor/cppeditorconstants.h>
|
2012-10-08 13:17:10 +02:00
|
|
|
#include <qmljs/consolemanagerinterface.h>
|
2011-01-14 14:25:02 +01: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-24 16:50:15 +01:00
|
|
|
DebuggerEngine *createQmlCppEngine(const DebuggerStartParameters &sp,
|
|
|
|
|
QString *errorMessage)
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2012-08-15 13:21:37 +02:00
|
|
|
QmlCppEngine *newEngine = new QmlCppEngine(sp, 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
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2012-08-15 14:33:39 +02:00
|
|
|
class QmlCppEnginePrivate
|
2010-11-22 10:20:31 +01:00
|
|
|
{
|
2010-11-15 17:09:28 +01:00
|
|
|
public:
|
2012-08-15 14:33:39 +02:00
|
|
|
QmlCppEnginePrivate() {}
|
2010-09-13 13:30:35 +02:00
|
|
|
|
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
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// QmlCppEngine
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2012-08-15 13:21:37 +02:00
|
|
|
QmlCppEngine::QmlCppEngine(const DebuggerStartParameters &sp, QString *errorMessage)
|
2012-08-15 14:33:39 +02:00
|
|
|
: DebuggerEngine(sp)
|
2011-01-19 17:34:28 +01:00
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
setObjectName(QLatin1String("QmlCppEngine"));
|
2012-08-15 14:33:39 +02:00
|
|
|
d = new QmlCppEnginePrivate;
|
2012-11-27 17:16:57 +01:00
|
|
|
d->m_qmlEngine = new QmlEngine(sp, this);
|
2012-08-15 14:33:39 +02:00
|
|
|
d->m_cppEngine = DebuggerRunControlFactory::createEngine(sp.firstSlaveEngineType, sp, errorMessage);
|
|
|
|
|
d->m_cppEngine->setMasterEngine(this);
|
2011-02-24 16:50:15 +01:00
|
|
|
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;
|
|
|
|
|
}
|
2012-04-13 17:14:10 +02:00
|
|
|
setActiveEngine(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
|
|
|
}
|
|
|
|
|
|
2012-03-30 15:30:46 +02:00
|
|
|
bool QmlCppEngine::canDisplayTooltip() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_cppEngine->canDisplayTooltip() || d->m_qmlEngine->canDisplayTooltip();
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
{
|
2012-03-30 15:30:46 +02:00
|
|
|
bool success = false;
|
|
|
|
|
if (editor->id() == CppEditor::Constants::CPPEDITOR_ID)
|
|
|
|
|
success = d->m_cppEngine->setToolTipExpression(mousePos, editor, ctx);
|
|
|
|
|
else if (editor->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID)
|
|
|
|
|
success = d->m_qmlEngine->setToolTipExpression(mousePos, editor, ctx);
|
|
|
|
|
return success;
|
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
|
|
|
{
|
2012-05-15 09:46:24 +02:00
|
|
|
if (data.isInspect())
|
2012-04-18 14:20:54 +02:00
|
|
|
d->m_qmlEngine->updateWatchData(data, flags);
|
2012-05-10 14:26:31 +02:00
|
|
|
else
|
|
|
|
|
d->m_activeEngine->updateWatchData(data, flags);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
2012-11-23 13:35:44 +01:00
|
|
|
void QmlCppEngine::watchDataSelected(const QByteArray &iname)
|
|
|
|
|
{
|
|
|
|
|
const WatchData *wd = watchHandler()->findData(iname);
|
|
|
|
|
if (wd && wd->isInspect())
|
|
|
|
|
d->m_qmlEngine->watchDataSelected(iname);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2012-10-19 16:37:57 +02:00
|
|
|
void QmlCppEngine::selectThread(ThreadId threadId)
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2012-10-19 16:37:57 +02:00
|
|
|
d->m_activeEngine->selectThread(threadId);
|
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
|
|
|
{
|
2012-06-08 08:28:17 +02:00
|
|
|
if (data->isInspect())
|
2012-06-07 14:27:38 +02:00
|
|
|
d->m_qmlEngine->assignValueInDebugger(data, expr, value);
|
|
|
|
|
else
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2012-04-10 09:36:15 +02:00
|
|
|
void QmlCppEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
|
2010-08-18 13:54:12 +02:00
|
|
|
{
|
2012-04-10 09:36:15 +02:00
|
|
|
d->m_qmlEngine->executeDebuggerCommand(command, languages);
|
|
|
|
|
d->m_cppEngine->executeDebuggerCommand(command, languages);
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
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");
|
2012-04-13 17:14:10 +02:00
|
|
|
setActiveEngine(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
|
|
|
|
2012-06-13 11:29:26 +02:00
|
|
|
if (startParameters().remoteSetupNeeded)
|
2012-01-31 13:23:05 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2013-04-19 17:04:22 +02:00
|
|
|
void QmlCppEngine::notifyInferiorSetupOk()
|
|
|
|
|
{
|
|
|
|
|
EDEBUG("\nMASTER INFERIOR SETUP OK");
|
|
|
|
|
emit aboutToNotifyInferiorSetupOk();
|
|
|
|
|
DebuggerEngine::notifyInferiorSetupOk();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlCppEngine::notifyEngineRemoteServerRunning(const QByteArray &serverChannel, int pid)
|
|
|
|
|
{
|
|
|
|
|
d->m_cppEngine->notifyEngineRemoteServerRunning(serverChannel, pid);
|
|
|
|
|
}
|
|
|
|
|
|
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();
|
2012-10-08 13:17:10 +02:00
|
|
|
QmlJS::ConsoleManagerInterface *consoleManager = QmlJS::ConsoleManagerInterface::instance();
|
|
|
|
|
if (consoleManager)
|
|
|
|
|
consoleManager->setScriptEvaluator(0);
|
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();
|
2012-04-10 11:57:00 +02:00
|
|
|
|
|
|
|
|
if (qmlEngine()->state() == InferiorStopOk) {
|
|
|
|
|
// track qml engine again
|
|
|
|
|
setState(InferiorStopRequested);
|
|
|
|
|
notifyInferiorStopOk();
|
2012-04-13 17:14:10 +02:00
|
|
|
setActiveEngine(d->m_qmlEngine);
|
2012-04-10 11:57:00 +02:00
|
|
|
}
|
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);
|
|
|
|
|
} else {
|
2012-04-10 11:57:00 +02:00
|
|
|
// we're debugging qml, but got an interrupt, or abort
|
2012-01-19 14:42:16 +01:00
|
|
|
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);
|
|
|
|
|
}
|
2012-04-10 11:57:00 +02:00
|
|
|
// now track cpp engine
|
2012-04-13 17:14:10 +02:00
|
|
|
setActiveEngine(d->m_cppEngine);
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
2012-04-10 11:57:00 +02:00
|
|
|
break;
|
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 ...
|
2012-04-13 17:14:10 +02:00
|
|
|
setActiveEngine(d->m_cppEngine);
|
2012-01-19 14:42:16 +01:00
|
|
|
|
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"));
|
2012-04-13 17:14:10 +02:00
|
|
|
setActiveEngine(d->m_cppEngine);
|
2011-09-29 16:49:18 +02:00
|
|
|
}
|
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);
|
2012-04-10 11:51:48 +02:00
|
|
|
qmlEngine()->quitDebugger();
|
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());
|
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 ...
|
2012-04-13 17:14:10 +02:00
|
|
|
setActiveEngine(d->m_cppEngine);
|
2012-01-19 14:42:16 +01:00
|
|
|
|
|
|
|
|
if (state() == InferiorStopRequested)
|
|
|
|
|
notifyInferiorStopOk();
|
|
|
|
|
// otherwise we're probably inside notifyInferiorStopOk already
|
|
|
|
|
} else {
|
|
|
|
|
if (d->m_activeEngine != qmlEngine()) {
|
|
|
|
|
showStatusMessage(tr("QML debugger activated"));
|
2012-04-13 17:14:10 +02:00
|
|
|
setActiveEngine(d->m_qmlEngine);
|
2012-01-19 14:42:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QTC_ASSERT(state() == InferiorRunOk
|
2012-04-10 11:51:48 +02:00
|
|
|
|| state() == InferiorStopRequested
|
|
|
|
|
|| state() == InferiorShutdownRequested, qDebug() << state());
|
2012-01-19 14:42:16 +01:00
|
|
|
|
|
|
|
|
if (state() == InferiorRunOk)
|
|
|
|
|
notifyInferiorSpontaneousStop();
|
2012-04-10 11:51:48 +02:00
|
|
|
else if (state() == InferiorStopRequested)
|
2012-01-19 14:42:16 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 11:29:26 +02:00
|
|
|
void QmlCppEngine::notifyEngineRemoteSetupDone(int gdbServerPort, int qmlPort)
|
2010-12-10 12:41:44 +01:00
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("MASTER REMOTE SETUP DONE");
|
2012-06-13 11:29:26 +02:00
|
|
|
DebuggerEngine::notifyEngineRemoteSetupDone(gdbServerPort, qmlPort);
|
2012-01-31 13:23:05 +01:00
|
|
|
|
2012-06-13 11:29:26 +02:00
|
|
|
cppEngine()->notifyEngineRemoteSetupDone(gdbServerPort, qmlPort);
|
|
|
|
|
qmlEngine()->notifyEngineRemoteSetupDone(gdbServerPort, qmlPort);
|
2010-12-10 12:41:44 +01:00
|
|
|
}
|
|
|
|
|
|
2012-06-13 11:29:26 +02:00
|
|
|
void QmlCppEngine::notifyEngineRemoteSetupFailed(const QString &message)
|
2010-12-10 12:41:44 +01:00
|
|
|
{
|
2011-01-19 10:48:39 +01:00
|
|
|
EDEBUG("MASTER REMOTE SETUP FAILED");
|
2012-06-24 20:51:01 -07:00
|
|
|
DebuggerEngine::notifyEngineRemoteSetupFailed(message);
|
2012-01-31 13:23:05 +01:00
|
|
|
|
2012-06-13 11:29:26 +02:00
|
|
|
cppEngine()->notifyEngineRemoteSetupFailed(message);
|
2012-06-24 20:51:01 -07:00
|
|
|
qmlEngine()->notifyEngineRemoteSetupFailed(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
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-13 17:14:10 +02:00
|
|
|
void QmlCppEngine::setActiveEngine(DebuggerEngine *engine)
|
|
|
|
|
{
|
|
|
|
|
d->m_activeEngine = engine;
|
|
|
|
|
updateViews();
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-03 12:07:32 +01:00
|
|
|
} // namespace Internal
|
2010-08-18 13:54:12 +02:00
|
|
|
} // namespace Debugger
|