diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 9332ba12268..81b448db911 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -425,7 +425,6 @@ CdbEngine::CdbEngine(const DebuggerStartParameters &sp, m_tokenPrefix(""), m_options(options), m_effectiveStartMode(NoStartMode), - m_inferiorPid(0), m_accessible(false), m_specialStopMode(NoSpecialStop), m_nextCommandToken(0), @@ -453,7 +452,7 @@ CdbEngine::CdbEngine(const DebuggerStartParameters &sp, void CdbEngine::init() { m_effectiveStartMode = NoStartMode; - m_inferiorPid = 0; + notifyInferiorPid(0); m_accessible = false; m_specialStopMode = NoSpecialStop; m_nextCommandToken = 0; @@ -1117,7 +1116,7 @@ void CdbEngine::doContinueInferior() bool CdbEngine::canInterruptInferior() const { - return m_effectiveStartMode != AttachToRemote && m_inferiorPid; + return m_effectiveStartMode != AttachToRemote && inferiorPid(); } void CdbEngine::interruptInferior() @@ -1150,10 +1149,10 @@ void CdbEngine::doInterruptInferior(SpecialStopMode sm) const SpecialStopMode oldSpecialMode = m_specialStopMode; m_specialStopMode = sm; QString errorMessage; - showMessage(QString::fromLatin1("Interrupting process %1...").arg(m_inferiorPid), LogMisc); - if (!winDebugBreakProcess(m_inferiorPid, &errorMessage)) { + showMessage(QString::fromLatin1("Interrupting process %1...").arg(inferiorPid()), LogMisc); + if (!winDebugBreakProcess(inferiorPid(), &errorMessage)) { m_specialStopMode = oldSpecialMode; - showMessage(QString::fromLatin1("Cannot interrupt process %1: %2").arg(m_inferiorPid).arg(errorMessage), LogError); + showMessage(QString::fromLatin1("Cannot interrupt process %1: %2").arg(inferiorPid()).arg(errorMessage), LogError); } #else Q_UNUSED(sm) @@ -1594,8 +1593,7 @@ void CdbEngine::reloadFullStack() void CdbEngine::handlePid(const CdbExtensionCommandPtr &reply) { if (reply->success) { - m_inferiorPid = reply->reply.toUInt(); - showMessage(QString::fromLatin1("Inferior pid: %1.").arg(m_inferiorPid), LogMisc); + notifyInferiorPid(reply->reply.toULongLong()); STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorSetupOk") notifyInferiorSetupOk(); } else { diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h index 54eaa626138..827805d43bc 100644 --- a/src/plugins/debugger/cdb/cdbengine.h +++ b/src/plugins/debugger/cdb/cdbengine.h @@ -249,7 +249,6 @@ private: QScopedPointer m_consoleStub; DebuggerStartMode m_effectiveStartMode; QByteArray m_outputBuffer; - unsigned long m_inferiorPid; //! Debugger accessible (expecting commands) bool m_accessible; SpecialStopMode m_specialStopMode; diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 50f7de2a622..e6b335d808e 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -291,6 +291,7 @@ DebuggerEngine::DebuggerEngine(const DebuggerStartParameters &startParameters, DebuggerEngine *parentEngine) : d(new DebuggerEnginePrivate(this, parentEngine, startParameters)) { + d->m_inferiorPid = 0; } DebuggerEngine::~DebuggerEngine() @@ -1167,11 +1168,16 @@ bool DebuggerEngine::debuggerActionsEnabled(DebuggerState state) void DebuggerEngine::notifyInferiorPid(qint64 pid) { - showMessage(tr("Taking notice of pid %1").arg(pid)); if (d->m_inferiorPid == pid) return; d->m_inferiorPid = pid; - QTimer::singleShot(0, d, SLOT(raiseApplication())); + if (pid) { + showMessage(tr("Taking notice of pid %1").arg(pid)); + if (d->m_startParameters.startMode == StartInternal + || d->m_startParameters.startMode == StartExternal + || d->m_startParameters.startMode == AttachExternal) + QTimer::singleShot(0, d, SLOT(raiseApplication())); + } } qint64 DebuggerEngine::inferiorPid() const