diff --git a/src/plugins/debugger/cdb/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp index 44c739362d422d93336600412336902b932d7243..3c6ac42e0c051390052599fa35b120c086ef49f1 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.cpp +++ b/src/plugins/debugger/cdb/cdbdebugengine.cpp @@ -563,11 +563,11 @@ void CdbDebugEnginePrivate::clearDisplay() m_debuggerManagerAccess->registerHandler()->removeAll(); } -bool CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) +void CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) { if (m_d->m_hDebuggeeProcess) { warning(QLatin1String("Internal error: Attempt to start debugger while another process is being debugged.")); - return false; + emit startFailed(); } m_d->clearDisplay(); @@ -627,7 +627,11 @@ bool CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> } else { warning(errorMessage); } - return rc; + + if (rc) + emit startSuccessful(); + else + emit startFailed(); } bool CdbDebugEngine::startAttachDebugger(qint64 pid, DebuggerStartMode sm, QString *errorMessage) diff --git a/src/plugins/debugger/cdb/cdbdebugengine.h b/src/plugins/debugger/cdb/cdbdebugengine.h index 521b7b172017cbecf13d7a04b07568327e6d3be4..18b660416520f01f54ffbf6d9cecba4aa65a4733 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.h +++ b/src/plugins/debugger/cdb/cdbdebugengine.h @@ -62,7 +62,7 @@ public: virtual void shutdown(); virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); - virtual bool startDebugger(const QSharedPointer<DebuggerStartParameters> &startParameters); + virtual void startDebugger(const QSharedPointer<DebuggerStartParameters> &startParameters); virtual void exitDebugger(); virtual void detachDebugger(); virtual void updateWatchData(const WatchData &data); diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index b4a5c84a7ee71c28a106aa8b3e200471d4a9c7ca..9bc178ca9469b3965cca24ce2f026b4d6f110f16 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -182,9 +182,10 @@ void DebuggerStartParameters::clear() /////////////////////////////////////////////////////////////////////// static IDebuggerEngine *gdbEngine = 0; -static IDebuggerEngine *winEngine = 0; static IDebuggerEngine *scriptEngine = 0; +static IDebuggerEngine *symbianEngine = 0; static IDebuggerEngine *tcfEngine = 0; +static IDebuggerEngine *winEngine = 0; DebuggerManager::DebuggerManager() : m_startParameters(new DebuggerStartParameters), @@ -197,9 +198,10 @@ DebuggerManager::~DebuggerManager() { #define doDelete(ptr) delete ptr; ptr = 0 doDelete(gdbEngine); - doDelete(winEngine); doDelete(scriptEngine); + doDelete(symbianEngine); doDelete(tcfEngine); + doDelete(winEngine); #undef doDelete } @@ -446,6 +448,8 @@ QList<Core::IOptionsPage*> DebuggerManager::initializeEngines(unsigned enabledTy QList<Core::IOptionsPage*> rc; if (enabledTypeFlags & GdbEngineType) gdbEngine = createGdbEngine(this, &rc); + if (enabledTypeFlags & SymbianEngineType) + symbianEngine = createSymbianEngine(this, &rc); winEngine = createWinEngine(this, (enabledTypeFlags & CdbEngineType), &rc); if (enabledTypeFlags & ScriptEngineType) scriptEngine = createScriptEngine(this, &rc); @@ -695,9 +699,10 @@ void DebuggerManager::updateWatchData(const WatchData &data) m_engine->updateWatchData(data); } -static inline QString msgEngineNotAvailable(const char *engine) +static QString msgEngineNotAvailable(const char *engine) { - return DebuggerManager::tr("The application requires the debugger engine '%1', which is disabled.").arg(QLatin1String(engine)); + return DebuggerManager::tr("The application requires the debugger engine '%1', " + "which is disabled.").arg(QLatin1String(engine)); } static IDebuggerEngine *debuggerEngineForToolChain(ProjectExplorer::ToolChain::ToolChainType tc) @@ -739,7 +744,16 @@ static IDebuggerEngine *determineDebuggerEngine(const QString &executable, return scriptEngine; } - if (IDebuggerEngine *tce = debuggerEngineForToolChain(static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType))) + if (executable.endsWith(_(".sym"))) { + if (!symbianEngine) { + *errorMessage = msgEngineNotAvailable("Symbian Engine"); + return 0; + } + return symbianEngine; + } + + if (IDebuggerEngine *tce = debuggerEngineForToolChain( + static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType))) return tce; #ifndef Q_OS_WIN @@ -774,7 +788,8 @@ static IDebuggerEngine *determineDebuggerEngine(int /* pid */, int toolChainType, QString *errorMessage) { - if (IDebuggerEngine *tce = debuggerEngineForToolChain(static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType))) + if (IDebuggerEngine *tce = debuggerEngineForToolChain( + static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType))) return tce; #ifdef Q_OS_WIN // Preferably Windows debugger @@ -846,11 +861,15 @@ void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl, setBusyCursor(false); setStatus(DebuggerProcessStartingUp); - if (!m_engine->startDebugger(m_startParameters)) { - setStatus(DebuggerProcessNotReady); - debuggingFinished(); - return; - } + connect(m_engine, SIGNAL(startFailed()), this, SLOT(startFailed())); + m_engine->startDebugger(m_startParameters); +} + +void DebuggerManager::startFailed() +{ + disconnect(m_engine, SIGNAL(startFailed()), this, SLOT(startFailed())); + setStatus(DebuggerProcessNotReady); + debuggingFinished(); } void DebuggerManager::cleanupViews() diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index de2a192abd1a3258cb481c36571a05a029c6cf8e..3b9622e7f4c61a59a61545f3c9e519fe3215cb6c 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -172,12 +172,18 @@ class CdbDebugEngine; struct CdbDebugEnginePrivate; // Flags for initialization -enum DebuggerEngineTypeFlags { - GdbEngineType = 0x1, - ScriptEngineType = 0x2, - CdbEngineType = 0x4, - TcfEngineType = 0x8, - AllEngineTypes = (GdbEngineType|ScriptEngineType|CdbEngineType|TcfEngineType) +enum DebuggerEngineTypeFlags +{ + GdbEngineType = 0x01, + 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 @@ -324,6 +330,8 @@ public slots: void showStatusMessage(const QString &msg, int timeout = -1); // -1 forever private slots: + void showDebuggerOutput(const QString &msg) + { showDebuggerOutput(LogDebug, msg); } void showDebuggerOutput(int channel, const QString &msg); void showDebuggerInput(int channel, const QString &msg); void showApplicationOutput(const QString &data); @@ -343,6 +351,7 @@ private slots: void attemptBreakpointSynchronization(); void reloadFullStack(); void stepByInstructionTriggered(); + void startFailed(); private: // diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 055d8adfdf21238a0b5b7526eb645f7e5110218a..7c1909addc3fcee270cd9fcfb5e60138dc1c4197 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -180,6 +180,8 @@ void GdbEngine::initializeConnections() this, SLOT(readGdbStandardError())); connect(m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), q, SLOT(exitDebugger())); + connect(m_gdbProc, SIGNAL(started()), + this, SLOT(startDebugger2())); connect(&m_stubProc, SIGNAL(processError(QString)), this, SLOT(stubError(QString))); @@ -1440,7 +1442,8 @@ void GdbEngine::exitDebugger() if (m_gdbProc->state() == QProcess::Starting) { debugMessage(_("WAITING FOR GDB STARTUP TO SHUTDOWN: %1") .arg(m_gdbProc->state())); - m_gdbProc->waitForStarted(); + // FIXME: handle this! + //m_gdbProc->waitForStarted(); } if (m_gdbProc->state() == QProcess::Running) { debugMessage(_("WAITING FOR RUNNING GDB TO SHUTDOWN: %1") @@ -1481,8 +1484,9 @@ int GdbEngine::currentFrame() const return qq->stackHandler()->currentIndex(); } -bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) +void GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) { + m_startParameters = *sp; // This should be set by the constructor or in exitDebugger(). QTC_ASSERT(m_debuggingHelperState == DebuggingHelperUninitialized, initializeVariables()); @@ -1492,7 +1496,8 @@ bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) if (m_gdbProc->state() != QProcess::NotRunning) { debugMessage(_("GDB IS ALREADY RUNNING, STATE: %1").arg(m_gdbProc->state())); m_gdbProc->kill(); - return false; + emit startFailed(); + return; } //gdbArgs.prepend(_("--quiet")); @@ -1503,37 +1508,42 @@ bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) // nothing to do } else if (q->startMode() == StartRemote) { // Start the remote server - if (sp->serverStartScript.isEmpty()) { + if (m_startParameters.serverStartScript.isEmpty()) { q->showStatusMessage(_("No server start script given. " "Assuming server runs already.")); } else { - if (!sp->workingDir.isEmpty()) - m_uploadProc.setWorkingDirectory(sp->workingDir); - if (!sp->environment.isEmpty()) - m_uploadProc.setEnvironment(sp->environment); - m_uploadProc.start(_("/bin/sh ") + sp->serverStartScript); + if (!m_startParameters.workingDir.isEmpty()) + m_uploadProc.setWorkingDirectory(m_startParameters.workingDir); + if (!m_startParameters.environment.isEmpty()) + m_uploadProc.setEnvironment(m_startParameters.environment); + m_uploadProc.start(_("/bin/sh ") + m_startParameters.serverStartScript); m_uploadProc.waitForStarted(); } - } else if (sp->useTerminal) { + } else if (m_startParameters.useTerminal) { m_stubProc.stop(); // We leave the console open, so recycle it now. - m_stubProc.setWorkingDirectory(sp->workingDir); - m_stubProc.setEnvironment(sp->environment); - if (!m_stubProc.start(sp->executable, sp->processArgs)) - return false; // Error message for user is delivered via a signal. + m_stubProc.setWorkingDirectory(m_startParameters.workingDir); + m_stubProc.setEnvironment(m_startParameters.environment); + if (!m_stubProc.start(m_startParameters.executable, + m_startParameters.processArgs)) { + // Error message for user is delivered via a signal. + emit startFailed(); + return; + } } else { if (!m_outputCollector.listen()) { QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"), tr("Cannot set up communication with child process: %1") .arg(m_outputCollector.errorString())); - return false; + emit startFailed(); + return; } gdbArgs.prepend(_("--tty=") + m_outputCollector.serverName()); - if (!sp->workingDir.isEmpty()) - m_gdbProc->setWorkingDirectory(sp->workingDir); - if (!sp->environment.isEmpty()) - m_gdbProc->setEnvironment(sp->environment); + if (!m_startParameters.workingDir.isEmpty()) + m_gdbProc->setWorkingDirectory(m_startParameters.workingDir); + if (!m_startParameters.environment.isEmpty()) + m_gdbProc->setEnvironment(m_startParameters.environment); } #if 0 @@ -1542,13 +1552,18 @@ bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) qDebug() << "ScriptFile:" << q->settings()->m_scriptFile; qDebug() << "Environment:" << m_gdbProc->environment(); qDebug() << "Arguments:" << gdbArgs; - qDebug() << "BuildDir:" << sp->buildDir; - qDebug() << "ExeFile:" << sp->executable; + qDebug() << "BuildDir:" << m_startParameters.buildDir; + qDebug() << "ExeFile:" << m_startParameters.executable; #endif QString loc = theDebuggerStringSetting(GdbLocation); q->showStatusMessage(tr("Starting Debugger: ") + loc + _c(' ') + gdbArgs.join(_(" "))); m_gdbProc->start(loc, gdbArgs); +} + +void GdbEngine::startDebugger2() +{ +#if 0 if (!m_gdbProc->waitForStarted()) { QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"), tr("Cannot start debugger: %1").arg(m_gdbProc->errorString())); @@ -1556,8 +1571,10 @@ bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) m_stubProc.blockSignals(true); m_stubProc.stop(); m_stubProc.blockSignals(false); - return false; + emit startFailed(); + return; } +#endif q->showStatusMessage(tr("Gdb Running...")); @@ -1639,39 +1656,39 @@ bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) } if (q->startMode() == AttachExternal || q->startMode() == AttachCrashedExternal) { - postCommand(_("attach %1").arg(sp->attachPID), CB(handleAttach)); + postCommand(_("attach %1").arg(m_startParameters.attachPID), CB(handleAttach)); // Task 254674 does not want to remove them //qq->breakHandler()->removeAllBreakpoints(); } else if (q->startMode() == AttachCore) { - QFileInfo fi(sp->executable); + QFileInfo fi(m_startParameters.executable); QString fileName = _c('"') + fi.absoluteFilePath() + _c('"'); - QFileInfo fi2(sp->coreFile); + QFileInfo fi2(m_startParameters.coreFile); // quoting core name below fails in gdb 6.8-debian QString coreName = fi2.absoluteFilePath(); postCommand(_("-file-exec-and-symbols ") + fileName, CB(handleFileExecAndSymbols)); postCommand(_("target core ") + coreName, CB(handleTargetCore)); qq->breakHandler()->removeAllBreakpoints(); } else if (q->startMode() == StartRemote) { - postCommand(_("set architecture %1").arg(sp->remoteArchitecture)); + postCommand(_("set architecture %1").arg(m_startParameters.remoteArchitecture)); qq->breakHandler()->setAllPending(); - //QFileInfo fi(sp->executable); + //QFileInfo fi(m_startParameters.executable); //QString fileName = fi.absoluteFileName(); - QString fileName = sp->executable; + QString fileName = m_startParameters.executable; postCommand(_("-file-exec-and-symbols \"%1\"").arg(fileName), CB(handleFileExecAndSymbols)); // works only for > 6.8 postCommand(_("set target-async on"), CB(handleSetTargetAsync)); - } else if (sp->useTerminal) { + } else if (m_startParameters.useTerminal) { qq->breakHandler()->setAllPending(); } else if (q->startMode() == StartInternal || q->startMode() == StartExternal) { - QFileInfo fi(sp->executable); + QFileInfo fi(m_startParameters.executable); QString fileName = _c('"') + fi.absoluteFilePath() + _c('"'); postCommand(_("-file-exec-and-symbols ") + fileName, CB(handleFileExecAndSymbols)); //postCommand(_("file ") + fileName, handleFileExecAndSymbols); #ifdef Q_OS_MAC postCommand(_("sharedlibrary apply-load-rules all")); #endif - if (!sp->processArgs.isEmpty()) - postCommand(_("-exec-arguments ") + sp->processArgs.join(_(" "))); + if (!m_startParameters.processArgs.isEmpty()) + postCommand(_("-exec-arguments ") + m_startParameters.processArgs.join(_(" "))); #ifndef Q_OS_MAC if (!m_dumperInjectionLoad) postCommand(_("set auto-solib-add off")); @@ -1686,7 +1703,7 @@ bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) qq->breakHandler()->setAllPending(); } - return true; + emit startSuccessful(); } void GdbEngine::continueInferior() diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 88eadb4c0953065dec8b8b44543920e86e111702..c0ec344432162f1c8a8f3751c2aa94d983072c56 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -31,6 +31,7 @@ #define DEBUGGER_GDBENGINE_H #include "idebuggerengine.h" +#include "debuggermanager.h" // only for StartParameters #include "gdbmi.h" #include "gdbprocessbase.h" #include "outputcollector.h" @@ -86,6 +87,8 @@ public: this, SIGNAL(readyReadStandardOutput())); connect(&m_proc, SIGNAL(readyReadStandardError()), this, SIGNAL(readyReadStandardError())); + connect(&m_proc, SIGNAL(started()), + this, SIGNAL(started())); connect(&m_proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SIGNAL(finished(int, QProcess::ExitStatus))); } @@ -133,7 +136,8 @@ private: void shutdown(); void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); - bool startDebugger(const QSharedPointer<DebuggerStartParameters> &sp); + void startDebugger(const QSharedPointer<DebuggerStartParameters> &sp); + Q_SLOT void startDebugger2(); void exitDebugger(); void detachDebugger(); @@ -430,6 +434,7 @@ private: DebuggerManager * const q; IDebuggerManagerAccessForEngines * const qq; + DebuggerStartParameters m_startParameters; // make sure to re-initialize new members in initializeVariables(); }; diff --git a/src/plugins/debugger/gdb/gdbprocessbase.h b/src/plugins/debugger/gdb/gdbprocessbase.h index b6adfc763bb533731f3ba1f365db956a8731fd00..bf5216ffe91fa12769744cc148bac184aff184ab 100644 --- a/src/plugins/debugger/gdb/gdbprocessbase.h +++ b/src/plugins/debugger/gdb/gdbprocessbase.h @@ -51,7 +51,7 @@ public: QIODevice::OpenMode mode = QIODevice::ReadWrite) = 0; virtual void kill() = 0; virtual void terminate() = 0; - virtual bool waitForStarted(int msecs = 30000) = 0; + //virtual bool waitForStarted(int msecs = 30000) = 0; virtual bool waitForFinished(int msecs = 30000) = 0; virtual QProcess::ProcessState state() const = 0; virtual QString errorString() const = 0; @@ -63,6 +63,7 @@ public: signals: void error(QProcess::ProcessError); + void started(); void readyReadStandardOutput(); void readyReadStandardError(); void finished(int, QProcess::ExitStatus); diff --git a/src/plugins/debugger/idebuggerengine.h b/src/plugins/debugger/idebuggerengine.h index 89ff30293195d52270afbb7a3e891f5777719720..7ae53804a23a666bd8a4129b417768cc1ee61539 100644 --- a/src/plugins/debugger/idebuggerengine.h +++ b/src/plugins/debugger/idebuggerengine.h @@ -55,12 +55,14 @@ class WatchData; class IDebuggerEngine : public QObject { + Q_OBJECT + public: IDebuggerEngine(QObject *parent = 0) : QObject(parent) {} virtual void shutdown() = 0; virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos) = 0; - virtual bool startDebugger(const QSharedPointer<DebuggerStartParameters> &startParameters) = 0; + virtual void startDebugger(const QSharedPointer<DebuggerStartParameters> &startParameters) = 0; virtual void exitDebugger() = 0; virtual void detachDebugger() {} virtual void updateWatchData(const WatchData &data) = 0; @@ -101,6 +103,10 @@ public: virtual void fetchDisassembler(DisassemblerViewAgent *, const StackFrame &) {} virtual void setRegisterValue(int regnr, const QString &value) { Q_UNUSED(regnr); Q_UNUSED(value); } + +signals: + void startSuccessful(); + void startFailed(); }; } // namespace Internal diff --git a/src/plugins/debugger/script/scriptengine.cpp b/src/plugins/debugger/script/scriptengine.cpp index 3f31ca421b0c1f94227c62ea1df9d2b113d01f0f..45742e967988eca19953af16c7f599b34855f73a 100644 --- a/src/plugins/debugger/script/scriptengine.cpp +++ b/src/plugins/debugger/script/scriptengine.cpp @@ -217,7 +217,7 @@ void ScriptEngine::exitDebugger() qq->notifyInferiorExited(); } -bool ScriptEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) +void ScriptEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) { if (!m_scriptEngine) m_scriptEngine = new QScriptEngine(this); @@ -233,15 +233,17 @@ bool ScriptEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> & QFileInfo fi(sp->executable); m_scriptFileName = fi.absoluteFilePath(); QFile scriptFile(m_scriptFileName); - if (!scriptFile.open(QIODevice::ReadOnly)) - return false; + if (!scriptFile.open(QIODevice::ReadOnly)) { + emit startFailed(); + return; + } QTextStream stream(&scriptFile); m_scriptContents = stream.readAll(); scriptFile.close(); attemptBreakpointSynchronization(); qq->notifyInferiorRunningRequested(); QTimer::singleShot(0, this, SLOT(runInferior())); - return true; + emit startSuccessful(); } void ScriptEngine::continueInferior() diff --git a/src/plugins/debugger/script/scriptengine.h b/src/plugins/debugger/script/scriptengine.h index 1f82a6ed5831db48e39af5ecffbb77bd6b220fe4..32e8d3fe4b12760382329b852ec988c37047dc22 100644 --- a/src/plugins/debugger/script/scriptengine.h +++ b/src/plugins/debugger/script/scriptengine.h @@ -75,7 +75,7 @@ private: void shutdown(); void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); - bool startDebugger(const QSharedPointer<DebuggerStartParameters> &sp); + void startDebugger(const QSharedPointer<DebuggerStartParameters> &sp); void exitDebugger(); diff --git a/src/plugins/debugger/symbian/symbian.pri b/src/plugins/debugger/symbian/symbian.pri index 1ffb8081d4f16b6706f1f4bbdccad970739b2bd7..afc2dbf9eef386707f8ad0b13896bd91aa51d92a 100644 --- a/src/plugins/debugger/symbian/symbian.pri +++ b/src/plugins/debugger/symbian/symbian.pri @@ -1,9 +1,11 @@ HEADERS += \ + $$PWD/trkutils.h \ $$PWD/trkclient.h \ $$PWD/symbianadapter.h \ #$$PWD/gdboptionspage.h \ SOURCES += \ + $$PWD/trkutils.cpp \ $$PWD/trkclient.cpp \ $$PWD/symbianadapter.cpp \ $$PWD/symbianengine.cpp \ diff --git a/src/plugins/debugger/symbian/symbianadapter.cpp b/src/plugins/debugger/symbian/symbianadapter.cpp index 5790cbf6c6a92f07bff9a52c267e9a1463d9b2d7..9ade25364d7e2cb121a98bb932a4c09455e04cb6 100644 --- a/src/plugins/debugger/symbian/symbianadapter.cpp +++ b/src/plugins/debugger/symbian/symbianadapter.cpp @@ -104,7 +104,7 @@ SymbianAdapter::SymbianAdapter() SymbianAdapter::~SymbianAdapter() { m_gdbServer.close(); - logMessage("Shutting down.\n", true); + logMessage("Shutting down.\n"); } void SymbianAdapter::trkLogMessage(const QString &msg) @@ -193,10 +193,10 @@ void SymbianAdapter::startInferior() //sendTrkMessage(TRK_WRITE_QUEUE_NOOP_CODE, TrkCB(startGdbServer)); } -void SymbianAdapter::logMessage(const QString &msg, bool force) +void SymbianAdapter::logMessage(const QString &msg) { - if (m_verbose || force) - emit output(QString(), msg); + if (m_verbose) + emit output(msg); } // @@ -289,17 +289,17 @@ bool SymbianAdapter::sendGdbServerPacket(const QByteArray &packet, bool doFlush) { if (!m_gdbConnection) { logMessage(QString::fromLatin1("Cannot write to gdb: No connection (%1)") - .arg(QString::fromLatin1(packet)), true); + .arg(QString::fromLatin1(packet))); return false; } if (m_gdbConnection->state() != QAbstractSocket::ConnectedState) { logMessage(QString::fromLatin1("Cannot write to gdb: Not connected (%1)") - .arg(QString::fromLatin1(packet)), true); + .arg(QString::fromLatin1(packet))); return false; } if (m_gdbConnection->write(packet) == -1) { logMessage(QString::fromLatin1("Cannot write to gdb: %1 (%2)") - .arg(m_gdbConnection->errorString()).arg(QString::fromLatin1(packet)), true); + .arg(m_gdbConnection->errorString()).arg(QString::fromLatin1(packet))); return false; } if (doFlush) @@ -720,6 +720,7 @@ void SymbianAdapter::handleGdbServerCommand(const QByteArray &cmd) if (bp == 0) { logMessage(QString::fromLatin1("NO RECORDED BP AT 0x%1, %2") .arg(addr, 0, 16).arg(len)); + sendGdbServerMessage("E00"); } else { //---IDE------------------------------------------------------ // Command: 0x1C Clear Break @@ -748,7 +749,7 @@ void SymbianAdapter::handleGdbServerCommand(const QByteArray &cmd) if (ok1 && ok2) { const QString msg = QString::fromLatin1("Read of OS auxilary " "vector (%1, %2) not implemented.").arg(offset).arg(length); - logMessage(msgGdbPacket(msg), true); + logMessage(msgGdbPacket(msg)); sendGdbServerMessage("E20", msg.toLatin1()); handled = true; } @@ -757,7 +758,7 @@ void SymbianAdapter::handleGdbServerCommand(const QByteArray &cmd) if (!handled) { const QString msg = QLatin1String("FIXME unknown 'XFER'-request: ") + QString::fromAscii(cmd); - logMessage(msgGdbPacket(msg), true); + logMessage(msgGdbPacket(msg)); sendGdbServerMessage("E20", msg.toLatin1()); } } // qPart/qXfer @@ -820,7 +821,7 @@ void SymbianAdapter::handleTrkResult(const TrkResult &result) QString logMsg; QTextStream(&logMsg) << prefix << "NAK: for token=" << result.token << " ERROR: " << errorMessage(result.data.at(0)) << ' ' << str; - logMessage(logMsg, true); + logMessage(logMsg); break; } case 0x90: { // Notified Stopped @@ -1221,7 +1222,7 @@ void SymbianAdapter::handleTrkVersions(const TrkResult &result) void SymbianAdapter::handleDisconnect(const TrkResult & /*result*/) { - logMessage(QLatin1String("Trk disconnected"), true); + logMessage(QLatin1String("Trk disconnected")); } void SymbianAdapter::readMemory(uint addr, uint len) @@ -1284,9 +1285,9 @@ void SymbianAdapter::connectProcess(QProcess *proc) void SymbianAdapter::sendOutput(QObject *sender, const QString &data) { if (sender) - emit output(sender->objectName() + " : ", data); + emit output(sender->objectName() + " : " + data); else - emit output(QString(), data); + emit output(data); } void SymbianAdapter::handleProcError(QProcess::ProcessError error) @@ -1328,13 +1329,13 @@ void SymbianAdapter::startGdb() { if (!m_gdbServer.listen(QHostAddress(gdbServerIP()), gdbServerPort())) { logMessage(QString("Unable to start the gdb server at %1: %2.") - .arg(m_gdbServerName).arg(m_gdbServer.errorString()), true); + .arg(m_gdbServerName).arg(m_gdbServer.errorString())); QCoreApplication::exit(5); return; } logMessage(QString("Gdb server running on %1.\nRegister endianness: %3.") - .arg(m_gdbServerName).arg(m_registerEndianness), true); + .arg(m_gdbServerName).arg(m_registerEndianness)); connect(&m_gdbServer, SIGNAL(newConnection()), this, SLOT(handleGdbConnection())); @@ -1379,12 +1380,12 @@ void SymbianAdapter::startGdb() sendGdbMessage("symbol-file filebrowseapp.sym"); // -symbol-info-address not implemented in cs-gdb 6.4-6.8 (at least) - sendGdbMessage("info address E32Main", - GdbCB(handleInfoMainAddress)); - sendGdbMessage("info address CFileBrowseAppUi::HandleCommandL", - GdbCB(handleInfoMainAddress)); + //sendGdbMessage("info address E32Main", + // GdbCB(handleInfoMainAddress)); + //sendGdbMessage("info address CFileBrowseAppUi::HandleCommandL", + // GdbCB(handleInfoMainAddress)); -#if 1 +#if 0 // FIXME: Gdb based version. That's the goal //sendGdbMessage("break E32Main"); //sendGdbMessage("continue"); @@ -1392,8 +1393,11 @@ void SymbianAdapter::startGdb() // trkContinueMessage(), "CONTINUE"); #else // Directly talk to TRK. Works for now... - sendGdbMessage("break E32Main"); - sendGdbMessage("break filebrowseappui.cpp:39"); + //sendGdbMessage("break E32Main"); + sendGdbMessage("-break-insert E32Main"); + sendGdbMessage("-break-insert filebrowseappui.cpp:39"); + sendGdbMessage("target remote " + m_gdbServerName); + //sendGdbMessage("break filebrowseappui.cpp:39"); // sendTrkMessage(0x18, TrkCallback(), trkContinueMessage(), "CONTINUE"); #endif } @@ -1441,6 +1445,7 @@ void SymbianAdapter::handleGdbReadyReadStandardOutput() if (!cmd.callback.isNull()) cmd.callback(result); #else +/* bool ok; QRegExp re(QString("Symbol .._Z7E32Mainv.. is a function at address 0x(.*)\\.")); if (re.indexIn(str) != -1) { @@ -1459,6 +1464,7 @@ void SymbianAdapter::handleGdbReadyReadStandardOutput() sendGdbMessage("target remote " + m_gdbServerName); return; } +*/ logMessage(QString("-> GDB: %1").arg(str)); #endif } @@ -1505,6 +1511,8 @@ void SymbianAdapter::handleRfcommReadyReadStandardOutput() void SymbianAdapter::start(const QString &program, const QStringList &args, QIODevice::OpenMode mode) { + qDebug() << "SYMBIAN START"; + run(); //m_gdbProc.start(program, args, mode); } @@ -1518,12 +1526,6 @@ void SymbianAdapter::terminate() //m_gdbProc.terminate(); } -bool SymbianAdapter::waitForStarted(int msecs) -{ - //return m_gdbProc.waitForStarted(msecs); - return true; -} - bool SymbianAdapter::waitForFinished(int msecs) { //return m_gdbProc.waitForFinished(msecs); diff --git a/src/plugins/debugger/symbian/symbianadapter.h b/src/plugins/debugger/symbian/symbianadapter.h index 45c5b762c04818885c88d1c6a0ae6d0f0cb56c01..79c7860d5c4b08c2aa95a9a18a3456fe5b4efad6 100644 --- a/src/plugins/debugger/symbian/symbianadapter.h +++ b/src/plugins/debugger/symbian/symbianadapter.h @@ -95,7 +95,7 @@ public slots: void startInferior(); signals: - void output(const QString &senderName, const QString &data); + void output(const QString &msg); private slots: void handleProcError(QProcess::ProcessError error); @@ -126,7 +126,6 @@ public: QIODevice::OpenMode mode = QIODevice::ReadWrite); void kill(); void terminate(); - bool waitForStarted(int msecs = 30000); bool waitForFinished(int msecs = 30000); QProcess::ProcessState state() const; QString errorString() const; @@ -213,7 +212,7 @@ public: Q_SLOT void handleGdbReadyReadStandardError(); Q_SLOT void handleGdbReadyReadStandardOutput(); - void logMessage(const QString &msg, bool force = false); + void logMessage(const QString &msg); // triggers output() if m_verbose Q_SLOT void trkLogMessage(const QString &msg); void handleInfoAddress(const GdbResult &result); diff --git a/src/plugins/debugger/symbian/symbianengine.cpp b/src/plugins/debugger/symbian/symbianengine.cpp index 11c6b03c8ad2f81e78a2a2a3386be525fc05530d..ef407e2c53fbe90d020afcb36ef5ff0ff72880f1 100644 --- a/src/plugins/debugger/symbian/symbianengine.cpp +++ b/src/plugins/debugger/symbian/symbianengine.cpp @@ -31,6 +31,7 @@ #include "gdb/gdbengine.h" #include "symbianadapter.h" +#include "debuggermanager.h" //#include "debuggerdialogs.h" @@ -40,24 +41,20 @@ #include <coreplugin/dialogs/ioptionspage.h> #include <QtCore/QDebug> -#include <QtCore/QDir> -#include <QtCore/QFileInfo> -#include <QtCore/QMetaObject> -#include <QtCore/QTime> -#include <QtCore/QTimer> -#include <QtCore/QTextStream> namespace Debugger { namespace Internal { - IDebuggerEngine *createSymbianEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *opts) { Q_UNUSED(opts); //opts->push_back(new GdbOptionsPage); - return new GdbEngine(parent, new SymbianAdapter); + SymbianAdapter *adapter = new SymbianAdapter; + QObject::connect(adapter, SIGNAL(output(QString)), + parent, SLOT(showDebuggerOutput(QString))); + return new GdbEngine(parent, adapter); } } // namespace Internal diff --git a/src/plugins/debugger/tcf/tcfengine.cpp b/src/plugins/debugger/tcf/tcfengine.cpp index 0c98513b8ec4ac9163e537adce6f20319ba64a02..bcadf3c9540ad3ec291c0685f5d4ad2cbd5bbefc 100644 --- a/src/plugins/debugger/tcf/tcfengine.cpp +++ b/src/plugins/debugger/tcf/tcfengine.cpp @@ -220,7 +220,7 @@ void TcfEngine::exitDebugger() qq->notifyInferiorExited(); } -bool TcfEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) +void TcfEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) { qq->notifyInferiorRunningRequested(); const int pos = sp->remoteChannel.indexOf(QLatin1Char(':')); @@ -228,7 +228,7 @@ bool TcfEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) const quint16 port = sp->remoteChannel.mid(pos + 1).toInt(); //QTimer::singleShot(0, this, SLOT(runInferior())); m_socket->connectToHost(host, port); - return true; + emit startSuccessful(); } void TcfEngine::continueInferior() diff --git a/src/plugins/debugger/tcf/tcfengine.h b/src/plugins/debugger/tcf/tcfengine.h index 3d556427bd9ad079b2d557d0c6af0c16973cfdf3..4487fffd3de0675f2343a6e442c724569a507dcd 100644 --- a/src/plugins/debugger/tcf/tcfengine.h +++ b/src/plugins/debugger/tcf/tcfengine.h @@ -82,7 +82,7 @@ private: void shutdown(); void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); - bool startDebugger(const QSharedPointer<DebuggerStartParameters> &sp); + void startDebugger(const QSharedPointer<DebuggerStartParameters> &sp); void exitDebugger(); void continueInferior(); diff --git a/tests/manual/trk/runner.cpp b/tests/manual/trk/runner.cpp index 00a4b9bd15ece9098c6c69e40ccd3e78cc4cb391..b43118f4b25ee7b58f935d970281315de2fd145d 100755 --- a/tests/manual/trk/runner.cpp +++ b/tests/manual/trk/runner.cpp @@ -53,9 +53,9 @@ signals: void executeCommand(QString); public slots: - void handleOutput(const QString &senderName, const QString &data) + void handleOutput(const QString &str0) { - QString str = senderName + data; + QString str = str0; str.replace("\\t", QString(QChar(0x09))); str.replace("\\n", QString("\n")); append(str); @@ -137,8 +137,8 @@ RunnerGui::RunnerGui(SymbianAdapter *adapter) connectAction(m_disassIAction, "Disass Inst", SLOT(executeDisassICommand())); connectAction(m_continueAction, "Continue", SLOT(executeContinueCommand())); - connect(adapter, SIGNAL(output(QString,QString)), - &m_textEdit, SLOT(handleOutput(QString,QString))); + connect(adapter, SIGNAL(output(QString)), + &m_textEdit, SLOT(handleOutput(QString))); connect(&m_textEdit, SIGNAL(executeCommand(QString)), m_adapter, SLOT(executeCommand(QString))); }