debugger: implement basic support for gdb's 'return' command

Returning a value is not yet supported.
This commit is contained in:
hjk
2010-02-15 16:02:41 +01:00
parent feb181ce5e
commit c6e88eec0e
8 changed files with 52 additions and 7 deletions

View File

@@ -1711,7 +1711,8 @@ unsigned GdbEngine::debuggerCapabilities() const
| AutoDerefPointersCapability | DisassemblerCapability
| RegisterCapability | ShowMemoryCapability
| JumpToLineCapability | ReloadModuleCapability
| ReloadModuleSymbolsCapability | BreakOnThrowAndCatchCapability;
| ReloadModuleSymbolsCapability | BreakOnThrowAndCatchCapability
| ReturnFromFunctionCapability;
}
void GdbEngine::continueInferiorInternal()
@@ -1902,6 +1903,21 @@ void GdbEngine::jumpToLineExec(const QString &fileName, int lineNumber)
#endif
}
void GdbEngine::returnExec()
{
QTC_ASSERT(state() == InferiorStopped, qDebug() << state());
setTokenBarrier();
setState(InferiorRunningRequested);
showStatusMessage(tr("Immediate return from function requested..."), 5000);
postCommand("-exec-finish", RunRequest, CB(handleExecReturn));
}
void GdbEngine::handleExecReturn(const GdbResponse &response)
{
if (response.resultClass == GdbResultDone) {
updateAll();
}
}
/*!
\fn void GdbEngine::setTokenBarrier()
\brief Discard the results of all pending watch-updating commands.

View File

@@ -296,10 +296,12 @@ private: ////////// Inferior Management //////////
virtual void runToFunctionExec(const QString &functionName);
// void handleExecRunToFunction(const GdbResponse &response);
virtual void jumpToLineExec(const QString &fileName, int lineNumber);
virtual void returnExec();
void handleExecContinue(const GdbResponse &response);
void handleExecStep(const GdbResponse &response);
void handleExecNext(const GdbResponse &response);
void handleExecReturn(const GdbResponse &response);
qint64 inferiorPid() const { return m_manager->inferiorPid(); }
void handleInferiorPidChanged(qint64 pid) { manager()->notifyInferiorPidChanged(pid); }