diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 27524c49fea47a490bc8eef40ac08ab4741caba7..23cecbd53ee7cd1ca103aa3556c4502026485419 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -168,6 +168,7 @@ DEBUGGER_EXPORT QDebug operator<<(QDebug str, const DebuggerStartParameters &p) << " attachPID=" << p.attachPID << " useTerminal=" << p.useTerminal << " remoteChannel=" << p.remoteChannel << " remoteArchitecture=" << p.remoteArchitecture + << " symbolFileName=" << p.symbolFileName << " serverStartScript=" << p.serverStartScript << " toolchain=" << p.toolChainType << '\n'; return str; @@ -859,6 +860,12 @@ static IDebuggerEngine *debuggerEngineForToolChain(ProjectExplorer::ToolChain::T case ProjectExplorer::ToolChain::WINCE: rc = winEngine; break; + case ProjectExplorer::ToolChain::WINSCW: // S60 + case ProjectExplorer::ToolChain::GCCE: + case ProjectExplorer::ToolChain::RVCT_ARMV5: + case ProjectExplorer::ToolChain::RVCT_ARMV6: + rc = gdbEngine; + break; case ProjectExplorer::ToolChain::OTHER: case ProjectExplorer::ToolChain::UNKNOWN: case ProjectExplorer::ToolChain::INVALID: diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 77e36720971b239ba5a2a72cbddde9de765164e8..e077cee67a165aa451138dfe1fc39d307d152e82 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -110,6 +110,7 @@ public: // for remote debugging QString remoteChannel; QString remoteArchitecture; + QString symbolFileName; QString serverStartScript; int toolChainType; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 783ac19865209dceb9cc0ee46c6b36ae3e156f01..9bdd670a860d314d23272a2885a4678239edbac1 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -61,6 +61,7 @@ #include <utils/qtcassert.h> #include <utils/fancymainwindow.h> #include <texteditor/itexteditor.h> +#include <projectexplorer/toolchain.h> #include <coreplugin/icore.h> #include <QtCore/QDebug> @@ -1511,6 +1512,33 @@ int GdbEngine::currentFrame() const return manager()->stackHandler()->currentIndex(); } +AbstractGdbAdapter *GdbEngine::determineAdapter(const DebuggerStartParametersPtr &sp) const +{ + switch (sp->toolChainType) { + case ProjectExplorer::ToolChain::WINSCW: // S60 + case ProjectExplorer::ToolChain::GCCE: + case ProjectExplorer::ToolChain::RVCT_ARMV5: + case ProjectExplorer::ToolChain::RVCT_ARMV6: + return m_trkAdapter; + default: + break; + } + // @todo: remove testing hack + if (sp->executable.endsWith(_(".sym"))) + return m_trkAdapter; + switch (sp->startMode) { + case AttachCore: + return m_coreAdapter; + case StartRemote: + return m_remoteAdapter; + case AttachExternal: + return m_attachAdapter; + default: + break; + } + return m_plainAdapter; +} + void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp) { QTC_ASSERT(state() == EngineStarting, qDebug() << state()); @@ -1525,16 +1553,7 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp) if (m_gdbAdapter) disconnectAdapter(); - if (sp->executable.endsWith(_(".sym"))) - m_gdbAdapter = m_trkAdapter; - else if (sp->startMode == AttachCore) - m_gdbAdapter = m_coreAdapter; - else if (sp->startMode == StartRemote) - m_gdbAdapter = m_remoteAdapter; - else if (sp->startMode == AttachExternal) - m_gdbAdapter = m_attachAdapter; - else - m_gdbAdapter = m_plainAdapter; + m_gdbAdapter = determineAdapter(sp); if (startModeAllowsDumpers()) connectDebuggingHelperActions(); diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 29aa87845f2dcc066566fee9e49c49d8aa84869f..3db2d91e1ad7ecaea7078ab2e6cd0d7692567dc1 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -395,6 +395,7 @@ private: void setLocals(const QList<GdbMi> &locals); void connectDebuggingHelperActions(); void disconnectDebuggingHelperActions(); + AbstractGdbAdapter *determineAdapter(const DebuggerStartParametersPtr &dp) const; bool startModeAllowsDumpers() const; QString parseDisassembler(const GdbMi &lines); diff --git a/src/plugins/debugger/gdb/trkgdbadapter.cpp b/src/plugins/debugger/gdb/trkgdbadapter.cpp index f6587be9289abb61a67aa9c527a7e95ff321afd5..737cd09fef2c684131021942fd9568e77faf1495 100644 --- a/src/plugins/debugger/gdb/trkgdbadapter.cpp +++ b/src/plugins/debugger/gdb/trkgdbadapter.cpp @@ -278,8 +278,7 @@ void TrkGdbAdapter::startInferiorEarly() appendByte(&ba, 0); // ? appendByte(&ba, 0); // ? - QByteArray file("C:\\sys\\bin\\filebrowseapp.exe"); - appendString(&ba, file, TargetByteOrder); + appendString(&ba, m_remoteExecutable.toLatin1(), TargetByteOrder); sendTrkMessage(0x40, TrkCB(handleCreateProcess), ba); // Create Item //sendTrkMessage(TRK_WRITE_QUEUE_NOOP_CODE, TrkCB(startGdbServer)); } @@ -1400,6 +1399,17 @@ void TrkGdbAdapter::handleGdbStateChanged(QProcess::ProcessState newState) void TrkGdbAdapter::startAdapter() { + // Retrieve parameters + const DebuggerStartParameters ¶meters = m_engine->startParameters(); + setOverrideTrkDevice(parameters.remoteChannel); + m_remoteExecutable = parameters.executable; + m_symbolFile = parameters.symbolFileName; + // @todo: testing hack, remove! + if (m_remoteExecutable.endsWith(_(".sym"))) { + m_symbolFile = m_remoteExecutable; + m_remoteExecutable = QLatin1String("C:\\sys\\bin\\filebrowseapp.exe"); + } + // Start QTC_ASSERT(state() == EngineStarting, qDebug() << state()); setState(AdapterStarting); debugMessage(_("TRYING TO START ADAPTER")); @@ -1437,10 +1447,14 @@ void TrkGdbAdapter::prepareInferior() // We already started the inferior process during the adapter start. // Now make gdb aware of it. setState(InferiorPreparing); - QString fileName = m_engine->startParameters().executable; - m_engine->postCommand(_("add-symbol-file \"%1\" %2").arg(fileName) - .arg(m_session.codeseg)); - m_engine->postCommand(_("symbol-file \"%1\"").arg(fileName)); + const QString fileName = m_symbolFile; + if (m_symbolFile.isEmpty()) { + logMessage(QString::fromLatin1("WARNING: No symbol file available.")); + } else { + m_engine->postCommand(_("add-symbol-file \"%1\" %2").arg(m_symbolFile) + .arg(m_session.codeseg)); + m_engine->postCommand(_("symbol-file \"%1\"").arg(m_symbolFile)); + } m_engine->postCommand(_("target remote ") + gdbServerName(), CB(handleTargetRemote)); } diff --git a/src/plugins/debugger/gdb/trkgdbadapter.h b/src/plugins/debugger/gdb/trkgdbadapter.h index 8706e50a2f086498b511e0ce3ccd98f138f04e07..3529bf33fe15032006a3f17ed61e840bc3938fe4 100644 --- a/src/plugins/debugger/gdb/trkgdbadapter.h +++ b/src/plugins/debugger/gdb/trkgdbadapter.h @@ -244,6 +244,8 @@ public: Q_SLOT void executeCommand(const QString &msg); trk::Session m_session; // global-ish data (process id, target information) trk::Snapshot m_snapshot; // local-ish data (memory and registers) + QString m_remoteExecutable; + QString m_symbolFile; int m_verbose; bool m_bufferedMemoryRead; int m_waitCount; diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index 47204dad2807f8ff890f5d9fee92372d3521446e..71b0d544cc3f7a4e105cdba6f79f6b23e8911b0d 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.pro @@ -141,9 +141,3 @@ OTHER_FILES += ProjectExplorer.pluginspec mac:LIBS += -framework Carbon -win32:SUPPORT_QT_S60=1 -else:SUPPORT_QT_S60 = $$(QTCREATOR_WITH_S60) -!isEmpty(SUPPORT_QT_S60) { - message("Adding experimental support for Qt/S60 applications.") - DEFINES += QTCREATOR_WITH_S60 -} diff --git a/src/plugins/projectexplorer/toolchain.h b/src/plugins/projectexplorer/toolchain.h index 41fe8fdc866d52a94b7f9ffffffc98e44977d46b..b3a11cb7be28305f4bd3e2519503d9e192ee77a8 100644 --- a/src/plugins/projectexplorer/toolchain.h +++ b/src/plugins/projectexplorer/toolchain.h @@ -79,15 +79,11 @@ public: MinGW = 2, MSVC = 3, WINCE = 4, -#ifdef QTCREATOR_WITH_S60 WINSCW = 5, GCCE = 6, RVCT_ARMV5 = 7, RVCT_ARMV6 = 8, LAST_VALID = 9, -#else - LAST_VALID = 5, -#endif OTHER = 200, UNKNOWN = 201, INVALID = 202 diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp index 4599e16dbf44516c0788b61cd70d1ffb6ef57d6d..699d4eaa3ac9edc368c0c52f55ea321fe3e0cace 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp @@ -197,7 +197,7 @@ QString S60DeviceRunConfiguration::packageFileName() const "/S60/devices/S60_3rd_FP2_SDK_v1.1/epoc32/release/gcce/udeb/foo.exe" - "!:\sys\bin\foo.exe" \endcode */ -static QString executableFromPkgFile(const QString &pkgFileName, QString *errorMessage) +static QString localExecutableFromPkgFile(const QString &pkgFileName, QString *errorMessage) { QFile pkgFile(pkgFileName); if (!pkgFile.open(QIODevice::ReadOnly|QIODevice::Text)) { @@ -214,12 +214,12 @@ static QString executableFromPkgFile(const QString &pkgFileName, QString *errorM return QString(); } -QString S60DeviceRunConfiguration::executableFileName() const +QString S60DeviceRunConfiguration::localExecutableFileName() const { const QString pkg = packageFileName(); if (!pkg.isEmpty()) { QString errorMessage; - const QString rc = executableFromPkgFile(pkg, &errorMessage); + const QString rc = localExecutableFromPkgFile(pkg, &errorMessage); if (rc.isEmpty()) qWarning("%s\n", qPrintable(errorMessage)); return rc; @@ -536,7 +536,7 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(const QSharedPointer<RunConfigu m_toolsDirectory = S60Manager::instance()->deviceForQtVersion( project->qtVersion(project->activeBuildConfiguration())).toolsRoot + "/epoc32/tools"; - m_executableFileName = lsFile(s60runConfig->executableFileName()); + m_executableFileName = lsFile(s60runConfig->localExecutableFileName()); m_makesisTool = m_toolsDirectory + "/makesis.exe"; m_packageFile = QFileInfo(s60runConfig->packageFileName()).fileName(); } @@ -770,6 +770,18 @@ void S60DeviceDebugRunControl::initLauncher(const QString &executable, trk::Laun { // No setting an executable on the launcher causes it to deploy only m_startParams->executable = executable; + // Prefer the '*.sym' file over the '.exe', which should exist at the same + // location in debug builds + const QSharedPointer<S60DeviceRunConfiguration> rc = runConfiguration().objectCast<S60DeviceRunConfiguration>(); + const QString localExecutableFileName = rc->localExecutableFileName(); + const int lastDotPos = localExecutableFileName.lastIndexOf(QLatin1Char('.')); + if (lastDotPos != -1) { + m_startParams->symbolFileName = localExecutableFileName.mid(0, lastDotPos) + QLatin1String(".sym"); + if (!QFileInfo(m_startParams->symbolFileName).isFile()) { + m_startParams->symbolFileName.clear(); + emit addToOutputWindow(this, tr("Warning: Cannot locate the symbol file belonging to %1.").arg(localExecutableFileName)); + } + } } void S60DeviceDebugRunControl::handleLauncherFinished() diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h index c2da9c6240733dd4ae9d91b4b2da3e3d3e733fc1..c4c3d5496bb013e2a56f2a51e2d0b75bac307085 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h @@ -82,7 +82,7 @@ public: void setCustomKeyPath(const QString &path); QString packageFileName() const; - QString executableFileName() const; + QString localExecutableFileName() const; ProjectExplorer::ToolChain::ToolChainType toolChainType() const;