Commit b93f9af3 authored by Eike Ziller's avatar Eike Ziller Committed by hjk

Debugger: Fix restoring of previous mode

We have many code paths now that try to make sure that we really end up
with debug mode when debugging, leading to multiple calls of
activateDebugMode when starting the debugger. Separate ensuring debug
mode from saving the previous mode to avoid that debug mode is always
the previous mode.

Change-Id: Ie9687e2de816b6ae55945b6108a5d4f760962f89
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 3bf19030
......@@ -76,6 +76,7 @@ void runControlFinished(DebuggerEngine *engine);
void displayDebugger(DebuggerEngine *engine, bool updateEngine);
void synchronizeBreakpoints();
void saveModeToRestore();
QWidget *mainWindow();
bool isRegistersWindowVisible();
bool isModulesWindowVisible();
......
......@@ -2691,7 +2691,6 @@ void DebuggerPluginPrivate::activateDebugMode()
{
m_reverseDirectionAction->setChecked(false);
m_reverseDirectionAction->setEnabled(false);
m_previousMode = ModeManager::currentMode()->id();
ModeManager::activateMode(MODE_DEBUG);
}
......@@ -3315,6 +3314,11 @@ void DebuggerPluginPrivate::onModeChanged(IMode *mode)
}
}
void saveModeToRestore()
{
dd->m_previousMode = ModeManager::currentMode()->id();
}
} // namespace Internal
bool ActionDescription::isRunnable(QString *reason) const
......
......@@ -141,6 +141,7 @@ QString DebuggerRunControl::displayName() const
void DebuggerRunControl::start()
{
Debugger::Internal::saveModeToRestore();
Debugger::selectPerspective(Debugger::Constants::CppPerspectiveId);
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME);
......
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