Commit 0d07a4ab authored by hjk's avatar hjk

debugger: use a 80ms timer to actually remode the location marker

This removes the remove/set flicker in most single stepping cases.
parent 73e4cce7
......@@ -1078,15 +1078,35 @@ public slots:
public slots:
void updateDebugActions();
void handleExecDetach() { currentEngine()->detachDebugger(); }
void handleExecContinue() { currentEngine()->continueInferior(); }
void handleExecInterrupt() { currentEngine()->requestInterruptInferior(); }
void handleExecReset() { currentEngine()->notifyEngineIll(); } // FIXME: Check.
void handleExecDetach()
{
resetLocation();
currentEngine()->detachDebugger();
}
void handleExecContinue()
{
resetLocation();
currentEngine()->continueInferior();
}
void handleExecInterrupt()
{
resetLocation();
currentEngine()->requestInterruptInferior();
}
void handleExecReset()
{
resetLocation();
currentEngine()->notifyEngineIll(); // FIXME: Check.
}
void handleExecStep()
{
resetLocation();
if (debuggerCore()->boolSetting(OperateByInstruction))
if (boolSetting(OperateByInstruction))
currentEngine()->executeStepI();
else
currentEngine()->executeStep();
......@@ -1095,7 +1115,7 @@ public slots:
void handleExecNext()
{
resetLocation();
if (debuggerCore()->boolSetting(OperateByInstruction))
if (boolSetting(OperateByInstruction))
currentEngine()->executeNextI();
else
currentEngine()->executeNext();
......@@ -1249,7 +1269,9 @@ public slots:
}
void resetLocation();
void resetLocationTimeout();
void removeLocationMark();
void doRemoveLocationMark();
QVariant sessionValue(const QString &name);
void setSessionValue(const QString &name, const QVariant &value);
QIcon locationMarkIcon() const { return m_locationMarkIcon; }
......@@ -1329,6 +1351,7 @@ public:
bool m_busy;
QTimer m_statusTimer;
QTimer m_locationTimer;
QString m_lastPermanentStatusMessage;
mutable CPlusPlus::Snapshot m_codeModelSnapshot;
......@@ -1342,13 +1365,14 @@ public:
bool m_gdbBinariesChanged;
};
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) : m_startRemoteCdbAction(0)
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin)
{
QTC_ASSERT(!theDebuggerCore, /**/);
theDebuggerCore = this;
m_plugin = plugin;
m_startRemoteCdbAction = 0;
m_shuttingDown = false;
m_statusLabel = 0;
m_threadBox = 0;
......@@ -1583,12 +1607,12 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
act = m_actions.frameUpAction = new QAction(tr("Move to Calling Frame"), this);
connect(act, SIGNAL(triggered()), SLOT(handleFrameUp()));
connect(debuggerCore()->action(OperateByInstruction), SIGNAL(triggered(bool)),
connect(action(OperateByInstruction), SIGNAL(triggered(bool)),
SLOT(handleOperateByInstructionTriggered(bool)));
connect(&m_statusTimer, SIGNAL(timeout()), SLOT(clearStatusMessage()));
connect(debuggerCore()->action(ExecuteCommand), SIGNAL(triggered()),
connect(action(ExecuteCommand), SIGNAL(triggered()),
SLOT(executeDebuggerCommand()));
// Cpp/Qml ui setup
......@@ -1866,7 +1890,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
Constants::FRAME_UP, cppDebuggercontext);
cmd = am->registerAction(debuggerCore()->action(OperateByInstruction),
cmd = am->registerAction(action(OperateByInstruction),
Constants::OPERATE_BY_INSTRUCTION, cppDebuggercontext);
cmd->setAttribute(Command::CA_Hide);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
......@@ -1962,7 +1986,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
SLOT(editorOpened(Core::IEditor*)));
// Application interaction
connect(debuggerCore()->action(SettingsDialog), SIGNAL(triggered()),
connect(action(SettingsDialog), SIGNAL(triggered()),
SLOT(showSettingsDialog()));
// Toolbar
......@@ -1998,7 +2022,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
SIGNAL(dockResetRequested(Debugger::DebuggerLanguages)),
SLOT(setSimpleDockWidgetArrangement(Debugger::DebuggerLanguages)));
connect(debuggerCore()->action(EnableReverseDebugging),
connect(action(EnableReverseDebugging),
SIGNAL(valueChanged(QVariant)),
SLOT(enableReverseDebuggingTriggered(QVariant)));
......@@ -2014,6 +2038,10 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
SLOT(onCurrentProjectChanged(ProjectExplorer::Project*)));
connect(&m_locationTimer,
SIGNAL(timeout()),
SLOT(doRemoveLocationMark()));
return true;
}
......@@ -2666,7 +2694,7 @@ void DebuggerPluginPrivate::setInitialState()
m_actions.watchAction2->setEnabled(true);
m_actions.breakAction->setEnabled(true);
//m_actions.snapshotAction->setEnabled(false);
debuggerCore()->action(OperateByInstruction)->setEnabled(false);
action(OperateByInstruction)->setEnabled(false);
m_actions.exitAction->setEnabled(false);
m_actions.resetAction->setEnabled(false);
......@@ -2679,9 +2707,9 @@ void DebuggerPluginPrivate::setInitialState()
m_actions.jumpToLineAction->setEnabled(false);
m_actions.nextAction->setEnabled(false);
debuggerCore()->action(AutoDerefPointers)->setEnabled(true);
debuggerCore()->action(ExpandStack)->setEnabled(false);
debuggerCore()->action(ExecuteCommand)->setEnabled(m_state == InferiorStopOk);
action(AutoDerefPointers)->setEnabled(true);
action(ExpandStack)->setEnabled(false);
action(ExecuteCommand)->setEnabled(m_state == InferiorStopOk);
m_scriptConsoleWindow->setEnabled(false);
......@@ -2793,7 +2821,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
const uint caps = engine->debuggerCapabilities();
const bool canReverse = (caps & ReverseSteppingCapability)
&& debuggerCore()->boolSetting(EnableReverseDebugging);
&& boolSetting(EnableReverseDebugging);
m_actions.reverseDirectionAction->setEnabled(canReverse);
m_actions.watchAction1->setEnabled(true);
......@@ -2801,7 +2829,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_actions.breakAction->setEnabled(true);
//m_actions.snapshotAction->setEnabled(stopped && (caps & SnapshotCapability));
debuggerCore()->action(OperateByInstruction)->setEnabled(stopped);
action(OperateByInstruction)->setEnabled(stopped);
m_actions.resetAction->setEnabled(m_state != DebuggerNotReady
&& m_state != DebuggerFinished);
......@@ -2819,10 +2847,10 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_actions.nextAction->setEnabled(stopped);
const bool canDeref = actionsEnabled && (caps & AutoDerefPointersCapability);
debuggerCore()->action(AutoDerefPointers)->setEnabled(canDeref);
debuggerCore()->action(AutoDerefPointers)->setEnabled(true);
debuggerCore()->action(ExpandStack)->setEnabled(actionsEnabled);
debuggerCore()->action(ExecuteCommand)->setEnabled(m_state == InferiorStopOk);
action(AutoDerefPointers)->setEnabled(canDeref);
action(AutoDerefPointers)->setEnabled(true);
action(ExpandStack)->setEnabled(actionsEnabled);
action(ExecuteCommand)->setEnabled(m_state == InferiorStopOk);
const bool notbusy = m_state == InferiorStopOk
|| m_state == DebuggerNotReady
......@@ -2846,6 +2874,8 @@ void DebuggerPluginPrivate::gotoLocation(const QString &file, int line, bool set
if (m_shuttingDown)
return;
doRemoveLocationMark();
bool newEditor = false;
ITextEditor *editor =
BaseTextEditor::openEditorAt(file, line, 0, QString(),
......@@ -3002,9 +3032,9 @@ void DebuggerPluginPrivate::readSettings()
const CPlusPlus::Snapshot &DebuggerPluginPrivate::cppCodeModelSnapshot() const
{
if (m_codeModelSnapshot.isEmpty()
&& debuggerCore()->action(UseCodeModel)->isChecked())
m_codeModelSnapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
using namespace CppTools;
if (m_codeModelSnapshot.isEmpty() && action(UseCodeModel)->isChecked())
m_codeModelSnapshot = CppModelManagerInterface::instance()->snapshot();
return m_codeModelSnapshot;
}
......@@ -3015,6 +3045,13 @@ void DebuggerPluginPrivate::resetLocation()
void DebuggerPluginPrivate::removeLocationMark()
{
m_locationTimer.setSingleShot(true);
m_locationTimer.start(80);
}
void DebuggerPluginPrivate::doRemoveLocationMark()
{
m_locationTimer.stop();
m_locationMark.reset();
}
......@@ -3114,8 +3151,7 @@ void DebuggerPluginPrivate::showQtDumperLibraryWarning(const QString &details)
_(Qt4ProjectManager::Constants::QT_SETTINGS_CATEGORY),
_(Qt4ProjectManager::Constants::QTVERSION_SETTINGS_PAGE_ID));
} else if (dialog.clickedButton() == helperOff) {
debuggerCore()->action(UseDebuggingHelpers)
->setValue(qVariantFromValue(false), false);
action(UseDebuggingHelpers)->setValue(qVariantFromValue(false), false);
}
}
......@@ -3153,9 +3189,8 @@ void DebuggerPluginPrivate::runControlFinished(DebuggerRunControl *runControl)
{
m_snapshotHandler->removeSnapshot(runControl);
disconnectEngine();
if (debuggerCore()->boolSetting(SwitchModeOnExit))
if (m_snapshotHandler->size() == 0)
activatePreviousMode();
if (boolSetting(SwitchModeOnExit) && m_snapshotHandler->size() == 0)
activatePreviousMode();
}
void DebuggerPluginPrivate::remoteCommand(const QStringList &options,
......
......@@ -1797,9 +1797,6 @@ void GdbEngine::autoContinueInferior()
void GdbEngine::continueInferior()
{
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
// Not doing it here makes it appear "snappier" as the time
// when there is no location marker is shorter.
//resetLocation();
setTokenBarrier();
continueInferiorInternal();
}
......@@ -3016,7 +3013,6 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response)
void GdbEngine::activateFrame(int frameIndex)
{
//resetLocation();
if (state() != InferiorStopOk && state() != InferiorUnrunnable)
return;
......
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