diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index ffec2314fddcded865d6f3adf1a2c56eaeee8f42..9d01a6333dc90cdb561a3df17dee0c64a289b6f6 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -216,7 +216,7 @@ public: m_disassemblerAgent(engine), m_memoryAgent(engine) { - connect(&m_locationTimer, SIGNAL(timeout()), SLOT(doRemoveLocationMark())); + connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation())); } ~DebuggerEnginePrivate() {} @@ -265,16 +265,19 @@ public slots: m_runControl->bringApplicationToForeground(m_inferiorPid); } - void removeLocationMark() + void scheduleResetLocation() { + m_stackHandler.scheduleResetLocation(); m_locationTimer.setSingleShot(true); m_locationTimer.start(80); } - void doRemoveLocationMark() + void resetLocation() { m_locationTimer.stop(); m_locationMark.reset(); + m_stackHandler.resetLocation(); + m_disassemblerAgent.resetLocation(); } public: @@ -508,8 +511,8 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) void DebuggerEngine::resetLocation() { - d->m_disassemblerAgent.resetLocation(); - d->removeLocationMark(); + // Do it after some delay to avoid flicker. + d->scheduleResetLocation(); } void DebuggerEngine::gotoLocation(const Location &loc) @@ -523,7 +526,7 @@ void DebuggerEngine::gotoLocation(const Location &loc) //if (m_shuttingDown) // return; - d->doRemoveLocationMark(); + d->resetLocation(); const QString file = loc.fileName(); const int line = loc.lineNumber(); @@ -865,7 +868,7 @@ void DebuggerEnginePrivate::doInterruptInferior() void DebuggerEnginePrivate::doShutdownInferior() { QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state()); - m_engine->resetLocation(); + resetLocation(); m_targetState = DebuggerFinished; m_engine->showMessage(_("CALL: SHUTDOWN INFERIOR")); m_engine->shutdownInferior(); @@ -933,7 +936,7 @@ void DebuggerEnginePrivate::doFinishDebugger() { m_engine->showMessage(_("NOTE: FINISH DEBUGGER")); QTC_ASSERT(state() == DebuggerFinished, qDebug() << state()); - m_engine->resetLocation(); + resetLocation(); if (!m_engine->isSlaveEngine()) { QTC_ASSERT(m_runControl, return); m_runControl->debuggingFinished(); @@ -977,7 +980,7 @@ void DebuggerEngine::notifyEngineSpontaneousShutdown() void DebuggerEngine::notifyInferiorExited() { showMessage(_("NOTE: INFERIOR EXITED")); - resetLocation(); + d->resetLocation(); // This can be issued in almost any state. We assume, though, // that at this point of time the inferior is not running anymore, diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp index b83f499ffe6c911aa1cc79ba984c6d15c146d13a..6a532623c2e42f5d9fa220095befd9dfc4cc252c 100644 --- a/src/plugins/debugger/stackhandler.cpp +++ b/src/plugins/debugger/stackhandler.cpp @@ -52,6 +52,8 @@ StackHandler::StackHandler() : m_positionIcon(QIcon(QLatin1String(":/debugger/images/location_16.png"))), m_emptyIcon(QIcon(QLatin1String(":/debugger/images/debugger_empty_14.png"))) { + m_resetLocationScheduled = false; + m_contentsValid = false; m_currentIndex = 0; m_canExpand = false; connect(debuggerCore()->action(OperateByInstruction), SIGNAL(triggered()), @@ -110,7 +112,8 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const if (role == Qt::DecorationRole && index.column() == 0) { // Return icon that indicates whether this is the active stack frame - return (index.row() == m_currentIndex) ? m_positionIcon : m_emptyIcon; + return (m_contentsValid && index.row() == m_currentIndex) + ? m_positionIcon : m_emptyIcon; } if (role == Qt::ToolTipRole) @@ -143,7 +146,8 @@ Qt::ItemFlags StackHandler::flags(const QModelIndex &index) const const StackFrame &frame = m_stackFrames.at(index.row()); const bool isValid = (frame.isUsable() && !frame.function.isEmpty()) || debuggerCore()->boolSetting(OperateByInstruction); - return isValid ? QAbstractTableModel::flags(index) : Qt::ItemFlags(0); + return isValid && m_contentsValid + ? QAbstractTableModel::flags(index) : Qt::ItemFlags(0); } StackFrame StackHandler::currentFrame() const @@ -178,6 +182,8 @@ void StackHandler::removeAll() void StackHandler::setFrames(const StackFrames &frames, bool canExpand) { + m_resetLocationScheduled = false; + m_contentsValid = true; m_canExpand = canExpand; m_stackFrames = frames; if (m_currentIndex >= m_stackFrames.size()) @@ -190,12 +196,18 @@ const StackFrames &StackHandler::frames() const return m_stackFrames; } -bool StackHandler::isDebuggingDebuggingHelpers() const +void StackHandler::scheduleResetLocation() { - for (int i = m_stackFrames.size(); --i >= 0; ) - if (m_stackFrames.at(i).function.startsWith(QLatin1String("qDumpObjectData"))) - return true; - return false; + m_resetLocationScheduled = true; + m_contentsValid = false; +} + +void StackHandler::resetLocation() +{ + if (m_resetLocationScheduled) { + m_resetLocationScheduled = false; + reset(); + } } } // namespace Internal diff --git a/src/plugins/debugger/stackhandler.h b/src/plugins/debugger/stackhandler.h index b23d0b07d0bcf1c4cc431c1a35a293df81937961..1ecb4ee3f31910f83c4142674197bb5575002e42 100644 --- a/src/plugins/debugger/stackhandler.h +++ b/src/plugins/debugger/stackhandler.h @@ -79,7 +79,9 @@ public: // Called from StackHandler after a new stack list has been received void removeAll(); QAbstractItemModel *model() { return this; } - bool isDebuggingDebuggingHelpers() const; + bool isContentsValid() const { return m_contentsValid; } + void scheduleResetLocation(); + void resetLocation(); private: // QAbstractTableModel @@ -95,6 +97,8 @@ private: const QVariant m_positionIcon; const QVariant m_emptyIcon; bool m_canExpand; + bool m_resetLocationScheduled; + bool m_contentsValid; }; } // namespace Internal