diff --git a/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp b/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp index 770f5313484154949c9521bad2fa55342b4e4ccb..87c917ca869e1e599d497b883d4ae7bf6a48b12c 100644 --- a/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp +++ b/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp @@ -370,27 +370,28 @@ void JSDebuggerAgentPrivate::positionChange(qint64 scriptId, int lineNumber, int // check breakpoints if (!breakpoints.isEmpty()) { - QHash<qint64, QString>::const_iterator it = filenames.constFind(scriptId); QScriptContext *ctx = engine()->currentContext(); QScriptContextInfo info(ctx); - if (it == filenames.constEnd()) { - // It is possible that the scripts are loaded before the agent is attached - QString filename = info.fileName(); - JSAgentStackData frame; - frame.functionName = info.functionName().toUtf8(); + if (info.functionType() == QScriptContextInfo::ScriptFunction) { + QHash<qint64, QString>::const_iterator it = filenames.constFind(scriptId); + if (it == filenames.constEnd()) { + // It is possible that the scripts are loaded before the agent is attached + QString filename = info.fileName(); - QPair<QString, qint32> key = qMakePair(filename, lineNumber); - it = filenames.insert(scriptId, filename); - } + JSAgentStackData frame; + frame.functionName = info.functionName().toUtf8(); + it = filenames.insert(scriptId, filename); + } - const QString filePath = it->toUtf8(); - JSAgentBreakpoints bps = fileNameToBreakpoints.values(fileName(filePath)).toSet(); + const QString filePath = it->toUtf8(); + JSAgentBreakpoints bps = fileNameToBreakpoints.values(fileName(filePath)).toSet(); - foreach (const JSAgentBreakpointData &bp, bps) { - if (bp.lineNumber == lineNumber) { - stopped(); - return; + foreach (const JSAgentBreakpointData &bp, bps) { + if (bp.lineNumber == lineNumber) { + stopped(); + return; + } } } }