From 5950aedf04bbce84d6f718cf0c45e0b33f68b250 Mon Sep 17 00:00:00 2001 From: ck <qt-info@nokia.com> Date: Mon, 9 Aug 2010 15:27:21 +0200 Subject: [PATCH] Debugger/GDB: Map remote to local source file names. Necessary for debugging with a remote gdb (as opposed to gdbserver). Reviewed-by: kh1 --- src/plugins/debugger/debuggerengine.h | 2 ++ src/plugins/debugger/gdb/gdbengine.cpp | 15 ++++++++++----- src/plugins/debugger/gdb/gdbengine.h | 4 ---- .../qt-maemo/maemodebugsupport.cpp | 9 +++++---- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index e620fae251e..fa3d7ffa2a7 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -84,6 +84,8 @@ public: QString sysRoot; QByteArray remoteDumperLib; QByteArray remoteSourcesDir; + QString remoteMountPoint; + QString localMountDir; Core::SshConnectionParameters connParams; QString debuggerCommand; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 0f08f312ccf..a5b9da7f82e 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -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() { diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index f75ccf3a10b..3cf89306b2c 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -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; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp index 4a759e4d544..4420bb635c1 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp @@ -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(); -- GitLab