Commit 77a9b6d8 authored by hjk's avatar hjk

Debugger: Hide the reverse debugging feature

It's still available with QTC_DEBUGGER_ENABLE_REVERSE=1, but
since it rarely ever does something useful, it's better not
exposed in the gui.

Change-Id: If571fcfd01579c53f792d799027dd9d9a93c1cf4
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 562f305e
......@@ -112,6 +112,7 @@ QMessageBox *showMessageBox(int icon, const QString &title,
bool isNativeMixedActive();
bool isNativeMixedEnabled();
bool isReverseDebuggingEnabled();
} // namespace Internal
} // namespace Debugger
......
......@@ -2393,6 +2393,17 @@ bool isNativeMixedActive()
return isNativeMixedEnabled() && boolSetting(OperateNativeMixed);
}
bool isReverseDebuggingEnabled()
{
static bool enabled = qEnvironmentVariableIsSet("QTC_DEBUGGER_ENABLE_REVERSE");
return enabled;
}
bool isReverseDebugging()
{
return isReverseDebuggingEnabled() && dd->m_reverseDirectionAction->isChecked();
}
void DebuggerPluginPrivate::extensionsInitialized()
{
const QKeySequence debugKey = QKeySequence(UseMacShortcuts ? tr("Ctrl+Y") : tr("F5"));
......@@ -2545,8 +2556,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
//m_snapshotAction->setIcon(
// QIcon(__(":/debugger/images/debugger_snapshot_small.png")));
act = m_reverseDirectionAction =
new QAction(tr("Reverse Direction"), this);
act = m_reverseDirectionAction = new QAction(tr("Reverse Direction"), this);
act->setCheckable(true);
act->setChecked(false);
act->setCheckable(false);
......@@ -2794,11 +2804,13 @@ void DebuggerPluginPrivate::extensionsInitialized()
cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd);
cmd = ActionManager::registerAction(m_reverseDirectionAction,
Constants::REVERSE, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString() : tr("F12")));
cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd);
if (isReverseDebuggingEnabled()) {
cmd = ActionManager::registerAction(m_reverseDirectionAction,
Constants::REVERSE, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString() : tr("F12")));
cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd);
}
debugMenu->addSeparator();
......@@ -2964,10 +2976,10 @@ void DebuggerPluginPrivate::extensionsInitialized()
if (isNativeMixedEnabled())
hbox->addWidget(toolButton(Constants::OPERATE_NATIVE_MIXED));
//hbox->addWidget(new StyledSeparator);
m_reverseToolButton = toolButton(Constants::REVERSE);
hbox->addWidget(m_reverseToolButton);
//m_reverseToolButton->hide();
if (isReverseDebuggingEnabled()) {
m_reverseToolButton = toolButton(Constants::REVERSE);
hbox->addWidget(m_reverseToolButton);
}
hbox->addWidget(new StyledSeparator);
hbox->addWidget(new QLabel(tr("Threads:")));
......@@ -3155,11 +3167,6 @@ void showMessage(const QString &msg, int channel, int timeout)
dd->showMessage(msg, channel, timeout);
}
bool isReverseDebugging()
{
return dd->m_reverseDirectionAction->isChecked();
}
void runControlStarted(DebuggerEngine *engine)
{
dd->runControlStarted(engine);
......
......@@ -388,13 +388,15 @@ GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent)
checkBoxBreakOnAbort->setText(CommonOptionsPage::msgSetBreakpointAtFunction("abort"));
checkBoxBreakOnAbort->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("abort"));
checkBoxEnableReverseDebugging = new QCheckBox(groupBoxDangerous);
checkBoxEnableReverseDebugging->setText(GdbOptionsPage::tr("Enable reverse debugging"));
checkBoxEnableReverseDebugging->setToolTip(GdbOptionsPage::tr(
"<html><head/><body><p>Enables stepping backwards.</p><p>"
"<b>Note:</b> This feature is very slow and unstable on the GDB side. "
"It exhibits unpredictable behavior when going backwards over system "
"calls and is very likely to destroy your debugging session.</p></body></html>"));
if (isReverseDebuggingEnabled()) {
checkBoxEnableReverseDebugging = new QCheckBox(groupBoxDangerous);
checkBoxEnableReverseDebugging->setText(GdbOptionsPage::tr("Enable reverse debugging"));
checkBoxEnableReverseDebugging->setToolTip(GdbOptionsPage::tr(
"<html><head/><body><p>Enables stepping backwards.</p><p>"
"<b>Note:</b> This feature is very slow and unstable on the GDB side. "
"It exhibits unpredictable behavior when going backwards over system "
"calls and is very likely to destroy your debugging session.</p></body></html>"));
}
checkBoxAttemptQuickStart = new QCheckBox(groupBoxDangerous);
checkBoxAttemptQuickStart->setText(GdbOptionsPage::tr("Attempt quick start"));
......@@ -417,7 +419,8 @@ GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent)
formLayout->addRow(checkBoxBreakOnWarning);
formLayout->addRow(checkBoxBreakOnFatal);
formLayout->addRow(checkBoxBreakOnAbort);
formLayout->addRow(checkBoxEnableReverseDebugging);
if (isReverseDebuggingEnabled())
formLayout->addRow(checkBoxEnableReverseDebugging);
formLayout->addRow(checkBoxAttemptQuickStart);
formLayout->addRow(checkBoxMultiInferior);
......@@ -431,7 +434,8 @@ GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent)
group.insert(action(BreakOnAbort), checkBoxBreakOnAbort);
group.insert(action(AttemptQuickStart), checkBoxAttemptQuickStart);
group.insert(action(MultiInferior), checkBoxMultiInferior);
group.insert(action(EnableReverseDebugging), checkBoxEnableReverseDebugging);
if (isReverseDebuggingEnabled())
group.insert(action(EnableReverseDebugging), checkBoxEnableReverseDebugging);
}
GdbOptionsPage2::GdbOptionsPage2()
......
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