Commit d47fdb93 authored by hjk's avatar hjk

Debugger: Change semantics of DebuggerEngine::masterEngine()

Make it return 'this' if 'this' is the master engine itself.
Adapt users.

Also do not let the QmlEngine try to beginConnection() when
the combined engine was isDying() already.

Change-Id: I308deae14a3c4966be381f321c0d9dfaf82c40d6
Reviewed-by: Ulf Hermann's avatarUlf Hermann <ulf.hermann@qt.io>
parent ff04632b
...@@ -931,10 +931,7 @@ void DebuggerEngine::notifyDebuggerProcessFinished(int exitCode, ...@@ -931,10 +931,7 @@ void DebuggerEngine::notifyDebuggerProcessFinished(int exitCode,
break; break;
default: { default: {
// Initiate shutdown sequence // Initiate shutdown sequence
if (isMasterEngine()) masterEngine()->notifyInferiorIll();
notifyEngineIll();
else
masterEngine()->notifyInferiorIll();
const QString msg = exitStatus == QProcess::CrashExit ? const QString msg = exitStatus == QProcess::CrashExit ?
tr("The %1 process terminated.") : tr("The %1 process terminated.") :
tr("The %2 process terminated unexpectedly (exit code %1).").arg(exitCode); tr("The %2 process terminated unexpectedly (exit code %1).").arg(exitCode);
...@@ -1019,9 +1016,9 @@ void DebuggerEngine::setMasterEngine(DebuggerEngine *masterEngine) ...@@ -1019,9 +1016,9 @@ void DebuggerEngine::setMasterEngine(DebuggerEngine *masterEngine)
d->m_masterEngine = masterEngine; d->m_masterEngine = masterEngine;
} }
DebuggerEngine *DebuggerEngine::masterEngine() const DebuggerEngine *DebuggerEngine::masterEngine()
{ {
return d->m_masterEngine; return d->m_masterEngine ? d->m_masterEngine : this;
} }
bool DebuggerEngine::canDisplayTooltip() const bool DebuggerEngine::canDisplayTooltip() const
......
...@@ -364,7 +364,7 @@ public: ...@@ -364,7 +364,7 @@ public:
void updateViews(); void updateViews();
bool isSlaveEngine() const; bool isSlaveEngine() const;
bool isMasterEngine() const; bool isMasterEngine() const;
DebuggerEngine *masterEngine() const; DebuggerEngine *masterEngine();
virtual DebuggerEngine *activeEngine() { return this; } virtual DebuggerEngine *activeEngine() { return this; }
virtual DebuggerEngine *cppEngine() { return 0; } virtual DebuggerEngine *cppEngine() { return 0; }
......
...@@ -348,12 +348,9 @@ void QmlEngine::tryToConnect() ...@@ -348,12 +348,9 @@ void QmlEngine::tryToConnect()
showMessage("QML Debugger: Trying to connect ...", LogStatus); showMessage("QML Debugger: Trying to connect ...", LogStatus);
d->retryOnConnectFail = true; d->retryOnConnectFail = true;
if (state() == EngineRunRequested) { if (state() == EngineRunRequested) {
if (isSlaveEngine()) { if (isDying()) {
// Probably cpp is being debugged and hence we did not get the output yet. // Probably cpp is being debugged and hence we did not get the output yet.
if (!masterEngine()->isDying()) appStartupFailed(tr("No application output received in time"));
beginConnection();
else
appStartupFailed(tr("No application output received in time"));
} else { } else {
beginConnection(); beginConnection();
} }
...@@ -779,7 +776,7 @@ void QmlEngine::attemptBreakpointSynchronization() ...@@ -779,7 +776,7 @@ void QmlEngine::attemptBreakpointSynchronization()
BreakHandler *handler = breakHandler(); BreakHandler *handler = breakHandler();
DebuggerEngine *bpOwner = isSlaveEngine() ? masterEngine() : this; DebuggerEngine *bpOwner = masterEngine();
foreach (Breakpoint bp, handler->unclaimedBreakpoints()) { foreach (Breakpoint bp, handler->unclaimedBreakpoints()) {
// Take ownership of the breakpoint. Requests insertion. // Take ownership of the breakpoint. Requests insertion.
if (acceptsBreakpoint(bp)) if (acceptsBreakpoint(bp))
......
...@@ -70,7 +70,7 @@ QmlInspectorAgent::QmlInspectorAgent(QmlEngine *engine, QmlDebugConnection *conn ...@@ -70,7 +70,7 @@ QmlInspectorAgent::QmlInspectorAgent(QmlEngine *engine, QmlDebugConnection *conn
, m_engineQueryId(0) , m_engineQueryId(0)
, m_rootContextQueryId(0) , m_rootContextQueryId(0)
, m_objectToSelect(WatchItem::InvalidId) , m_objectToSelect(WatchItem::InvalidId)
, m_masterEngine(engine) , m_masterEngine(engine->masterEngine())
, m_toolsClient(0) , m_toolsClient(0)
, m_targetToSync(NoTarget) , m_targetToSync(NoTarget)
, m_debugIdToSelect(WatchItem::InvalidId) , m_debugIdToSelect(WatchItem::InvalidId)
...@@ -92,9 +92,6 @@ QmlInspectorAgent::QmlInspectorAgent(QmlEngine *engine, QmlDebugConnection *conn ...@@ -92,9 +92,6 @@ QmlInspectorAgent::QmlInspectorAgent(QmlEngine *engine, QmlDebugConnection *conn
connect(&m_delayQueryTimer, &QTimer::timeout, connect(&m_delayQueryTimer, &QTimer::timeout,
this, &QmlInspectorAgent::queryEngineContext); this, &QmlInspectorAgent::queryEngineContext);
if (!m_masterEngine->isMasterEngine())
m_masterEngine = m_masterEngine->masterEngine();
auto engineClient1 = new DeclarativeEngineDebugClient(connection); auto engineClient1 = new DeclarativeEngineDebugClient(connection);
connect(engineClient1, &BaseEngineDebugClient::newState, connect(engineClient1, &BaseEngineDebugClient::newState,
this, &QmlInspectorAgent::clientStateChanged); this, &QmlInspectorAgent::clientStateChanged);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment