forked from qt-creator/qt-creator
fold preparing inferior into starting inferior
after refactoring the trk adapter startup, the split was not necessary any more. in fact, it seemed fairly arbitrary at this point.
This commit is contained in:
@@ -635,7 +635,6 @@ void CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters>
|
|||||||
m_d->m_inferiorStartupComplete = false;
|
m_d->m_inferiorStartupComplete = false;
|
||||||
setState(AdapterStarted, Q_FUNC_INFO, __LINE__);
|
setState(AdapterStarted, Q_FUNC_INFO, __LINE__);
|
||||||
|
|
||||||
setState(InferiorPreparing, Q_FUNC_INFO, __LINE__);
|
|
||||||
const DebuggerStartMode mode = sp->startMode;
|
const DebuggerStartMode mode = sp->startMode;
|
||||||
// Figure out dumper. @TODO: same in gdb...
|
// Figure out dumper. @TODO: same in gdb...
|
||||||
const QString dumperLibName = QDir::toNativeSeparators(manager()->qtDumperLibraryName());
|
const QString dumperLibName = QDir::toNativeSeparators(manager()->qtDumperLibraryName());
|
||||||
@@ -654,7 +653,6 @@ void CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters>
|
|||||||
}
|
}
|
||||||
m_d->m_dumper->reset(dumperLibName, dumperEnabled);
|
m_d->m_dumper->reset(dumperLibName, dumperEnabled);
|
||||||
|
|
||||||
setState(InferiorPrepared, Q_FUNC_INFO, __LINE__);
|
|
||||||
setState(InferiorStarting, Q_FUNC_INFO, __LINE__);
|
setState(InferiorStarting, Q_FUNC_INFO, __LINE__);
|
||||||
manager()->showStatusMessage("Starting Debugger", -1);
|
manager()->showStatusMessage("Starting Debugger", -1);
|
||||||
|
|
||||||
|
|||||||
@@ -69,9 +69,6 @@ enum DebuggerState
|
|||||||
AdapterStarting,
|
AdapterStarting,
|
||||||
AdapterStarted,
|
AdapterStarted,
|
||||||
AdapterStartFailed,
|
AdapterStartFailed,
|
||||||
InferiorPreparing,
|
|
||||||
InferiorPrepared,
|
|
||||||
InferiorPreparationFailed,
|
|
||||||
InferiorUnrunnable, // Used in the core dump adapter
|
InferiorUnrunnable, // Used in the core dump adapter
|
||||||
InferiorStarting,
|
InferiorStarting,
|
||||||
// InferiorStarted, // Use InferiorRunningRequested or InferiorStopped
|
// InferiorStarted, // Use InferiorRunningRequested or InferiorStopped
|
||||||
|
|||||||
@@ -107,10 +107,6 @@
|
|||||||
// |
|
// |
|
||||||
// AdapterStarted
|
// AdapterStarted
|
||||||
// |
|
// |
|
||||||
// InferiorPreparing --> InferiorPreparationFailed --> 0
|
|
||||||
// |
|
|
||||||
// InferiorPrepared
|
|
||||||
// |
|
|
||||||
// InferiorStarting --> InferiorStartFailed --> 0
|
// InferiorStarting --> InferiorStartFailed --> 0
|
||||||
// |
|
// |
|
||||||
// (core) | (attach) (remote)
|
// (core) | (attach) (remote)
|
||||||
@@ -199,9 +195,6 @@ static const char *stateName(int s)
|
|||||||
SN(AdapterStarting)
|
SN(AdapterStarting)
|
||||||
SN(AdapterStarted)
|
SN(AdapterStarted)
|
||||||
SN(AdapterStartFailed)
|
SN(AdapterStartFailed)
|
||||||
SN(InferiorPreparing)
|
|
||||||
SN(InferiorPrepared)
|
|
||||||
SN(InferiorPreparationFailed)
|
|
||||||
SN(InferiorStarting)
|
SN(InferiorStarting)
|
||||||
SN(InferiorStartFailed)
|
SN(InferiorStartFailed)
|
||||||
SN(InferiorRunningRequested)
|
SN(InferiorRunningRequested)
|
||||||
@@ -1564,15 +1557,8 @@ static bool isAllowedTransition(int from, int to)
|
|||||||
case AdapterStarting:
|
case AdapterStarting:
|
||||||
return to == AdapterStarted || to == AdapterStartFailed;
|
return to == AdapterStarted || to == AdapterStartFailed;
|
||||||
case AdapterStarted:
|
case AdapterStarted:
|
||||||
return to == InferiorPreparing;
|
|
||||||
case AdapterStartFailed:
|
|
||||||
return to == DebuggerNotReady;
|
|
||||||
|
|
||||||
case InferiorPreparing:
|
|
||||||
return to == InferiorPrepared || to == InferiorPreparationFailed;
|
|
||||||
case InferiorPrepared:
|
|
||||||
return to == InferiorStarting;
|
return to == InferiorStarting;
|
||||||
case InferiorPreparationFailed:
|
case AdapterStartFailed:
|
||||||
return to == DebuggerNotReady;
|
return to == DebuggerNotReady;
|
||||||
|
|
||||||
case InferiorStarting:
|
case InferiorStarting:
|
||||||
@@ -1695,7 +1681,6 @@ bool DebuggerManager::debuggerActionsEnabled() const
|
|||||||
if (!d->m_engine)
|
if (!d->m_engine)
|
||||||
return false;
|
return false;
|
||||||
switch (state()) {
|
switch (state()) {
|
||||||
case InferiorPrepared:
|
|
||||||
case InferiorStarting:
|
case InferiorStarting:
|
||||||
case InferiorRunningRequested:
|
case InferiorRunningRequested:
|
||||||
case InferiorRunning:
|
case InferiorRunning:
|
||||||
@@ -1708,8 +1693,6 @@ bool DebuggerManager::debuggerActionsEnabled() const
|
|||||||
case AdapterStarting:
|
case AdapterStarting:
|
||||||
case AdapterStarted:
|
case AdapterStarted:
|
||||||
case AdapterStartFailed:
|
case AdapterStartFailed:
|
||||||
case InferiorPreparing:
|
|
||||||
case InferiorPreparationFailed:
|
|
||||||
case InferiorStartFailed:
|
case InferiorStartFailed:
|
||||||
case InferiorStopFailed:
|
case InferiorStopFailed:
|
||||||
case InferiorShuttingDown:
|
case InferiorShuttingDown:
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ public:
|
|||||||
virtual bool isTrkAdapter() const; // isUtterlyBrokenAdapter
|
virtual bool isTrkAdapter() const; // isUtterlyBrokenAdapter
|
||||||
|
|
||||||
virtual void startAdapter() = 0;
|
virtual void startAdapter() = 0;
|
||||||
virtual void prepareInferior() = 0;
|
|
||||||
virtual void startInferior() = 0;
|
virtual void startInferior() = 0;
|
||||||
virtual void interruptInferior() = 0;
|
virtual void interruptInferior() = 0;
|
||||||
virtual void shutdown() = 0;
|
virtual void shutdown() = 0;
|
||||||
@@ -71,8 +70,6 @@ signals:
|
|||||||
void adapterShutdownFailed(const QString &msg);
|
void adapterShutdownFailed(const QString &msg);
|
||||||
void adapterCrashed(const QString &msg);
|
void adapterCrashed(const QString &msg);
|
||||||
|
|
||||||
void inferiorPrepared();
|
|
||||||
void inferiorPreparationFailed(const QString &msg);
|
|
||||||
void inferiorStartFailed(const QString &msg);
|
void inferiorStartFailed(const QString &msg);
|
||||||
void inferiorShutDown();
|
void inferiorShutDown();
|
||||||
void inferiorShutdownFailed(const QString &msg);
|
void inferiorShutdownFailed(const QString &msg);
|
||||||
|
|||||||
@@ -84,14 +84,6 @@ void AttachGdbAdapter::handleGdbError(QProcess::ProcessError error)
|
|||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttachGdbAdapter::prepareInferior()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
|
|
||||||
setState(InferiorPreparing);
|
|
||||||
setState(InferiorPrepared);
|
|
||||||
emit inferiorPrepared();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AttachGdbAdapter::startInferior()
|
void AttachGdbAdapter::startInferior()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ public:
|
|||||||
bool dumpersAvailable() const { return false; }
|
bool dumpersAvailable() const { return false; }
|
||||||
|
|
||||||
void startAdapter();
|
void startAdapter();
|
||||||
void prepareInferior();
|
|
||||||
void startInferior();
|
void startInferior();
|
||||||
void interruptInferior();
|
void interruptInferior();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|||||||
@@ -84,14 +84,6 @@ void CoreGdbAdapter::handleGdbError(QProcess::ProcessError error)
|
|||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreGdbAdapter::prepareInferior()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
|
|
||||||
setState(InferiorPreparing);
|
|
||||||
setState(InferiorPrepared);
|
|
||||||
emit inferiorPrepared();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CoreGdbAdapter::startInferior()
|
void CoreGdbAdapter::startInferior()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||||
@@ -199,7 +191,6 @@ void CoreGdbAdapter::shutdown()
|
|||||||
|
|
||||||
case InferiorUnrunnable:
|
case InferiorUnrunnable:
|
||||||
case InferiorShutDown:
|
case InferiorShutDown:
|
||||||
case InferiorPreparationFailed:
|
|
||||||
setState(AdapterShuttingDown);
|
setState(AdapterShuttingDown);
|
||||||
m_engine->postCommand(_("-gdb-exit"), CB(handleExit));
|
m_engine->postCommand(_("-gdb-exit"), CB(handleExit));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ public:
|
|||||||
bool dumpersAvailable() const { return false; }
|
bool dumpersAvailable() const { return false; }
|
||||||
|
|
||||||
void startAdapter();
|
void startAdapter();
|
||||||
void prepareInferior();
|
|
||||||
void startInferior();
|
void startInferior();
|
||||||
void interruptInferior();
|
void interruptInferior();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|||||||
@@ -111,8 +111,6 @@ static bool stateAcceptsGdbCommands(DebuggerState state)
|
|||||||
{
|
{
|
||||||
return state == AdapterStarted
|
return state == AdapterStarted
|
||||||
|| state == InferiorUnrunnable
|
|| state == InferiorUnrunnable
|
||||||
|| state == InferiorPreparing
|
|
||||||
|| state == InferiorPrepared
|
|
||||||
|| state == InferiorStarting
|
|| state == InferiorStarting
|
||||||
|| state == InferiorRunningRequested
|
|| state == InferiorRunningRequested
|
||||||
|| state == InferiorRunning
|
|| state == InferiorRunning
|
||||||
@@ -238,11 +236,6 @@ void GdbEngine::connectAdapter()
|
|||||||
connect(m_gdbAdapter, SIGNAL(adapterShutdownFailed(QString)),
|
connect(m_gdbAdapter, SIGNAL(adapterShutdownFailed(QString)),
|
||||||
this, SLOT(handleAdapterShutdownFailed(QString)));
|
this, SLOT(handleAdapterShutdownFailed(QString)));
|
||||||
|
|
||||||
connect(m_gdbAdapter, SIGNAL(inferiorPrepared()),
|
|
||||||
this, SLOT(handleInferiorPrepared()));
|
|
||||||
connect(m_gdbAdapter, SIGNAL(inferiorPreparationFailed(QString)),
|
|
||||||
this, SLOT(handleInferiorPreparationFailed(QString)));
|
|
||||||
|
|
||||||
connect(m_gdbAdapter, SIGNAL(inferiorStartFailed(QString)),
|
connect(m_gdbAdapter, SIGNAL(inferiorStartFailed(QString)),
|
||||||
this, SLOT(handleInferiorStartFailed(QString)));
|
this, SLOT(handleInferiorStartFailed(QString)));
|
||||||
connect(m_gdbAdapter, SIGNAL(inferiorShutDown()),
|
connect(m_gdbAdapter, SIGNAL(inferiorShutDown()),
|
||||||
@@ -710,9 +703,7 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cmd.flags & NeedsStop) {
|
if (cmd.flags & NeedsStop) {
|
||||||
if (state() == InferiorStopped
|
if (state() == InferiorStopped || state() == AdapterStarted) {
|
||||||
|| state() == EngineStarting
|
|
||||||
|| state() == InferiorPrepared) {
|
|
||||||
// Can be safely sent now.
|
// Can be safely sent now.
|
||||||
flushCommand(cmd);
|
flushCommand(cmd);
|
||||||
} else {
|
} else {
|
||||||
@@ -4086,24 +4077,7 @@ void GdbEngine::handleAdapterStartFailed(const QString &msg, const QString &sett
|
|||||||
|
|
||||||
void GdbEngine::handleAdapterStarted()
|
void GdbEngine::handleAdapterStarted()
|
||||||
{
|
{
|
||||||
debugMessage(_("ADAPTER SUCCESSFULLY STARTED, PREPARING INFERIOR"));
|
debugMessage(_("ADAPTER SUCCESSFULLY STARTED, INITIALIZING GDB"));
|
||||||
m_gdbAdapter->prepareInferior();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbEngine::handleInferiorPreparationFailed(const QString &msg)
|
|
||||||
{
|
|
||||||
debugMessage(_("INFERIOR PREPARATION FAILED"));
|
|
||||||
showMessageBox(QMessageBox::Critical,
|
|
||||||
tr("Inferior start preparation failed"), msg);
|
|
||||||
shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbEngine::handleInferiorPrepared()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(state() == InferiorPrepared, qDebug() << state());
|
|
||||||
debugMessage(_("INFERIOR PREPARED"));
|
|
||||||
// FIXME: Check that inferior is in "stopped" state
|
|
||||||
showStatusMessage(tr("Inferior prepared for startup."));
|
|
||||||
|
|
||||||
postCommand(_("show version"), CB(handleShowVersion));
|
postCommand(_("show version"), CB(handleShowVersion));
|
||||||
//postCommand(_("-enable-timings");
|
//postCommand(_("-enable-timings");
|
||||||
@@ -4196,7 +4170,7 @@ void GdbEngine::handleInferiorPrepared()
|
|||||||
|
|
||||||
void GdbEngine::startInferior()
|
void GdbEngine::startInferior()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorPrepared, qDebug() << state());
|
QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
|
||||||
showStatusMessage(tr("Starting inferior..."));
|
showStatusMessage(tr("Starting inferior..."));
|
||||||
setState(InferiorStarting);
|
setState(InferiorStarting);
|
||||||
m_gdbAdapter->startInferior();
|
m_gdbAdapter->startInferior();
|
||||||
|
|||||||
@@ -245,8 +245,6 @@ private slots:
|
|||||||
void handleAdapterStarted();
|
void handleAdapterStarted();
|
||||||
void handleAdapterStartFailed(const QString &msg, const QString &settingsIdHint = QString());
|
void handleAdapterStartFailed(const QString &msg, const QString &settingsIdHint = QString());
|
||||||
|
|
||||||
void handleInferiorPrepared();
|
|
||||||
void handleInferiorPreparationFailed(const QString &msg);
|
|
||||||
void handleInferiorStartFailed(const QString &msg);
|
void handleInferiorStartFailed(const QString &msg);
|
||||||
void handleInferiorShutDown();
|
void handleInferiorShutDown();
|
||||||
void handleInferiorShutdownFailed(const QString &msg);
|
void handleInferiorShutdownFailed(const QString &msg);
|
||||||
|
|||||||
@@ -103,10 +103,9 @@ void PlainGdbAdapter::handleGdbError(QProcess::ProcessError error)
|
|||||||
emit adapterCrashed(m_engine->errorMessage(error));
|
emit adapterCrashed(m_engine->errorMessage(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlainGdbAdapter::prepareInferior()
|
void PlainGdbAdapter::startInferior()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||||
setState(InferiorPreparing);
|
|
||||||
if (!startParameters().processArgs.isEmpty())
|
if (!startParameters().processArgs.isEmpty())
|
||||||
m_engine->postCommand(_("-exec-arguments ")
|
m_engine->postCommand(_("-exec-arguments ")
|
||||||
+ startParameters().processArgs.join(_(" ")));
|
+ startParameters().processArgs.join(_(" ")));
|
||||||
@@ -117,16 +116,15 @@ void PlainGdbAdapter::prepareInferior()
|
|||||||
|
|
||||||
void PlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
|
void PlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorPreparing, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
//m_breakHandler->clearBreakMarkers();
|
//m_breakHandler->clearBreakMarkers();
|
||||||
setState(InferiorPrepared);
|
setState(InferiorRunningRequested);
|
||||||
emit inferiorPrepared();
|
m_engine->postCommand(_("-exec-run"), GdbEngine::RunRequest, CB(handleExecRun));
|
||||||
} else {
|
} else {
|
||||||
QString msg = tr("Starting executable failed:\n") +
|
QString msg = tr("Starting executable failed:\n") +
|
||||||
__(response.data.findChild("msg").data());
|
__(response.data.findChild("msg").data());
|
||||||
setState(InferiorPreparationFailed);
|
emit inferiorStartFailed(msg);
|
||||||
emit inferiorPreparationFailed(msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,13 +143,6 @@ void PlainGdbAdapter::handleExecRun(const GdbResponse &response)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlainGdbAdapter::startInferior()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
|
||||||
setState(InferiorRunningRequested);
|
|
||||||
m_engine->postCommand(_("-exec-run"), GdbEngine::RunRequest, CB(handleExecRun));
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlainGdbAdapter::interruptInferior()
|
void PlainGdbAdapter::interruptInferior()
|
||||||
{
|
{
|
||||||
debugMessage(_("TRYING TO INTERUPT INFERIOR"));
|
debugMessage(_("TRYING TO INTERUPT INFERIOR"));
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ public:
|
|||||||
bool dumpersAvailable() const { return true; }
|
bool dumpersAvailable() const { return true; }
|
||||||
|
|
||||||
void startAdapter();
|
void startAdapter();
|
||||||
void prepareInferior();
|
|
||||||
void startInferior();
|
void startInferior();
|
||||||
void interruptInferior();
|
void interruptInferior();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|||||||
@@ -153,10 +153,9 @@ void RemoteGdbAdapter::readUploadStandardError()
|
|||||||
m_engine->gdbOutputAvailable(LogError, QString::fromLocal8Bit(ba, ba.length()));
|
m_engine->gdbOutputAvailable(LogError, QString::fromLocal8Bit(ba, ba.length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteGdbAdapter::prepareInferior()
|
void RemoteGdbAdapter::startInferior()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||||
setState(InferiorPreparing);
|
|
||||||
|
|
||||||
m_engine->postCommand(_("set architecture %1")
|
m_engine->postCommand(_("set architecture %1")
|
||||||
.arg(startParameters().remoteArchitecture));
|
.arg(startParameters().remoteArchitecture));
|
||||||
@@ -178,7 +177,7 @@ void RemoteGdbAdapter::prepareInferior()
|
|||||||
#if 0
|
#if 0
|
||||||
void RemoteGdbAdapter::handleSetTargetAsync(const GdbResponse &response)
|
void RemoteGdbAdapter::handleSetTargetAsync(const GdbResponse &response)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorPreparing, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
//qq->breakHandler()->setAllPending();
|
//qq->breakHandler()->setAllPending();
|
||||||
QFileInfo fi(startParameters().executable);
|
QFileInfo fi(startParameters().executable);
|
||||||
@@ -187,24 +186,28 @@ void RemoteGdbAdapter::handleSetTargetAsync(const GdbResponse &response)
|
|||||||
CB(handleFileExecAndSymbols));
|
CB(handleFileExecAndSymbols));
|
||||||
} else {
|
} else {
|
||||||
QString msg = tr("Adapter too old: does not support asynchronous mode.");
|
QString msg = tr("Adapter too old: does not support asynchronous mode.");
|
||||||
setState(InferiorPreparationFailed);
|
emit inferiorStartFailed(msg);
|
||||||
emit inferiorPreparationFailed(msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void RemoteGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
|
void RemoteGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorPreparing, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
//m_breakHandler->clearBreakMarkers();
|
//m_breakHandler->clearBreakMarkers();
|
||||||
m_engine->setState(InferiorPrepared);
|
|
||||||
emit inferiorPrepared();
|
// "target remote" does three things:
|
||||||
|
// (1) connects to the gdb server
|
||||||
|
// (2) starts the remote application
|
||||||
|
// (3) stops the remote application (early, e.g. in the dynamic linker)
|
||||||
|
QString channel = startParameters().remoteChannel;
|
||||||
|
m_engine->postCommand(_("target remote %1").arg(channel),
|
||||||
|
CB(handleTargetRemote));
|
||||||
} else {
|
} else {
|
||||||
QString msg = tr("Starting remote executable failed:\n");
|
QString msg = tr("Starting remote executable failed:\n");
|
||||||
msg += __(response.data.findChild("msg").data());
|
msg += __(response.data.findChild("msg").data());
|
||||||
setState(InferiorPreparationFailed);
|
emit inferiorStartFailed(msg);
|
||||||
emit inferiorPreparationFailed(msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,24 +223,10 @@ void RemoteGdbAdapter::handleTargetRemote(const GdbResponse &record)
|
|||||||
} else {
|
} else {
|
||||||
// 16^error,msg="hd:5555: Connection timed out."
|
// 16^error,msg="hd:5555: Connection timed out."
|
||||||
QString msg = msgConnectRemoteServerFailed(__(record.data.findChild("msg").data()));
|
QString msg = msgConnectRemoteServerFailed(__(record.data.findChild("msg").data()));
|
||||||
setState(InferiorPreparationFailed);
|
|
||||||
emit inferiorStartFailed(msg);
|
emit inferiorStartFailed(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteGdbAdapter::startInferior()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
|
||||||
QString channel = startParameters().remoteChannel;
|
|
||||||
|
|
||||||
// "target remote" does three things:
|
|
||||||
// (1) connects to the gdb server
|
|
||||||
// (2) starts the remote application
|
|
||||||
// (3) stops the remote application (early, e.g. in the dynamic linker)
|
|
||||||
m_engine->postCommand(_("target remote %1").arg(channel),
|
|
||||||
CB(handleTargetRemote));
|
|
||||||
}
|
|
||||||
|
|
||||||
void RemoteGdbAdapter::interruptInferior()
|
void RemoteGdbAdapter::interruptInferior()
|
||||||
{
|
{
|
||||||
m_engine->postCommand(_("-exec-interrupt"));
|
m_engine->postCommand(_("-exec-interrupt"));
|
||||||
@@ -257,7 +246,7 @@ void RemoteGdbAdapter::shutdown()
|
|||||||
QTC_ASSERT(false, qDebug() << state());
|
QTC_ASSERT(false, qDebug() << state());
|
||||||
// fall through
|
// fall through
|
||||||
|
|
||||||
case InferiorPreparationFailed:
|
case InferiorStartFailed:
|
||||||
case InferiorShutDown:
|
case InferiorShutDown:
|
||||||
setState(AdapterShuttingDown);
|
setState(AdapterShuttingDown);
|
||||||
m_engine->postCommand(_("-gdb-exit"), CB(handleExit));
|
m_engine->postCommand(_("-gdb-exit"), CB(handleExit));
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ public:
|
|||||||
bool dumpersAvailable() const { return true; }
|
bool dumpersAvailable() const { return true; }
|
||||||
|
|
||||||
void startAdapter();
|
void startAdapter();
|
||||||
void prepareInferior();
|
|
||||||
void startInferior();
|
void startInferior();
|
||||||
void interruptInferior();
|
void interruptInferior();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|||||||
@@ -391,6 +391,17 @@ void TrkGdbAdapter::slotEmitDelayedAdapterStartFailed()
|
|||||||
emit adapterStartFailed(m_adapterFailMessage, TrkOptionsPage::settingsId());
|
emit adapterStartFailed(m_adapterFailMessage, TrkOptionsPage::settingsId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrkGdbAdapter::emitDelayedInferiorStartFailed(const QString &msg)
|
||||||
|
{
|
||||||
|
m_adapterFailMessage = msg;
|
||||||
|
QTimer::singleShot(0, this, SLOT(slotEmitDelayedInferiorStartFailed()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrkGdbAdapter::slotEmitDelayedInferiorStartFailed()
|
||||||
|
{
|
||||||
|
emit inferiorStartFailed(m_adapterFailMessage);
|
||||||
|
}
|
||||||
|
|
||||||
void TrkGdbAdapter::waitForTrkConnect()
|
void TrkGdbAdapter::waitForTrkConnect()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == AdapterStarting, qDebug() << state());
|
QTC_ASSERT(state() == AdapterStarting, qDebug() << state());
|
||||||
@@ -1634,10 +1645,9 @@ void TrkGdbAdapter::startAdapter()
|
|||||||
waitForTrkConnect();
|
waitForTrkConnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrkGdbAdapter::prepareInferior()
|
void TrkGdbAdapter::startInferior()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||||
setState(InferiorPreparing);
|
|
||||||
|
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
appendByte(&ba, 0); // ?
|
appendByte(&ba, 0); // ?
|
||||||
@@ -1651,7 +1661,7 @@ void TrkGdbAdapter::prepareInferior()
|
|||||||
|
|
||||||
void TrkGdbAdapter::handleCreateProcess(const TrkResult &result)
|
void TrkGdbAdapter::handleCreateProcess(const TrkResult &result)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorPreparing, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||||
// 40 00 00]
|
// 40 00 00]
|
||||||
//logMessage(" RESULT: " + result.toString());
|
//logMessage(" RESULT: " + result.toString());
|
||||||
// [80 08 00 00 00 01 B5 00 00 01 B6 78 67 40 00 00 40 00 00]
|
// [80 08 00 00 00 01 B5 00 00 01 B6 78 67 40 00 00 40 00 00]
|
||||||
@@ -1661,7 +1671,7 @@ void TrkGdbAdapter::handleCreateProcess(const TrkResult &result)
|
|||||||
.arg(m_remoteExecutable).arg(result.errorString());
|
.arg(m_remoteExecutable).arg(result.errorString());
|
||||||
// Delay cleanup as not to close a trk device from its read handler,
|
// Delay cleanup as not to close a trk device from its read handler,
|
||||||
// which blocks.
|
// which blocks.
|
||||||
emitDelayedAdapterStartFailed(msg);
|
emitDelayedInferiorStartFailed(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const char *data = result.data.data();
|
const char *data = result.data.data();
|
||||||
@@ -1689,24 +1699,17 @@ void TrkGdbAdapter::handleCreateProcess(const TrkResult &result)
|
|||||||
|
|
||||||
void TrkGdbAdapter::handleTargetRemote(const GdbResponse &record)
|
void TrkGdbAdapter::handleTargetRemote(const GdbResponse &record)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorPreparing, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||||
if (record.resultClass == GdbResultDone) {
|
if (record.resultClass == GdbResultDone) {
|
||||||
setState(InferiorPrepared);
|
setState(InferiorRunningRequested);
|
||||||
emit inferiorPrepared();
|
m_engine->postCommand(_("-exec-continue"), CB(handleFirstContinue));
|
||||||
} else {
|
} else {
|
||||||
QString msg = tr("Connecting to trk server adapter failed:\n")
|
QString msg = tr("Connecting to trk server adapter failed:\n")
|
||||||
+ _(record.data.findChild("msg").data());
|
+ _(record.data.findChild("msg").data());
|
||||||
emit inferiorPreparationFailed(msg);
|
emit inferiorStartFailed(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrkGdbAdapter::startInferior()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
|
||||||
setState(InferiorRunningRequested);
|
|
||||||
m_engine->postCommand(_("-exec-continue"), CB(handleFirstContinue));
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrkGdbAdapter::handleFirstContinue(const GdbResponse &record)
|
void TrkGdbAdapter::handleFirstContinue(const GdbResponse &record)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorRunning, qDebug() << state());
|
QTC_ASSERT(state() == InferiorRunning, qDebug() << state());
|
||||||
|
|||||||
@@ -171,13 +171,14 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void startAdapter();
|
void startAdapter();
|
||||||
void prepareInferior();
|
|
||||||
void startInferior();
|
void startInferior();
|
||||||
void interruptInferior();
|
void interruptInferior();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
void cleanup();
|
void cleanup();
|
||||||
void emitDelayedAdapterStartFailed(const QString &msg);
|
void emitDelayedAdapterStartFailed(const QString &msg);
|
||||||
Q_SLOT void slotEmitDelayedAdapterStartFailed();
|
Q_SLOT void slotEmitDelayedAdapterStartFailed();
|
||||||
|
void emitDelayedInferiorStartFailed(const QString &msg);
|
||||||
|
Q_SLOT void slotEmitDelayedInferiorStartFailed();
|
||||||
|
|
||||||
Q_SLOT void waitForTrkConnect();
|
Q_SLOT void waitForTrkConnect();
|
||||||
void handleKill(const GdbResponse &response);
|
void handleKill(const GdbResponse &response);
|
||||||
|
|||||||
Reference in New Issue
Block a user