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