Debugger: Remove QmlCppEnginePrivate

No need for a pimpl containing three pointers in an
internal class.

Change-Id: Iabafa5da4a684099cbfd3e945a642929a2cecf50
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
hjk
2014-06-05 23:03:06 +02:00
parent dcedc45474
commit 83df620612
2 changed files with 107 additions and 124 deletions

View File

@@ -58,23 +58,6 @@ DebuggerEngine *createQmlCppEngine(const DebuggerStartParameters &sp,
} }
////////////////////////////////////////////////////////////////////////
//
// QmlCppEnginePrivate
//
////////////////////////////////////////////////////////////////////////
class QmlCppEnginePrivate
{
public:
QmlCppEnginePrivate() {}
QmlEngine *m_qmlEngine;
DebuggerEngine *m_cppEngine;
DebuggerEngine *m_activeEngine;
};
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// //
// QmlCppEngine // QmlCppEngine
@@ -85,27 +68,25 @@ QmlCppEngine::QmlCppEngine(const DebuggerStartParameters &sp, QString *errorMess
: DebuggerEngine(sp) : DebuggerEngine(sp)
{ {
setObjectName(QLatin1String("QmlCppEngine")); setObjectName(QLatin1String("QmlCppEngine"));
d = new QmlCppEnginePrivate; m_qmlEngine = new QmlEngine(sp, this);
d->m_qmlEngine = new QmlEngine(sp, this); m_cppEngine = DebuggerRunControlFactory::createEngine(sp.firstSlaveEngineType, sp, errorMessage);
d->m_cppEngine = DebuggerRunControlFactory::createEngine(sp.firstSlaveEngineType, sp, errorMessage); if (!m_cppEngine) {
if (!d->m_cppEngine) {
*errorMessage = tr("The slave debugging engine required for combined QML/C++-Debugging could not be created: %1").arg(*errorMessage); *errorMessage = tr("The slave debugging engine required for combined QML/C++-Debugging could not be created: %1").arg(*errorMessage);
return; return;
} }
d->m_cppEngine->setMasterEngine(this); m_cppEngine->setMasterEngine(this);
setActiveEngine(d->m_cppEngine); setActiveEngine(m_cppEngine);
} }
QmlCppEngine::~QmlCppEngine() QmlCppEngine::~QmlCppEngine()
{ {
delete d->m_qmlEngine; delete m_qmlEngine;
delete d->m_cppEngine; delete m_cppEngine;
delete d;
} }
bool QmlCppEngine::canDisplayTooltip() const bool QmlCppEngine::canDisplayTooltip() const
{ {
return d->m_cppEngine->canDisplayTooltip() || d->m_qmlEngine->canDisplayTooltip(); return m_cppEngine->canDisplayTooltip() || m_qmlEngine->canDisplayTooltip();
} }
bool QmlCppEngine::setToolTipExpression(const QPoint & mousePos, bool QmlCppEngine::setToolTipExpression(const QPoint & mousePos,
@@ -114,9 +95,9 @@ bool QmlCppEngine::setToolTipExpression(const QPoint & mousePos,
QTC_ASSERT(editor, return false); QTC_ASSERT(editor, return false);
bool success = false; bool success = false;
if (editor->document()->id() == CppEditor::Constants::CPPEDITOR_ID) if (editor->document()->id() == CppEditor::Constants::CPPEDITOR_ID)
success = d->m_cppEngine->setToolTipExpression(mousePos, editor, ctx); success = m_cppEngine->setToolTipExpression(mousePos, editor, ctx);
else if (editor->document()->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID) else if (editor->document()->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID)
success = d->m_qmlEngine->setToolTipExpression(mousePos, editor, ctx); success = m_qmlEngine->setToolTipExpression(mousePos, editor, ctx);
return success; return success;
} }
@@ -124,32 +105,32 @@ void QmlCppEngine::updateWatchData(const WatchData &data,
const WatchUpdateFlags &flags) const WatchUpdateFlags &flags)
{ {
if (data.isInspect()) if (data.isInspect())
d->m_qmlEngine->updateWatchData(data, flags); m_qmlEngine->updateWatchData(data, flags);
else else
d->m_activeEngine->updateWatchData(data, flags); m_activeEngine->updateWatchData(data, flags);
} }
void QmlCppEngine::watchDataSelected(const QByteArray &iname) void QmlCppEngine::watchDataSelected(const QByteArray &iname)
{ {
const WatchData *wd = watchHandler()->findData(iname); const WatchData *wd = watchHandler()->findData(iname);
if (wd && wd->isInspect()) if (wd && wd->isInspect())
d->m_qmlEngine->watchDataSelected(iname); m_qmlEngine->watchDataSelected(iname);
} }
void QmlCppEngine::watchPoint(const QPoint &point) void QmlCppEngine::watchPoint(const QPoint &point)
{ {
d->m_cppEngine->watchPoint(point); m_cppEngine->watchPoint(point);
} }
void QmlCppEngine::fetchMemory(MemoryAgent *ma, QObject *obj, void QmlCppEngine::fetchMemory(MemoryAgent *ma, QObject *obj,
quint64 addr, quint64 length) quint64 addr, quint64 length)
{ {
d->m_cppEngine->fetchMemory(ma, obj, addr, length); m_cppEngine->fetchMemory(ma, obj, addr, length);
} }
void QmlCppEngine::fetchDisassembler(DisassemblerAgent *da) void QmlCppEngine::fetchDisassembler(DisassemblerAgent *da)
{ {
d->m_cppEngine->fetchDisassembler(da); m_cppEngine->fetchDisassembler(da);
} }
void QmlCppEngine::activateFrame(int index) void QmlCppEngine::activateFrame(int index)
@@ -157,105 +138,105 @@ void QmlCppEngine::activateFrame(int index)
if (state() != InferiorStopOk && state() != InferiorUnrunnable) if (state() != InferiorStopOk && state() != InferiorUnrunnable)
return; return;
d->m_activeEngine->activateFrame(index); m_activeEngine->activateFrame(index);
stackHandler()->setCurrentIndex(index); stackHandler()->setCurrentIndex(index);
} }
void QmlCppEngine::reloadModules() void QmlCppEngine::reloadModules()
{ {
d->m_cppEngine->reloadModules(); m_cppEngine->reloadModules();
} }
void QmlCppEngine::examineModules() void QmlCppEngine::examineModules()
{ {
d->m_cppEngine->examineModules(); m_cppEngine->examineModules();
} }
void QmlCppEngine::loadSymbols(const QString &moduleName) void QmlCppEngine::loadSymbols(const QString &moduleName)
{ {
d->m_cppEngine->loadSymbols(moduleName); m_cppEngine->loadSymbols(moduleName);
} }
void QmlCppEngine::loadAllSymbols() void QmlCppEngine::loadAllSymbols()
{ {
d->m_cppEngine->loadAllSymbols(); m_cppEngine->loadAllSymbols();
} }
void QmlCppEngine::requestModuleSymbols(const QString &moduleName) void QmlCppEngine::requestModuleSymbols(const QString &moduleName)
{ {
d->m_cppEngine->requestModuleSymbols(moduleName); m_cppEngine->requestModuleSymbols(moduleName);
} }
void QmlCppEngine::reloadRegisters() void QmlCppEngine::reloadRegisters()
{ {
d->m_cppEngine->reloadRegisters(); m_cppEngine->reloadRegisters();
} }
void QmlCppEngine::reloadSourceFiles() void QmlCppEngine::reloadSourceFiles()
{ {
d->m_cppEngine->reloadSourceFiles(); m_cppEngine->reloadSourceFiles();
} }
void QmlCppEngine::reloadFullStack() void QmlCppEngine::reloadFullStack()
{ {
d->m_cppEngine->reloadFullStack(); m_cppEngine->reloadFullStack();
} }
void QmlCppEngine::setRegisterValue(int regnr, const QString &value) void QmlCppEngine::setRegisterValue(int regnr, const QString &value)
{ {
d->m_cppEngine->setRegisterValue(regnr, value); m_cppEngine->setRegisterValue(regnr, value);
} }
bool QmlCppEngine::hasCapability(unsigned cap) const bool QmlCppEngine::hasCapability(unsigned cap) const
{ {
// ### this could also be an OR of both engines' capabilities // ### this could also be an OR of both engines' capabilities
bool hasCap = d->m_cppEngine->hasCapability(cap); bool hasCap = m_cppEngine->hasCapability(cap);
if (d->m_activeEngine != d->m_cppEngine) { if (m_activeEngine != m_cppEngine) {
//Some capabilities cannot be handled by QML Engine //Some capabilities cannot be handled by QML Engine
//Expand this list as and when required //Expand this list as and when required
if (cap == AddWatcherWhileRunningCapability) if (cap == AddWatcherWhileRunningCapability)
hasCap = hasCap || d->m_qmlEngine->hasCapability(cap); hasCap = hasCap || m_qmlEngine->hasCapability(cap);
if (cap == WatchWidgetsCapability || if (cap == WatchWidgetsCapability ||
cap == DisassemblerCapability || cap == DisassemblerCapability ||
cap == OperateByInstructionCapability || cap == OperateByInstructionCapability ||
cap == ReverseSteppingCapability) cap == ReverseSteppingCapability)
hasCap = hasCap && d->m_qmlEngine->hasCapability(cap); hasCap = hasCap && m_qmlEngine->hasCapability(cap);
} }
return hasCap; return hasCap;
} }
bool QmlCppEngine::isSynchronous() const bool QmlCppEngine::isSynchronous() const
{ {
return d->m_activeEngine->isSynchronous(); return m_activeEngine->isSynchronous();
} }
QByteArray QmlCppEngine::qtNamespace() const QByteArray QmlCppEngine::qtNamespace() const
{ {
return d->m_cppEngine->qtNamespace(); return m_cppEngine->qtNamespace();
} }
void QmlCppEngine::createSnapshot() void QmlCppEngine::createSnapshot()
{ {
d->m_cppEngine->createSnapshot(); m_cppEngine->createSnapshot();
} }
void QmlCppEngine::updateAll() void QmlCppEngine::updateAll()
{ {
d->m_activeEngine->updateAll(); m_activeEngine->updateAll();
} }
void QmlCppEngine::attemptBreakpointSynchronization() void QmlCppEngine::attemptBreakpointSynchronization()
{ {
d->m_cppEngine->attemptBreakpointSynchronization(); m_cppEngine->attemptBreakpointSynchronization();
switch (d->m_qmlEngine->state()) { switch (m_qmlEngine->state()) {
case InferiorRunOk: case InferiorRunOk:
case InferiorRunRequested: case InferiorRunRequested:
case InferiorStopOk: // fall through case InferiorStopOk: // fall through
case InferiorStopRequested: case InferiorStopRequested:
d->m_qmlEngine->attemptBreakpointSynchronization(); m_qmlEngine->attemptBreakpointSynchronization();
break; break;
default: default:
break; break;
@@ -264,22 +245,22 @@ void QmlCppEngine::attemptBreakpointSynchronization()
bool QmlCppEngine::acceptsBreakpoint(BreakpointModelId id) const bool QmlCppEngine::acceptsBreakpoint(BreakpointModelId id) const
{ {
return d->m_cppEngine->acceptsBreakpoint(id) return m_cppEngine->acceptsBreakpoint(id)
|| d->m_qmlEngine->acceptsBreakpoint(id); || m_qmlEngine->acceptsBreakpoint(id);
} }
void QmlCppEngine::selectThread(ThreadId threadId) void QmlCppEngine::selectThread(ThreadId threadId)
{ {
d->m_activeEngine->selectThread(threadId); m_activeEngine->selectThread(threadId);
} }
void QmlCppEngine::assignValueInDebugger(const WatchData *data, void QmlCppEngine::assignValueInDebugger(const WatchData *data,
const QString &expr, const QVariant &value) const QString &expr, const QVariant &value)
{ {
if (data->isInspect()) if (data->isInspect())
d->m_qmlEngine->assignValueInDebugger(data, expr, value); m_qmlEngine->assignValueInDebugger(data, expr, value);
else else
d->m_activeEngine->assignValueInDebugger(data, expr, value); m_activeEngine->assignValueInDebugger(data, expr, value);
} }
void QmlCppEngine::notifyInferiorIll() void QmlCppEngine::notifyInferiorIll()
@@ -292,79 +273,79 @@ void QmlCppEngine::notifyInferiorIll()
//Call notifyInferiorIll of cpp engine //Call notifyInferiorIll of cpp engine
//as qml engine will follow state transitions //as qml engine will follow state transitions
//of cpp engine //of cpp engine
d->m_cppEngine->notifyInferiorIll(); m_cppEngine->notifyInferiorIll();
} }
void QmlCppEngine::detachDebugger() void QmlCppEngine::detachDebugger()
{ {
d->m_qmlEngine->detachDebugger(); m_qmlEngine->detachDebugger();
d->m_cppEngine->detachDebugger(); m_cppEngine->detachDebugger();
} }
void QmlCppEngine::executeStep() void QmlCppEngine::executeStep()
{ {
// TODO: stepping from qml -> cpp requires more thought // TODO: stepping from qml -> cpp requires more thought
// if (d->m_activeEngine == d->m_qmlEngine) { // if (m_activeEngine == m_qmlEngine) {
// QTC_CHECK(d->m_cppEngine->state() == InferiorRunOk); // QTC_CHECK(m_cppEngine->state() == InferiorRunOk);
// if (d->m_cppEngine->setupQmlStep(true)) // if (m_cppEngine->setupQmlStep(true))
// return; // Wait for callback to readyToExecuteQmlStep() // return; // Wait for callback to readyToExecuteQmlStep()
// } else { // } else {
// notifyInferiorRunRequested(); // notifyInferiorRunRequested();
// d->m_cppEngine->executeStep(); // m_cppEngine->executeStep();
// } // }
notifyInferiorRunRequested(); notifyInferiorRunRequested();
d->m_activeEngine->executeStep(); m_activeEngine->executeStep();
} }
void QmlCppEngine::readyToExecuteQmlStep() void QmlCppEngine::readyToExecuteQmlStep()
{ {
notifyInferiorRunRequested(); notifyInferiorRunRequested();
d->m_qmlEngine->executeStep(); m_qmlEngine->executeStep();
} }
void QmlCppEngine::executeStepOut() void QmlCppEngine::executeStepOut()
{ {
notifyInferiorRunRequested(); notifyInferiorRunRequested();
d->m_activeEngine->executeStepOut(); m_activeEngine->executeStepOut();
} }
void QmlCppEngine::executeNext() void QmlCppEngine::executeNext()
{ {
notifyInferiorRunRequested(); notifyInferiorRunRequested();
d->m_activeEngine->executeNext(); m_activeEngine->executeNext();
} }
void QmlCppEngine::executeStepI() void QmlCppEngine::executeStepI()
{ {
notifyInferiorRunRequested(); notifyInferiorRunRequested();
d->m_activeEngine->executeStepI(); m_activeEngine->executeStepI();
} }
void QmlCppEngine::executeNextI() void QmlCppEngine::executeNextI()
{ {
notifyInferiorRunRequested(); notifyInferiorRunRequested();
d->m_activeEngine->executeNextI(); m_activeEngine->executeNextI();
} }
void QmlCppEngine::executeReturn() void QmlCppEngine::executeReturn()
{ {
notifyInferiorRunRequested(); notifyInferiorRunRequested();
d->m_activeEngine->executeReturn(); m_activeEngine->executeReturn();
} }
void QmlCppEngine::continueInferior() void QmlCppEngine::continueInferior()
{ {
EDEBUG("\nMASTER CONTINUE INFERIOR" EDEBUG("\nMASTER CONTINUE INFERIOR"
<< d->m_cppEngine->state() << d->m_qmlEngine->state()); << state() << m_qmlEngine->state());
notifyInferiorRunRequested(); notifyInferiorRunRequested();
if (d->m_cppEngine->state() == InferiorStopOk) { if (m_cppEngine->state() == InferiorStopOk) {
d->m_cppEngine->continueInferior(); m_cppEngine->continueInferior();
} else if (d->m_qmlEngine->state() == InferiorStopOk) { } else if (m_qmlEngine->state() == InferiorStopOk) {
d->m_qmlEngine->continueInferior(); m_qmlEngine->continueInferior();
} else { } else {
QTC_ASSERT(false, qDebug() << "MASTER CANNOT CONTINUE INFERIOR" QTC_ASSERT(false, qDebug() << "MASTER CANNOT CONTINUE INFERIOR"
<< d->m_cppEngine->state() << d->m_qmlEngine->state()); << m_cppEngine->state() << m_qmlEngine->state());
notifyEngineIll(); notifyEngineIll();
} }
} }
@@ -372,7 +353,7 @@ void QmlCppEngine::continueInferior()
void QmlCppEngine::interruptInferior() void QmlCppEngine::interruptInferior()
{ {
EDEBUG("\nMASTER INTERRUPT INFERIOR"); EDEBUG("\nMASTER INTERRUPT INFERIOR");
d->m_cppEngine->requestInterruptInferior(); m_cppEngine->requestInterruptInferior();
} }
void QmlCppEngine::requestInterruptInferior() void QmlCppEngine::requestInterruptInferior()
@@ -383,23 +364,23 @@ void QmlCppEngine::requestInterruptInferior()
void QmlCppEngine::executeRunToLine(const ContextData &data) void QmlCppEngine::executeRunToLine(const ContextData &data)
{ {
d->m_activeEngine->executeRunToLine(data); m_activeEngine->executeRunToLine(data);
} }
void QmlCppEngine::executeRunToFunction(const QString &functionName) void QmlCppEngine::executeRunToFunction(const QString &functionName)
{ {
d->m_activeEngine->executeRunToFunction(functionName); m_activeEngine->executeRunToFunction(functionName);
} }
void QmlCppEngine::executeJumpToLine(const ContextData &data) void QmlCppEngine::executeJumpToLine(const ContextData &data)
{ {
d->m_activeEngine->executeJumpToLine(data); m_activeEngine->executeJumpToLine(data);
} }
void QmlCppEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages) void QmlCppEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
{ {
d->m_qmlEngine->executeDebuggerCommand(command, languages); m_qmlEngine->executeDebuggerCommand(command, languages);
d->m_cppEngine->executeDebuggerCommand(command, languages); m_cppEngine->executeDebuggerCommand(command, languages);
} }
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
@@ -407,9 +388,9 @@ void QmlCppEngine::executeDebuggerCommand(const QString &command, DebuggerLangua
void QmlCppEngine::setupEngine() void QmlCppEngine::setupEngine()
{ {
EDEBUG("\nMASTER SETUP ENGINE"); EDEBUG("\nMASTER SETUP ENGINE");
setActiveEngine(d->m_cppEngine); setActiveEngine(m_cppEngine);
d->m_qmlEngine->setupSlaveEngine(); m_qmlEngine->setupSlaveEngine();
d->m_cppEngine->setupSlaveEngine(); m_cppEngine->setupSlaveEngine();
if (startParameters().remoteSetupNeeded) if (startParameters().remoteSetupNeeded)
notifyEngineRequestRemoteSetup(); notifyEngineRequestRemoteSetup();
@@ -448,33 +429,33 @@ void QmlCppEngine::notifyInferiorSetupOk()
void QmlCppEngine::notifyEngineRemoteServerRunning(const QByteArray &serverChannel, int pid) void QmlCppEngine::notifyEngineRemoteServerRunning(const QByteArray &serverChannel, int pid)
{ {
d->m_cppEngine->notifyEngineRemoteServerRunning(serverChannel, pid); m_cppEngine->notifyEngineRemoteServerRunning(serverChannel, pid);
} }
void QmlCppEngine::setupInferior() void QmlCppEngine::setupInferior()
{ {
EDEBUG("\nMASTER SETUP INFERIOR"); EDEBUG("\nMASTER SETUP INFERIOR");
d->m_qmlEngine->setupSlaveInferior(); m_qmlEngine->setupSlaveInferior();
d->m_cppEngine->setupSlaveInferior(); m_cppEngine->setupSlaveInferior();
} }
void QmlCppEngine::runEngine() void QmlCppEngine::runEngine()
{ {
EDEBUG("\nMASTER RUN ENGINE"); EDEBUG("\nMASTER RUN ENGINE");
d->m_qmlEngine->runSlaveEngine(); m_qmlEngine->runSlaveEngine();
d->m_cppEngine->runSlaveEngine(); m_cppEngine->runSlaveEngine();
} }
void QmlCppEngine::shutdownInferior() void QmlCppEngine::shutdownInferior()
{ {
EDEBUG("\nMASTER SHUTDOWN INFERIOR"); EDEBUG("\nMASTER SHUTDOWN INFERIOR");
d->m_cppEngine->shutdownInferior(); m_cppEngine->shutdownInferior();
} }
void QmlCppEngine::shutdownEngine() void QmlCppEngine::shutdownEngine()
{ {
EDEBUG("\nMASTER SHUTDOWN ENGINE"); EDEBUG("\nMASTER SHUTDOWN ENGINE");
d->m_cppEngine->shutdownSlaveEngine(); m_cppEngine->shutdownSlaveEngine();
QmlJS::ConsoleManagerInterface *consoleManager = QmlJS::ConsoleManagerInterface::instance(); QmlJS::ConsoleManagerInterface *consoleManager = QmlJS::ConsoleManagerInterface::instance();
if (consoleManager) if (consoleManager)
consoleManager->setScriptEvaluator(0); consoleManager->setScriptEvaluator(0);
@@ -483,28 +464,28 @@ void QmlCppEngine::shutdownEngine()
void QmlCppEngine::quitDebugger() void QmlCppEngine::quitDebugger()
{ {
EDEBUG("\nMASTER QUIT DEBUGGER"); EDEBUG("\nMASTER QUIT DEBUGGER");
d->m_cppEngine->quitDebugger(); m_cppEngine->quitDebugger();
} }
void QmlCppEngine::abortDebugger() void QmlCppEngine::abortDebugger()
{ {
EDEBUG("\nMASTER ABORT DEBUGGER"); EDEBUG("\nMASTER ABORT DEBUGGER");
d->m_cppEngine->abortDebugger(); m_cppEngine->abortDebugger();
} }
void QmlCppEngine::setState(DebuggerState newState, bool forced) void QmlCppEngine::setState(DebuggerState newState, bool forced)
{ {
EDEBUG("SET MASTER STATE: " << newState); EDEBUG("SET MASTER STATE: " << newState);
EDEBUG(" CPP STATE: " << d->m_cppEngine->state()); EDEBUG(" CPP STATE: " << m_cppEngine->state());
EDEBUG(" QML STATE: " << d->m_qmlEngine->state()); EDEBUG(" QML STATE: " << m_qmlEngine->state());
DebuggerEngine::setState(newState, forced); DebuggerEngine::setState(newState, forced);
} }
void QmlCppEngine::slaveEngineStateChanged void QmlCppEngine::slaveEngineStateChanged
(DebuggerEngine *slaveEngine, const DebuggerState newState) (DebuggerEngine *slaveEngine, const DebuggerState newState)
{ {
DebuggerEngine *otherEngine = (slaveEngine == d->m_cppEngine) DebuggerEngine *otherEngine = (slaveEngine == m_cppEngine)
? d->m_qmlEngine : d->m_cppEngine; ? m_qmlEngine : m_cppEngine;
QTC_CHECK(otherEngine != slaveEngine); QTC_CHECK(otherEngine != slaveEngine);
@@ -521,7 +502,7 @@ void QmlCppEngine::slaveEngineStateChanged
// InferiorStopOk state. The cpp engine becomes the active one again as soon as it itself enters // InferiorStopOk state. The cpp engine becomes the active one again as soon as it itself enters
// the InferiorStopOk state. // the InferiorStopOk state.
if (slaveEngine == d->m_cppEngine) { if (slaveEngine == m_cppEngine) {
switch (newState) { switch (newState) {
case DebuggerNotReady: { case DebuggerNotReady: {
// Can this ever happen? // Can this ever happen?
@@ -589,7 +570,7 @@ void QmlCppEngine::slaveEngineStateChanged
// track qml engine again // track qml engine again
setState(InferiorStopRequested); setState(InferiorStopRequested);
notifyInferiorStopOk(); notifyInferiorStopOk();
setActiveEngine(d->m_qmlEngine); setActiveEngine(m_qmlEngine);
} }
break; break;
} }
@@ -599,7 +580,7 @@ void QmlCppEngine::slaveEngineStateChanged
break; break;
} }
case InferiorStopRequested: { case InferiorStopRequested: {
if (d->m_activeEngine == cppEngine()) { if (m_activeEngine == cppEngine()) {
// might be set by doInterruptInferior() // might be set by doInterruptInferior()
QTC_ASSERT(state() == InferiorStopRequested QTC_ASSERT(state() == InferiorStopRequested
|| state() == InferiorRunOk, qDebug() << state()); || state() == InferiorRunOk, qDebug() << state());
@@ -622,7 +603,7 @@ void QmlCppEngine::slaveEngineStateChanged
setState(InferiorStopRequested); setState(InferiorStopRequested);
} }
// now track cpp engine // now track cpp engine
setActiveEngine(d->m_cppEngine); setActiveEngine(m_cppEngine);
} }
break; break;
} }
@@ -634,15 +615,15 @@ void QmlCppEngine::slaveEngineStateChanged
|| state() == InferiorStopOk, qDebug() << state()); || state() == InferiorStopOk, qDebug() << state());
// Just to make sure, we're shutting down anyway ... // Just to make sure, we're shutting down anyway ...
setActiveEngine(d->m_cppEngine); setActiveEngine(m_cppEngine);
if (state() == InferiorStopRequested) if (state() == InferiorStopRequested)
setState(InferiorStopOk); setState(InferiorStopOk);
// otherwise we're probably inside notifyInferiorStopOk already // otherwise we're probably inside notifyInferiorStopOk already
} else { } else {
if (d->m_activeEngine != cppEngine()) { if (m_activeEngine != cppEngine()) {
showStatusMessage(tr("C++ debugger activated")); showStatusMessage(tr("C++ debugger activated"));
setActiveEngine(d->m_cppEngine); setActiveEngine(m_cppEngine);
} }
QTC_ASSERT(state() == InferiorStopRequested QTC_ASSERT(state() == InferiorStopRequested
@@ -734,15 +715,15 @@ void QmlCppEngine::slaveEngineStateChanged
EDEBUG("... QML ENGINE STOPPED DURING SHUTDOWN "); EDEBUG("... QML ENGINE STOPPED DURING SHUTDOWN ");
// Just to make sure, we're shutting down anyway ... // Just to make sure, we're shutting down anyway ...
setActiveEngine(d->m_cppEngine); setActiveEngine(m_cppEngine);
if (state() == InferiorStopRequested) if (state() == InferiorStopRequested)
notifyInferiorStopOk(); notifyInferiorStopOk();
// otherwise we're probably inside notifyInferiorStopOk already // otherwise we're probably inside notifyInferiorStopOk already
} else { } else {
if (d->m_activeEngine != qmlEngine()) { if (m_activeEngine != qmlEngine()) {
showStatusMessage(tr("QML debugger activated")); showStatusMessage(tr("QML debugger activated"));
setActiveEngine(d->m_qmlEngine); setActiveEngine(m_qmlEngine);
} }
QTC_ASSERT(state() == InferiorRunOk QTC_ASSERT(state() == InferiorRunOk
@@ -756,7 +737,7 @@ void QmlCppEngine::slaveEngineStateChanged
} }
} else if (newState == InferiorRunOk) { } else if (newState == InferiorRunOk) {
if (d->m_activeEngine == qmlEngine()) { if (m_activeEngine == qmlEngine()) {
QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state());
notifyInferiorRunOk(); notifyInferiorRunOk();
} }
@@ -786,34 +767,34 @@ void QmlCppEngine::showMessage(const QString &msg, int channel, int timeout) con
{ {
if (channel == AppOutput || channel == AppError || channel == AppStuff) { if (channel == AppOutput || channel == AppError || channel == AppStuff) {
// message is from CppEngine, allow qml engine to process // message is from CppEngine, allow qml engine to process
d->m_qmlEngine->filterApplicationMessage(msg, channel); m_qmlEngine->filterApplicationMessage(msg, channel);
} }
DebuggerEngine::showMessage(msg, channel, timeout); DebuggerEngine::showMessage(msg, channel, timeout);
} }
void QmlCppEngine::resetLocation() void QmlCppEngine::resetLocation()
{ {
if (d->m_qmlEngine) if (m_qmlEngine)
d->m_qmlEngine->resetLocation(); m_qmlEngine->resetLocation();
if (d->m_cppEngine) if (m_cppEngine)
d->m_cppEngine->resetLocation(); m_cppEngine->resetLocation();
DebuggerEngine::resetLocation(); DebuggerEngine::resetLocation();
} }
DebuggerEngine *QmlCppEngine::cppEngine() const DebuggerEngine *QmlCppEngine::cppEngine() const
{ {
return d->m_cppEngine; return m_cppEngine;
} }
DebuggerEngine *QmlCppEngine::qmlEngine() const DebuggerEngine *QmlCppEngine::qmlEngine() const
{ {
return d->m_qmlEngine; return m_qmlEngine;
} }
void QmlCppEngine::setActiveEngine(DebuggerEngine *engine) void QmlCppEngine::setActiveEngine(DebuggerEngine *engine)
{ {
d->m_activeEngine = engine; m_activeEngine = engine;
updateViews(); updateViews();
} }

View File

@@ -35,7 +35,7 @@
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
class QmlCppEnginePrivate; class QmlEngine;
class QmlCppEngine : public DebuggerEngine class QmlCppEngine : public DebuggerEngine
{ {
@@ -140,7 +140,9 @@ private:
void setActiveEngine(DebuggerEngine *engine); void setActiveEngine(DebuggerEngine *engine);
private: private:
QmlCppEnginePrivate *d; QmlEngine *m_qmlEngine;
DebuggerEngine *m_cppEngine;
DebuggerEngine *m_activeEngine;
}; };
} // namespace Internal } // namespace Internal