forked from qt-creator/qt-creator
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
This commit is contained in:
@@ -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:
|
|||||||
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,14 +390,17 @@ 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)) {
|
|
||||||
|
foreach (const JSAgentBreakpointData &bp, bps) {
|
||||||
|
if (bp.lineNumber == lineNumber) {
|
||||||
stopped();
|
stopped();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case NoState:
|
case NoState:
|
||||||
@@ -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;
|
||||||
|
Reference in New Issue
Block a user