Commit 844c3451 authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlJSDebugger: Compare only file names for .js breakpoints

The file names on device might be completely different, therefore
we cannot compare the absolute path.

Reviewed-by: Christiaan Janssen
parent 2023efab
...@@ -44,9 +44,10 @@ ...@@ -44,9 +44,10 @@
#include <QtCore/qdatetime.h> #include <QtCore/qdatetime.h>
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#include <QtCore/qurl.h>
#include <QtCore/qcoreapplication.h> #include <QtCore/qcoreapplication.h>
#include <QtCore/qset.h> #include <QtCore/qset.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qurl.h>
#include <QtScript/qscriptcontextinfo.h> #include <QtScript/qscriptcontextinfo.h>
#include <QtScript/qscriptengine.h> #include <QtScript/qscriptengine.h>
#include <QtScript/qscriptvalueiterator.h> #include <QtScript/qscriptvalueiterator.h>
...@@ -144,6 +145,8 @@ public: ...@@ -144,6 +145,8 @@ public:
QEventLoop loop; QEventLoop loop;
QHash<qint64, QString> filenames; QHash<qint64, QString> filenames;
JSAgentBreakpoints breakpoints; JSAgentBreakpoints breakpoints;
// breakpoints by filename (without path)
QHash<QString, JSAgentBreakpointData> fileNameToBreakpoints;
QStringList watchExpressions; QStringList watchExpressions;
QSet<qint64> knownObjectIds; QSet<qint64> knownObjectIds;
}; };
...@@ -387,12 +390,15 @@ void JSDebuggerAgentPrivate::positionChange(qint64 scriptId, int lineNumber, int ...@@ -387,12 +390,15 @@ void JSDebuggerAgentPrivate::positionChange(qint64 scriptId, int lineNumber, int
QPair<QString, qint32> key = qMakePair(filename, lineNumber); QPair<QString, qint32> key = qMakePair(filename, lineNumber);
it = filenames.insert(scriptId, filename); it = filenames.insert(scriptId, filename);
} }
JSAgentBreakpointData bp;
bp.fileName = it->toUtf8(); const QString filePath = it->toUtf8();
bp.lineNumber = lineNumber; JSAgentBreakpoints bps = fileNameToBreakpoints.values(QFileInfo(filePath).fileName()).toSet();
if (breakpoints.contains(bp)) {
stopped(); foreach (const JSAgentBreakpointData &bp, bps) {
return; if (bp.lineNumber == lineNumber) {
stopped();
return;
}
} }
} }
...@@ -468,6 +474,12 @@ void JSDebuggerAgentPrivate::messageReceived(const QByteArray &message) ...@@ -468,6 +474,12 @@ void JSDebuggerAgentPrivate::messageReceived(const QByteArray &message)
ds >> command; ds >> command;
if (command == "BREAKPOINTS") { if (command == "BREAKPOINTS") {
ds >> breakpoints; ds >> breakpoints;
fileNameToBreakpoints.clear();
foreach (const JSAgentBreakpointData &bp, breakpoints) {
fileNameToBreakpoints.insert(QFileInfo(bp.fileName).fileName(), bp);
}
//qDebug() << "BREAKPOINTS"; //qDebug() << "BREAKPOINTS";
//foreach (const JSAgentBreakpointData &bp, breakpoints) //foreach (const JSAgentBreakpointData &bp, breakpoints)
// qDebug() << "BREAKPOINT: " << bp.fileName << bp.lineNumber; // qDebug() << "BREAKPOINT: " << bp.fileName << bp.lineNumber;
......
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