From 06afc4f85cf9cdeaf27324c0e761fea2f59a4e80 Mon Sep 17 00:00:00 2001 From: Olivier Goffart <olivier.goffart@nokia.com> Date: Tue, 27 Jul 2010 18:19:11 +0200 Subject: [PATCH] Qml JS Debugger: If the exact line number is not known, fallback to the function line number --- src/tools/qml/qmlobserver/jsdebuggeragent.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/qml/qmlobserver/jsdebuggeragent.cpp b/src/tools/qml/qmlobserver/jsdebuggeragent.cpp index 8681624a057..0eb01c21b1b 100644 --- a/src/tools/qml/qmlobserver/jsdebuggeragent.cpp +++ b/src/tools/qml/qmlobserver/jsdebuggeragent.cpp @@ -455,7 +455,10 @@ void JSDebuggerAgent::stopped(bool becauseOfException, const QScriptValue& excep functionName = QLatin1String("<global>"); } } - backtrace.append(qMakePair(functionName, qMakePair( QUrl(info.fileName()).toLocalFile(), info.lineNumber() ) ) ); + int lineNumber = info.lineNumber(); + if (lineNumber == -1) // if the line number is unknown, fallback to the function line number + lineNumber = info.functionStartLineNumber(); + backtrace.append(qMakePair(functionName, qMakePair( QUrl(info.fileName()).toLocalFile(), lineNumber ) ) ); } QList<JSAgentWatchData> watches; foreach (const QString &expr, watchExpressions) -- GitLab