Commit 88a25204 authored by hjk's avatar hjk
Browse files

debugger: fix attaching to running process

parent d5f76338
......@@ -112,6 +112,13 @@ void AttachGdbAdapter::prepareInferior()
{
QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
setState(InferiorPreparing);
setState(InferiorPrepared);
emit inferiorPrepared();
}
void AttachGdbAdapter::startInferior()
{
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
const qint64 pid = startParameters().attachPID;
m_engine->postCommand(_("attach %1").arg(pid), CB(handleAttach));
// Task 254674 does not want to remove them
......@@ -120,31 +127,19 @@ void AttachGdbAdapter::prepareInferior()
void AttachGdbAdapter::handleAttach(const GdbResponse &response)
{
QTC_ASSERT(state() == InferiorPreparing, qDebug() << state());
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
if (response.resultClass == GdbResultDone) {
setState(InferiorPrepared);
emit inferiorPrepared();
setState(InferiorStopped);
debugMessage(_("INFERIOR STARTED"));
showStatusMessage(tr("Attached to stopped inferior."));
m_engine->updateAll();
} else if (response.resultClass == GdbResultError) {
QString msg = __(response.data.findChild("msg").data());
setState(InferiorPreparationFailed);
emit inferiorPreparationFailed(msg);
emit inferiorStartFailed(msg);
}
}
void AttachGdbAdapter::startInferior()
{
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
#if 1
setState(InferiorStopped);
debugMessage(_("INFERIOR STARTED"));
showStatusMessage(tr("Attached to stopped inferior."));
#else
// continue on attach
setState(InferiorRunningRequested);
m_engine->postCommand(_("-exec-continue"), CB(handleContinue));
#endif
}
void AttachGdbAdapter::handleContinue(const GdbResponse &response)
{
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
......
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