Commit 5950aedf authored by ck's avatar ck

Debugger/GDB: Map remote to local source file names.

Necessary for debugging with a remote gdb (as opposed to gdbserver).

Reviewed-by: kh1
parent 729142b0
......@@ -84,6 +84,8 @@ public:
QString sysRoot;
QByteArray remoteDumperLib;
QByteArray remoteSourcesDir;
QString remoteMountPoint;
QString localMountDir;
Core::SshConnectionParameters connParams;
QString debuggerCommand;
......
......@@ -1587,18 +1587,23 @@ QString GdbEngine::fullName(const QString &fileName)
return m_shortToFullName.value(fileName, QString());
}
#ifdef Q_OS_WIN
QString GdbEngine::cleanupFullName(const QString &fileName)
{
QString cleanFilePath = fileName;
#ifdef Q_OS_WIN
QTC_ASSERT(!fileName.isEmpty(), return QString())
// Gdb on windows often delivers "fullnames" which
// a) have no drive letter and b) are not normalized.
QFileInfo fi(fileName);
if (!fi.isReadable())
return QString();
return QDir::cleanPath(fi.absoluteFilePath());
}
if (fi.isReadable())
cleanFilePath = QDir::cleanPath(fi.absoluteFilePath());
#endif
if (startMode() == StartRemoteGdb) {
cleanFilePath.replace(0, startParameters().remoteMountPoint.length(),
startParameters().localMountDir);
}
return cleanFilePath;
}
void GdbEngine::shutdownInferior()
{
......
......@@ -411,11 +411,7 @@ private: ////////// View & Data Stuff //////////
void handleQuerySources(const GdbResponse &response);
QString fullName(const QString &fileName);
#ifdef Q_OS_WIN
QString cleanupFullName(const QString &fileName);
#else
QString cleanupFullName(const QString &fileName) { return fileName; }
#endif
// awful hack to keep track of used files
QMap<QString, QString> m_shortToFullName;
......
......@@ -70,13 +70,14 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
= MaemoGlobal::remoteCommandPrefix(runConfig->remoteExecutableFilePath())
+ QLatin1String(" /usr/bin/gdb");
params.connParams = devConf.server;
params.localMountDir = runConfig->localDirToMountForRemoteGdb();
params.remoteMountPoint = MaemoGlobal::remoteProjectSourcesMountPoint();
const QString execDirAbs
= QDir::fromNativeSeparators(QFileInfo(runConfig->localExecutableFilePath()).path());
const QString execDirRel
= QDir(runConfig->localDirToMountForRemoteGdb()).relativeFilePath(execDirAbs);
params.remoteSourcesDir
= QString(MaemoGlobal::remoteProjectSourcesMountPoint()
+ QLatin1Char('/') + execDirRel).toUtf8();
= QDir(params.localMountDir).relativeFilePath(execDirAbs);
params.remoteSourcesDir = QString(params.remoteMountPoint
+ QLatin1Char('/') + execDirRel).toUtf8();
} else {
params.startMode = AttachToRemote;
params.executable = runConfig->localExecutableFilePath();
......
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