Commit a547aee8 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer

Introduced capabilities for OperateByInstruction and RunToLine

The ScriptEngine does not support these actions, so make sure they are
disabled in the debugger menu.

Reviewed-by: hjk
Task-number: QTCREATORBUG-2749
parent e1f89cfa
......@@ -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()
......
......@@ -151,6 +151,8 @@ enum DebuggerCapabilities
WatchpointByExpressionCapability = 0x20000,
ShowModuleSymbolsCapability = 0x40000,
CatchCapability = 0x80000, //!< fork, vfork, syscall
OperateByInstructionCapability = 0x100000,
RunToLineCapability = 0x200000,
AllDebuggerCapabilities = 0xFFFFFFFF
};
......
......@@ -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));
......
......@@ -1890,7 +1890,9 @@ unsigned GdbEngine::debuggerCapabilities() const
| WatchpointByExpressionCapability
| AddWatcherCapability
| ShowModuleSymbolsCapability
| CatchCapability;
| CatchCapability
| OperateByInstructionCapability
| RunToLineCapability;
if (startParameters().startMode == AttachCore)
return caps;
......
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