summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/stackframe.cpp
diff options
context:
space:
mode:
authorhjk <hjk@theqtcompany.com>2015-10-14 13:26:22 +0200
committerChristian Stenger <christian.stenger@theqtcompany.com>2015-10-19 12:40:29 +0000
commitb8ae9fd46d2c02e2b4901abf140ac106e35bdf51 (patch)
treebe44a7952b8eef22b6f177721c05388245caf245 /src/plugins/debugger/stackframe.cpp
parentbe1e0f7ec00fd0e23abb49dfe989b48a816b538e (diff)
downloadqt-creator-b8ae9fd46d2c02e2b4901abf140ac106e35bdf51.tar.gz
Debugger: Adjust native mixed debugging after upstream changes
Change-Id: I4d137fadd0de2aa346f2f49932faac4ee9ed41e7 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com> Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Diffstat (limited to 'src/plugins/debugger/stackframe.cpp')
-rw-r--r--src/plugins/debugger/stackframe.cpp41
1 files changed, 27 insertions, 14 deletions
diff --git a/src/plugins/debugger/stackframe.cpp b/src/plugins/debugger/stackframe.cpp
index 11fa1a99e5..689437b52a 100644
--- a/src/plugins/debugger/stackframe.cpp
+++ b/src/plugins/debugger/stackframe.cpp
@@ -167,6 +167,21 @@ QString StackFrame::toToolTip() const
return res;
}
+static QString findFile(const QString &baseDir, const QString &relativeFile)
+{
+ QDir dir(baseDir);
+ while (true) {
+ const QString path = dir.absoluteFilePath(relativeFile);
+ const QFileInfo fi(path);
+ if (fi.isFile())
+ return path;
+ if (dir.isRoot())
+ break;
+ dir.cdUp();
+ }
+ return QString();
+}
+
// Try to resolve files coming from resource files.
void StackFrame::fixQrcFrame(const DebuggerRunParameters &rp)
{
@@ -179,21 +194,19 @@ void StackFrame::fixQrcFrame(const DebuggerRunParameters &rp)
}
if (!file.startsWith(QLatin1String("qrc:/")))
return;
- const QString relativeFile = file.right(file.size() - 5);
- if (rp.projectSourceDirectory.isEmpty())
- return;
- const QFileInfo pFi(rp.projectSourceDirectory + QLatin1Char('/') + relativeFile);
- if (pFi.isFile()) {
- file = pFi.absoluteFilePath();
- usable = true;
- return;
- }
- const QFileInfo cFi(QDir::currentPath() + QLatin1Char('/') + relativeFile);
- if (cFi.isFile()) {
- file = cFi.absoluteFilePath();
- usable = true;
+
+ QString relativeFile = file.right(file.size() - 5);
+ while (relativeFile.startsWith(QLatin1Char('/')))
+ relativeFile = relativeFile.mid(1);
+
+ QString absFile = findFile(rp.projectSourceDirectory, relativeFile);
+ if (absFile.isEmpty())
+ absFile = findFile(QDir::currentPath(), relativeFile);
+
+ if (absFile.isEmpty())
return;
- }
+ file = absFile;
+ usable = true;
}
QDebug operator<<(QDebug d, const StackFrame &f)