diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 572b3bf8442..53dcd168660 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -1073,7 +1073,9 @@ unsigned CdbEngine::debuggerCapabilities() const |ReloadModuleCapability |BreakOnThrowAndCatchCapability // Sort-of: Can break on throw(). |BreakConditionCapability|TracePointCapability - |BreakModuleCapability; + |BreakModuleCapability + |OperateByInstructionCapability + |RunToLineCapability; } void CdbEngine::executeStep() diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h index c54a4d41ade..d72a8051bc0 100644 --- a/src/plugins/debugger/debuggerconstants.h +++ b/src/plugins/debugger/debuggerconstants.h @@ -151,6 +151,8 @@ enum DebuggerCapabilities WatchpointByExpressionCapability = 0x20000, ShowModuleSymbolsCapability = 0x40000, CatchCapability = 0x80000, //!< fork, vfork, syscall + OperateByInstructionCapability = 0x100000, + RunToLineCapability = 0x200000, AllDebuggerCapabilities = 0xFFFFFFFF }; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index a3f5038fb45..7816bbe6511 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1704,19 +1704,20 @@ void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor, // Run to, jump to line below in stopped state. if (currentEngine()->state() == InferiorStopOk && contextUsable) { menu->addSeparator(); - const QString runText = args.address - ? DebuggerEngine::tr("Run to Address 0x%1").arg(args.address, 0, 16) - : DebuggerEngine::tr("Run to Line %1").arg(args.lineNumber); - QAction *runToLineAction = new QAction(runText, menu); - runToLineAction->setData(QVariant::fromValue(args)); - connect(runToLineAction, SIGNAL(triggered()), SLOT(slotRunToLine())); - menu->addAction(runToLineAction); + if (currentEngine()->debuggerCapabilities() & RunToLineCapability) { + const QString runText = args.address + ? DebuggerEngine::tr("Run to Address 0x%1").arg(args.address, 0, 16) + : DebuggerEngine::tr("Run to Line %1").arg(args.lineNumber); + QAction *runToLineAction = new QAction(runText, menu); + runToLineAction->setData(QVariant::fromValue(args)); + connect(runToLineAction, SIGNAL(triggered()), SLOT(slotRunToLine())); + menu->addAction(runToLineAction); + } if (currentEngine()->debuggerCapabilities() & JumpToLineCapability) { const QString jumpText = args.address ? DebuggerEngine::tr("Jump to Address 0x%1").arg(args.address, 0, 16) : DebuggerEngine::tr("Jump to Line %1").arg(args.lineNumber); QAction *jumpToLineAction = new QAction(jumpText, menu); - menu->addAction(runToLineAction); jumpToLineAction->setData(QVariant::fromValue(args)); connect(jumpToLineAction, SIGNAL(triggered()), SLOT(slotJumpToLine())); menu->addAction(jumpToLineAction); @@ -2057,7 +2058,9 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) m_watchAction2->setEnabled(true); m_breakAction->setEnabled(true); - action(OperateByInstruction)->setEnabled(stopped || isCore); + const bool canOperateByInstruction = (caps & OperateByInstructionCapability) + && (stopped || isCore); + action(OperateByInstruction)->setEnabled(canOperateByInstruction); m_resetAction->setEnabled(state != DebuggerNotReady && state != DebuggerFinished); @@ -2066,7 +2069,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) m_nextAction->setEnabled(stopped || state == DebuggerNotReady); m_stepOutAction->setEnabled(stopped); - m_runToLineAction->setEnabled(stopped); + m_runToLineAction->setEnabled(stopped && (caps & RunToLineCapability)); m_runToSelectedFunctionAction->setEnabled(stopped); m_returnFromFunctionAction-> setEnabled(stopped && (caps & ReturnFromFunctionCapability)); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index bc0fe6532d9..8a2c359b5f5 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1890,7 +1890,9 @@ unsigned GdbEngine::debuggerCapabilities() const | WatchpointByExpressionCapability | AddWatcherCapability | ShowModuleSymbolsCapability - | CatchCapability; + | CatchCapability + | OperateByInstructionCapability + | RunToLineCapability; if (startParameters().startMode == AttachCore) return caps;