diff --git a/src/plugins/debugger/debuggercore.h b/src/plugins/debugger/debuggercore.h index d48186706211bdb33dd0f56c059dc6b8a6f7357c..128fe9c56d02a7776a3c9a8038c50938644bcc57 100644 --- a/src/plugins/debugger/debuggercore.h +++ b/src/plugins/debugger/debuggercore.h @@ -112,6 +112,7 @@ QMessageBox *showMessageBox(int icon, const QString &title, bool isNativeMixedActive(); bool isNativeMixedEnabled(); +bool isReverseDebuggingEnabled(); } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 0d802fb3698c6e453ce33862db7fd78368e9aff4..7128888c846b35b83d34d7f0b3d2da4088da6d1d 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -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); diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp index 259f7acefe61ac8aebe25b449c6d5570a8c81a58..713c37e6ffb0ea3f51042eec398a77fdc784ec05 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.cpp +++ b/src/plugins/debugger/gdb/gdboptionspage.cpp @@ -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( - "

Enables stepping backwards.

" - "Note: 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.

")); + if (isReverseDebuggingEnabled()) { + checkBoxEnableReverseDebugging = new QCheckBox(groupBoxDangerous); + checkBoxEnableReverseDebugging->setText(GdbOptionsPage::tr("Enable reverse debugging")); + checkBoxEnableReverseDebugging->setToolTip(GdbOptionsPage::tr( + "

Enables stepping backwards.

" + "Note: 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.

")); + } 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()