diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 7779050817c453691c7e7e9ea1e982b5a304f629..8c5c75fdb2d2b12e0189781f9b48bf11ca8c9569 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -101,9 +101,8 @@ IDebuggerEngine *createTcfEngine(DebuggerManager *parent, QList<Core::IOptionsPa namespace Debugger { namespace Internal { -IDebuggerEngine *createGdbEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *); +IDebuggerEngine *createGdbEngine(DebuggerManager *parent); -IDebuggerEngine *createSymbianEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *); QDebug operator<<(QDebug str, const DebuggerStartParameters &p) { @@ -185,7 +184,6 @@ void DebuggerStartParameters::clear() static IDebuggerEngine *gdbEngine = 0; static IDebuggerEngine *scriptEngine = 0; -static IDebuggerEngine *symbianEngine = 0; static IDebuggerEngine *tcfEngine = 0; static IDebuggerEngine *winEngine = 0; @@ -201,7 +199,6 @@ DebuggerManager::~DebuggerManager() #define doDelete(ptr) delete ptr; ptr = 0 doDelete(gdbEngine); doDelete(scriptEngine); - doDelete(symbianEngine); doDelete(tcfEngine); doDelete(winEngine); #undef doDelete @@ -446,10 +443,10 @@ void DebuggerManager::init() QList<Core::IOptionsPage*> DebuggerManager::initializeEngines(unsigned enabledTypeFlags) { QList<Core::IOptionsPage*> rc; - if (enabledTypeFlags & GdbEngineType) - gdbEngine = createGdbEngine(this, &rc); - if (enabledTypeFlags & SymbianEngineType) - symbianEngine = createSymbianEngine(this, &rc); + if (enabledTypeFlags & GdbEngineType) { + gdbEngine = createGdbEngine(this); + gdbEngine->addOptionPages(&rc); + } winEngine = createWinEngine(this, (enabledTypeFlags & CdbEngineType), &rc); if (enabledTypeFlags & ScriptEngineType) scriptEngine = createScriptEngine(this, &rc); @@ -565,7 +562,7 @@ void DebuggerManager::notifyInferiorRunning() void DebuggerManager::notifyInferiorExited() { setStatus(DebuggerProcessNotReady); - showStatusMessage(tr("Stopped."), 5000); + showStatusMessage(tr("Exited."), 5000); } void DebuggerManager::notifyInferiorPidChanged(qint64 pid) @@ -744,13 +741,15 @@ static IDebuggerEngine *determineDebuggerEngine(const QString &executable, return scriptEngine; } +/* if (executable.endsWith(_(".sym"))) { - if (!symbianEngine) { - *errorMessage = msgEngineNotAvailable("Symbian Engine"); + if (!gdbEngine) { + *errorMessage = msgEngineNotAvailable("Gdb Engine"); return 0; } - return symbianEngine; + return gdbEngine; } +*/ if (IDebuggerEngine *tce = debuggerEngineForToolChain( static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType))) @@ -1114,7 +1113,7 @@ void DebuggerManager::setStatus(int status) if (status == m_status) return; - if (0 && !isAllowedTransition(m_status, status)) { + if (1 && !isAllowedTransition(m_status, status)) { const QString msg = QString::fromLatin1("%1: UNEXPECTED TRANSITION: %2 -> %3") .arg(_(Q_FUNC_INFO), _(stateName(m_status)), _(stateName(status))); qWarning("%s", qPrintable(msg)); @@ -1155,7 +1154,8 @@ void DebuggerManager::setStatus(int status) m_runToFunctionAction->setEnabled(ready); m_jumpToLineAction->setEnabled(ready); m_nextAction->setEnabled(ready); - //showStatusMessage(QString("started: %1, running: %2").arg(started).arg(running)); + //showStatusMessage(QString("started: %1, running: %2") + // .arg(started).arg(running)); emit statusChanged(m_status); const bool notbusy = ready || status == DebuggerProcessNotReady; setBusyCursor(!notbusy); @@ -1467,6 +1467,15 @@ void DebuggerManager::setSessionValue(const QString &name, const QVariant &value emit setSessionValueRequested(name, value); } +void DebuggerManager::showMessageBox(int icon, + const QString &title, const QString &text) +{ + QMessageBox *mb = new QMessageBox(QMessageBox::Icon(icon), + title, text, QMessageBox::NoButton, mainWindow()); + mb->setAttribute(Qt::WA_DeleteOnClose); + mb->show(); +} + ////////////////////////////////////////////////////////////////////// // // Testing diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 5db5c605715e65dc1e696e098cdaa12a7d83dddd..29052449c9e8ba05aa55fc732c65c7393275399c 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -43,6 +43,7 @@ class QAction; class QAbstractItemModel; class QDockWidget; class QLabel; +class QMessageBox; class QModelIndex; class QPoint; class QTimer; @@ -183,12 +184,10 @@ enum DebuggerEngineTypeFlags ScriptEngineType = 0x02, CdbEngineType = 0x04, TcfEngineType = 0x08, - SymbianEngineType = 0x10, AllEngineTypes = GdbEngineType | ScriptEngineType | CdbEngineType | TcfEngineType - | SymbianEngineType }; // The construct below is not nice but enforces a bit of order. The @@ -279,6 +278,8 @@ public: virtual DebuggerStartParametersPtr startParameters() const; virtual qint64 inferiorPid() const; + void showMessageBox(int icon, const QString &title, const QString &text); + public slots: void startNewDebugger(const DebuggerStartParametersPtr &sp); void exitDebugger(); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 6a2d5a285c0bd76fe497b8fab997a1468a4cb8b9..a57b8e0180b7e4d61e7fb26971c2fc28fb8f8dba 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -35,6 +35,7 @@ #include "trkoptionspage.h" #include "plaingdbadapter.h" #include "trkgdbadapter.h" +#include "remotegdbadapter.h" #include "watchutils.h" #include "debuggeractions.h" @@ -173,6 +174,33 @@ GdbEngine::GdbEngine(DebuggerManager *parent) : qq(parent->engineInterface()) { m_gdbAdapter = 0; + QSharedPointer<TrkOptions> options(new TrkOptions); + options->fromSettings(Core::ICore::instance()->settings()); + m_plainAdapter = new PlainGdbAdapter(this); + m_trkAdapter = new TrkGdbAdapter(this, options); + m_remoteAdapter = 0; // FIXME + + // Output + connect(&m_outputCollector, SIGNAL(byteDelivery(QByteArray)), + this, SLOT(readDebugeeOutput(QByteArray))); + + connect(this, SIGNAL(gdbOutputAvailable(int,QString)), + m_manager, SLOT(showDebuggerOutput(int,QString)), + Qt::QueuedConnection); + connect(this, SIGNAL(gdbInputAvailable(int,QString)), + m_manager, SLOT(showDebuggerInput(int,QString)), + Qt::QueuedConnection); + connect(this, SIGNAL(applicationOutputAvailable(QString)), + m_manager, SLOT(showApplicationOutput(QString)), + Qt::QueuedConnection); + + // FIXME: These trigger even if the engine is not active + connect(theDebuggerAction(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)), + this, SLOT(setUseDebuggingHelpers(QVariant))); + connect(theDebuggerAction(DebugDebuggingHelpers), SIGNAL(valueChanged(QVariant)), + this, SLOT(setDebugDebuggingHelpers(QVariant))); + connect(theDebuggerAction(RecheckDebuggingHelpers), SIGNAL(triggered()), + this, SLOT(recheckDebuggingHelperAvailability())); } GdbEngine::~GdbEngine() @@ -180,19 +208,15 @@ GdbEngine::~GdbEngine() // prevent sending error messages afterwards if (m_gdbAdapter) { m_gdbAdapter->disconnect(this); - delete m_gdbAdapter; + //delete m_gdbAdapter; m_gdbAdapter = 0; } + delete m_plainAdapter; + delete m_trkAdapter; + delete m_remoteAdapter; } -void GdbEngine::setGdbAdapter(AbstractGdbAdapter *gdbAdapter) -{ - m_gdbAdapter = gdbAdapter; - initializeVariables(); - initializeConnections(); -} - -void GdbEngine::initializeConnections() +void GdbEngine::connectAdapter() { // Gdb Process interaction connect(m_gdbAdapter, SIGNAL(error(QProcess::ProcessError)), @@ -227,28 +251,44 @@ void GdbEngine::initializeConnections() connect(m_gdbAdapter, SIGNAL(adapterCrashed()), m_manager, SLOT(exitDebugger())); +} - // Output - connect(&m_outputCollector, SIGNAL(byteDelivery(QByteArray)), - this, SLOT(readDebugeeOutput(QByteArray))); - connect(this, SIGNAL(gdbOutputAvailable(int,QString)), - m_manager, SLOT(showDebuggerOutput(int,QString)), - Qt::QueuedConnection); - connect(this, SIGNAL(gdbInputAvailable(int,QString)), - m_manager, SLOT(showDebuggerInput(int,QString)), - Qt::QueuedConnection); - connect(this, SIGNAL(applicationOutputAvailable(QString)), - m_manager, SLOT(showApplicationOutput(QString)), - Qt::QueuedConnection); +void GdbEngine::disconnectAdapter() +{ + // Gdb Process interaction + disconnect(m_gdbAdapter, SIGNAL(error(QProcess::ProcessError)), + this, SLOT(gdbProcError(QProcess::ProcessError))); + disconnect(m_gdbAdapter, SIGNAL(readyReadStandardOutput()), + this, SLOT(readGdbStandardOutput())); + disconnect(m_gdbAdapter, SIGNAL(readyReadStandardError()), + this, SLOT(readGdbStandardError())); - // FIXME: These trigger even if the engine is not active - connect(theDebuggerAction(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)), - this, SLOT(setUseDebuggingHelpers(QVariant))); - connect(theDebuggerAction(DebugDebuggingHelpers), SIGNAL(valueChanged(QVariant)), - this, SLOT(setDebugDebuggingHelpers(QVariant))); - connect(theDebuggerAction(RecheckDebuggingHelpers), SIGNAL(triggered()), - this, SLOT(recheckDebuggingHelperAvailability())); + disconnect(m_gdbAdapter, SIGNAL(adapterStarted()), + this, SLOT(handleAdapterStarted())); + disconnect(m_gdbAdapter, SIGNAL(adapterStartFailed(QString)), + this, SLOT(handleAdapterStartFailed(QString))); + disconnect(m_gdbAdapter, SIGNAL(adapterShutDown()), + this, SLOT(handleAdapterShutDown())); + disconnect(m_gdbAdapter, SIGNAL(adapterShutdownFailed(QString)), + this, SLOT(handleAdapterShutdownFailed(QString))); + + disconnect(m_gdbAdapter, SIGNAL(inferiorPrepared()), + this, SLOT(handleInferiorPrepared())); + disconnect(m_gdbAdapter, SIGNAL(inferiorPreparationFailed(QString)), + this, SLOT(handleInferiorPreparationFailed(QString))); + + disconnect(m_gdbAdapter, SIGNAL(inferiorStarted()), + this, SLOT(handleInferiorStarted())); + disconnect(m_gdbAdapter, SIGNAL(inferiorStartFailed(QString)), + this, SLOT(handleInferiorStartFailed(QString))); + disconnect(m_gdbAdapter, SIGNAL(inferiorShutDown()), + this, SLOT(handleInferiorShutDown())); + disconnect(m_gdbAdapter, SIGNAL(inferiorShutdownFailed(QString)), + this, SLOT(handleInferiorShutdownFailed(QString))); + + disconnect(m_gdbAdapter, SIGNAL(adapterCrashed()), + m_manager, SLOT(exitDebugger())); } void GdbEngine::initializeVariables() @@ -292,13 +332,13 @@ void GdbEngine::gdbProcError(QProcess::ProcessError error) bool kill = true; switch (error) { case QProcess::FailedToStart: - kill = false; + //kill = false; msg = tr("The Gdb process failed to start. Either the " "invoked program '%1' is missing, or you may have insufficient " "permissions to invoke the program.") .arg(theDebuggerStringSetting(GdbLocation)); - emit startFailed(); - shutdown(); + //emit startFailed(); + //shutdown(); break; case QProcess::Crashed: kill = false; @@ -325,9 +365,9 @@ void GdbEngine::gdbProcError(QProcess::ProcessError error) } showStatusMessage(msg); - QMessageBox::critical(mainWindow(), tr("Error"), msg); + showMessageBox(QMessageBox::Critical, tr("Error"), msg); // act as if it was closed by the core - if (kill) + //if (kill) m_manager->exitDebugger(); } @@ -756,8 +796,8 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record) // msg="Cannot find new threads: generic error" if (record.resultClass == GdbResultError) { QByteArray msg = record.data.findChild("msg").data(); - QMessageBox::critical(mainWindow(), tr("Error"), - tr("Executable failed:\n") + QString::fromLocal8Bit(msg)); + showMessageBox(QMessageBox::Critical, + tr("Executable failed"), QString::fromLocal8Bit(msg)); showStatusMessage(tr("Process failed to start.")); exitDebugger(); //qq->notifyInferiorStopped(); @@ -775,7 +815,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record) if (record.token < m_oldestAcceptableToken && (cmd.flags & Discardable)) { //qDebug() << "### SKIPPING OLD RESULT" << record.toString(); - //QMessageBox::information(mainWindow(), tr("Skipped"), "xxx"); + //showMessageBox(QMessageBox::Information(tr("Skipped"), "xxx")); return; } @@ -1253,11 +1293,8 @@ void GdbEngine::handleStop1(const GdbResultRecord &, const QVariant &cookie) "<tr><td>Signal meaning : </td><td>%2</td></tr></table>") .arg(name.isEmpty() ? tr(" <Unknown> ") : _(name)) .arg(meaning.isEmpty() ? tr(" <Unknown> ") : _(meaning)); - QMessageBox *mb = new QMessageBox(QMessageBox::Information, - tr("Signal received"), msg, QMessageBox::NoButton, - mainWindow()); - mb->setAttribute(Qt::WA_DeleteOnClose); - mb->show(); + showMessageBox(QMessageBox::Information, + tr("Signal received"), msg); } } @@ -1344,7 +1381,7 @@ void GdbEngine::handleShowVersion(const GdbResultRecord &response, const QVarian err->setMinimumSize(400, 300); err->showMessage(msg); #else - //QMessageBox::information(mainWindow(), tr("Warning"), msg); + //showMessageBox(QMessageBox::Information, tr("Warning"), msg); #endif } else { m_gdbVersion = 10000 * supported.cap(2).toInt() @@ -1364,8 +1401,7 @@ void GdbEngine::handleFileExecAndSymbols(const GdbResultRecord &response, const //m_breakHandler->clearBreakMarkers(); } else if (response.resultClass == GdbResultError) { QString msg = __(response.data.findChild("msg").data()); - QMessageBox::critical(mainWindow(), tr("Error"), - tr("Starting executable failed:\n") + msg); + showMessageBox(QMessageBox::Critical, tr("Starting executable failed"), msg); QTC_ASSERT(status() == DebuggerInferiorRunning, /**/); //interruptInferior(); qq->notifyInferiorExited(); @@ -1380,8 +1416,8 @@ void GdbEngine::handleExecRun(const GdbResultRecord &response, const QVariant &) } else { QTC_ASSERT(response.resultClass == GdbResultError, /**/); const QByteArray &msg = response.data.findChild("msg").data(); - QMessageBox::critical(mainWindow(), tr("Error"), - tr("Starting executable failed:\n") + QString::fromLocal8Bit(msg)); + showMessageBox(QMessageBox::Critical, tr("Starting executable failed", + QString::fromLocal8Bit(msg))); QTC_ASSERT(status() == DebuggerInferiorRunning, /**/); //interruptInferior(); qq->notifyInferiorExited(); @@ -1402,8 +1438,8 @@ void GdbEngine::handleExecContinue(const GdbResultRecord &response, const QVaria // "Leaving function...")); //stepOutExec(); } else { - QMessageBox::critical(mainWindow(), tr("Error"), - tr("Starting executable failed:\n") + QString::fromLocal8Bit(msg)); + showMessageBox(QMessageBox::Critical, tr("Starting executable failed"), + QString::fromLocal8Bit(msg)); QTC_ASSERT(status() == DebuggerInferiorRunning, /**/); //interruptInferior(); qq->notifyInferiorExited(); @@ -1481,10 +1517,23 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp) { // This should be set by the constructor or in exitDebugger() // via initializeVariables() - QTC_ASSERT(m_debuggingHelperState == DebuggingHelperUninitialized, - initializeVariables()); + //QTC_ASSERT(m_debuggingHelperState == DebuggingHelperUninitialized, + // initializeVariables()); + //QTC_ASSERT(m_gdbAdapter == 0, delete m_gdbAdapter; m_gdbAdapter = 0); + + if (m_gdbAdapter) + disconnectAdapter(); + + if (sp->executable.endsWith(_(".sym"))) + m_gdbAdapter = m_trkAdapter; + else + m_gdbAdapter = m_plainAdapter; + + initializeVariables(); + connectAdapter(); m_startParameters = sp; + m_gdbAdapter->startAdapter(sp); /* @@ -1508,7 +1557,7 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp) } } else { if (!m_outputCollector.listen()) { - QMessageBox::critical(mainWindow(), tr("Debugger Startup Failure"), + showMessageBox(QMessageBox::Critical, tr("Debugger Startup Failure"), tr("Cannot set up communication with child process: %1") .arg(m_outputCollector.errorString())); emitStartFailed(); @@ -1587,7 +1636,7 @@ void GdbEngine::handleTargetRemote(const GdbResultRecord &record, const QVariant QString msg = __(record.data.findChild("msg").data()); QString msg1 = tr("Connecting to remote server failed:"); showStatusMessage(msg1 + _c(' ') + msg); - QMessageBox::critical(mainWindow(), tr("Error"), msg1 + _c('\n') + msg); + showMessageBox(QMessageBox::Critical, tr("Error"), msg1 + _c('\n') + msg); postCommand(_("-gdb-exit"), CB(handleExit)); } } @@ -4025,10 +4074,9 @@ void GdbEngine::gotoLocation(const StackFrame &frame, bool setMarker) void GdbEngine::handleAdapterStartFailed(const QString &msg) { debugMessage(_("ADAPTER START FAILED")); - m_outputCollector.shutdown(); - QMessageBox::critical(mainWindow(), tr("Error"), msg); - QTC_ASSERT(status() == DebuggerInferiorRunning, /**/); - //interruptInferior(); + showMessageBox(QMessageBox::Critical, tr("Adapter start failed"), msg); + qq->notifyInferiorExited(); + m_manager->exitDebugger(); } void GdbEngine::handleAdapterStarted() @@ -4040,9 +4088,11 @@ void GdbEngine::handleAdapterStarted() void GdbEngine::handleInferiorPreparationFailed(const QString &msg) { debugMessage(_("INFERIOR PREPARATION FAILD")); - m_outputCollector.shutdown(); - QMessageBox::critical(mainWindow(), tr("Error"), - tr("Inferior start preparation failed:\n") + msg); + showMessageBox(QMessageBox::Critical, + tr("Inferior start preparation failed"), msg); + shutdown(); + qq->notifyInferiorExited(); + m_manager->exitDebugger(); } void GdbEngine::handleInferiorPrepared() @@ -4119,7 +4169,7 @@ void GdbEngine::handleInferiorPrepared() if (QFileInfo(scriptFileName).isReadable()) { postCommand(_("source ") + scriptFileName); } else { - QMessageBox::warning(mainWindow(), + showMessageBox(QMessageBox::Warning, tr("Cannot find debugger initialization script"), tr("The debugger settings point to a script file at '%1' " "which is not accessible. If a script file is not needed, " @@ -4182,9 +4232,10 @@ void GdbEngine::handleInitialBreakpointsSet() void GdbEngine::handleInferiorStartFailed(const QString &msg) { debugMessage(_("INFERIOR START FAILED")); - QMessageBox::critical(mainWindow(), tr("Error"), + showMessageBox(QMessageBox::Critical, tr("Error"), tr("Inferior start failed:\n") + msg); qq->notifyInferiorExited(); + m_manager->exitDebugger(); } void GdbEngine::handleInferiorStarted() @@ -4195,54 +4246,50 @@ void GdbEngine::handleInferiorStarted() void GdbEngine::handleInferiorShutDown() { debugMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN")); - qq->notifyInferiorExited(); } void GdbEngine::handleInferiorShutdownFailed(const QString &msg) { debugMessage(_("INFERIOR SHUTDOWN FAILED")); - QMessageBox::critical(mainWindow(), tr("Error"), + showMessageBox(QMessageBox::Critical, tr("Error"), tr("Inferior shutdown failed:\n") + msg); + qq->notifyInferiorExited(); + m_manager->exitDebugger(); } void GdbEngine::handleAdapterShutDown() { debugMessage(_("ADAPTER SUCCESSFULLY SHUT DOWN")); + qq->notifyInferiorExited(); } void GdbEngine::handleAdapterShutdownFailed(const QString &msg) { debugMessage(_("ADAPTER SHUTDOWN FAILED")); - QMessageBox::critical(mainWindow(), tr("Error"), + showMessageBox(QMessageBox::Critical, tr("Error"), tr("Inferior shutdown failed:\n") + msg); + qq->notifyInferiorExited(); } -// -// Factory -// - -IDebuggerEngine *createGdbEngine(DebuggerManager *parent, - QList<Core::IOptionsPage*> *opts) +void GdbEngine::addOptionPages(QList<Core::IOptionsPage*> *opts) const { opts->push_back(new GdbOptionsPage); - GdbEngine *engine = new GdbEngine(parent); - PlainGdbAdapter *adapter = new PlainGdbAdapter(engine); - engine->setGdbAdapter(adapter); - return engine; + if (!qgetenv("QTCREATOR_WITH_S60").isEmpty()) + opts->push_back(new TrkOptionsPage(m_trkAdapter->options())); } -IDebuggerEngine *createSymbianEngine(DebuggerManager *parent, - QList<Core::IOptionsPage*> *opts) +void GdbEngine::showMessageBox(int icon, const QString &title, const QString &text) { - QSharedPointer<TrkOptions> options(new TrkOptions); - options->fromSettings(Core::ICore::instance()->settings()); + m_manager->showMessageBox(icon, title, text); +} - if (!qgetenv("QTCREATOR_WITH_S60").isEmpty()) - opts->push_back(new TrkOptionsPage(options)); - GdbEngine *engine = new GdbEngine(parent); - TrkGdbAdapter *adapter = new TrkGdbAdapter(engine, options); - engine->setGdbAdapter(adapter); - return engine; +// +// Factory +// + +IDebuggerEngine *createGdbEngine(DebuggerManager *parent) +{ + return new GdbEngine(parent); } } // namespace Internal diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index e26fe58fd53502ad31e7d387ea6a03d8fa9ed29c..31959895e07a9aad77e76bc3521903a0671a2868 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -65,6 +65,10 @@ class GdbMi; class WatchData; class BreakpointData; +class PlainGdbAdapter; +class TrkGdbAdapter; +class RemoteGdbAdapter; + enum DebuggingHelperState { DebuggingHelperUninitialized, @@ -80,7 +84,6 @@ class GdbEngine : public IDebuggerEngine public: explicit GdbEngine(DebuggerManager *parent); ~GdbEngine(); - void setGdbAdapter(AbstractGdbAdapter *adapter); signals: void gdbInputAvailable(int channel, const QString &msg); @@ -155,7 +158,8 @@ private: bool supportsThreads() const; void gotoLocation(const StackFrame &frame, bool setLocationMarker); - void initializeConnections(); + void connectAdapter(); + void disconnectAdapter(); void initializeVariables(); QString fullName(const QString &fileName); // get one usable name out of these, try full names first @@ -439,8 +443,16 @@ private: DebuggerStartParametersPtr m_startParameters; // make sure to re-initialize new members in initializeVariables(); + // only one of those is active at a given time + PlainGdbAdapter *m_plainAdapter; + TrkGdbAdapter *m_trkAdapter; + RemoteGdbAdapter *m_remoteAdapter; + public: + void showMessageBox(int icon, const QString &title, const QString &text); void debugMessage(const QString &msg); + void addOptionPages(QList<Core::IOptionsPage*> *opts) const; + OutputCollector m_outputCollector; }; diff --git a/src/plugins/debugger/gdb/trkgdbadapter.cpp b/src/plugins/debugger/gdb/trkgdbadapter.cpp index e73600edf89f5b39ade889b70df42e483a32eb78..0b673abdb85b428e465d02f458671afb432966af 100644 --- a/src/plugins/debugger/gdb/trkgdbadapter.cpp +++ b/src/plugins/debugger/gdb/trkgdbadapter.cpp @@ -240,7 +240,7 @@ void TrkGdbAdapter::startInferiorEarly() if (!m_trkDevice.open(device, &errorMessage)) { logMessage(QString::fromLatin1("Waiting on %1 (%2)").arg(device, errorMessage)); // Do not loop forever - if (m_waitCount++ < (m_options->mode == TrkOptions::BlueTooth ? 60 : 5)) { + if (m_waitCount++ < (m_options->mode == TrkOptions::BlueTooth ? 3 : 5)) { QTimer::singleShot(1000, this, SLOT(startInferiorEarly())); } else { QString msg = QString::fromLatin1("Failed to connect to %1 after " diff --git a/src/plugins/debugger/gdb/trkgdbadapter.h b/src/plugins/debugger/gdb/trkgdbadapter.h index 55896eb1d085ff3207a309c823c4bb34c92b51b9..6359a428478fc95fa0695aa0e226526a3227d3f4 100644 --- a/src/plugins/debugger/gdb/trkgdbadapter.h +++ b/src/plugins/debugger/gdb/trkgdbadapter.h @@ -85,6 +85,7 @@ public: // Set a device (from the project) to override the settings. QString overrideTrkDevice() const; void setOverrideTrkDevice(const QString &); + const TrkOptionsPtr options() const { return m_options; } signals: void output(const QString &msg); diff --git a/src/plugins/debugger/idebuggerengine.h b/src/plugins/debugger/idebuggerengine.h index de2e7c5facc1aa9a25ad8cd195e814fba9cf5e44..6724d0093511865dd59ab1aedba2dd47d357b487 100644 --- a/src/plugins/debugger/idebuggerengine.h +++ b/src/plugins/debugger/idebuggerengine.h @@ -43,6 +43,10 @@ namespace TextEditor { class ITextEditor; } +namespace Core { +class IOptionsPage; +} + namespace Debugger { namespace Internal { @@ -105,6 +109,8 @@ public: virtual void setRegisterValue(int regnr, const QString &value) { Q_UNUSED(regnr); Q_UNUSED(value); } + virtual void addOptionPages(QList<Core::IOptionsPage*> *) const {} + signals: void startSuccessful(); void startFailed();