From 76b2f9f28ec045752fcd694e36679c48dcaf9be2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Date: Wed, 28 Oct 2009 11:59:57 +0100 Subject: [PATCH] make sure that symgdb 6.4 "fullnames" are fully normalized --- src/plugins/debugger/gdb/gdbengine.cpp | 57 +++++++++++++------------- src/plugins/debugger/gdb/gdbengine.h | 5 +++ 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index f82fb55133f..0ea644ca010 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -891,14 +891,9 @@ void GdbEngine::handleQuerySources(const GdbResponse &response) QString fileName = QString::fromLocal8Bit(item.findChild("file").data()); GdbMi fullName = item.findChild("fullname"); if (fullName.isValid()) { - QString full = QString::fromLocal8Bit(fullName.data()); - if (QFileInfo(full).isReadable()) { - #ifdef Q_OS_WIN - full = QDir::cleanPath(full); - #endif - m_shortToFullName[fileName] = full; - m_fullToShortName[full] = fileName; - } + QString full = cleanupFullName(QString::fromLocal8Bit(fullName.data())); + m_shortToFullName[fileName] = full; + m_fullToShortName[full] = fileName; } } if (m_shortToFullName != oldShortToFull) @@ -1307,23 +1302,26 @@ QString GdbEngine::fullName(const QString &fileName) return QString(); QTC_ASSERT(!m_sourcesListOutdated, /* */) QTC_ASSERT(!m_sourcesListUpdating, /* */) - QString full = m_shortToFullName.value(fileName, QString()); - //debugMessage(_("RESOLVING: ") + fileName + " " + full); - if (!full.isEmpty()) - return full; - QFileInfo fi(fileName); - if (!fi.isReadable()) - return QString(); - full = fi.absoluteFilePath(); - #ifdef Q_OS_WIN - full = QDir::cleanPath(full); - #endif - //debugMessage(_("STORING: ") + fileName + " " + full); - m_shortToFullName[fileName] = full; - m_fullToShortName[full] = fileName; - return full; + return m_shortToFullName.value(fileName, QString()); } +#ifdef Q_OS_WIN +QString GdbEngine::cleanupFullName(const QString &fileName) +{ + QTC_ASSERT(!fileName.isEmpty(), return QString()) + if (m_gdbVersion < 60800) { + // The symbian gdb 6.4 seems to deliver "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()); + } else { + return fileName; + } +} +#endif + void GdbEngine::shutdown() { debugMessage(_("INITIATE GDBENGINE SHUTDOWN")); @@ -1724,10 +1722,7 @@ void GdbEngine::breakpointDataFromOutput(BreakpointData *data, const GdbMi &bkpt QString name; if (!fullName.isEmpty()) { - name = QFile::decodeName(fullName); - #ifdef Q_OS_WIN - name = QDir::cleanPath(name); - #endif + name = cleanupFullName(QFile::decodeName(fullName)); if (data->markerFileName.isEmpty()) data->markerFileName = name; } else { @@ -1930,7 +1925,11 @@ void GdbEngine::extractDataFromInfoBreak(const QString &output, BreakpointData * QString full = fullName(re.cap(3)); if (full.isEmpty()) { qDebug() << "NO FULL NAME KNOWN FOR" << re.cap(3); - full = re.cap(3); // FIXME: wrong, but prevents recursion + full = cleanupFullName(re.cap(3)); + if (full.isEmpty()) { + qDebug() << "FILE IS NOT RESOLVABLE" << re.cap(3); + full = re.cap(3); // FIXME: wrong, but prevents recursion + } } data->markerLineNumber = data->bpLineNumber.toInt(); data->markerFileName = full; @@ -2237,7 +2236,7 @@ StackFrame GdbEngine::parseStackFrame(const GdbMi &frameMi, int level) frame.level = level; // We might want to fall back to "file" once we have a mapping which // is more complete than gdb's own ... - frame.file = QFile::decodeName(frameMi.findChild("fullname").data()); + frame.file = cleanupFullName(QFile::decodeName(frameMi.findChild("fullname").data())); frame.function = _(frameMi.findChild("func").data()); frame.from = _(frameMi.findChild("from").data()); frame.line = frameMi.findChild("line").data().toInt(); diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 6fac193e79a..d035468098d 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -356,6 +356,11 @@ 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; -- GitLab