Commit c3bb0327 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Trk/S60: Wire debugger parameters.

Remove conditionals from toolchain enumeration, pass parameters to
TrkGdbAdapter, rename function in runconfig, derive symbol
file from local exe file.
parent 86e21bc2
......@@ -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:
......
......@@ -110,6 +110,7 @@ public:
// for remote debugging
QString remoteChannel;
QString remoteArchitecture;
QString symbolFileName;
QString serverStartScript;
int toolChainType;
......
......@@ -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();
......
......@@ -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);
......
......@@ -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 &parameters = 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));
}
......
......@@ -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;
......
......@@ -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
}
......@@ -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
......
......@@ -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()
......
......@@ -82,7 +82,7 @@ public:
void setCustomKeyPath(const QString &path);
QString packageFileName() const;
QString executableFileName() const;
QString localExecutableFileName() const;
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment