diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2024-02-05 18:10:50 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-02-08 14:37:02 +0000 |
| commit | 28340bdeb034de8e43ab0eb4c3df9fb4b7c2f478 (patch) | |
| tree | 5ae684df84391c4c1874c1d09c47037bba7dee3a /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | fab3553165e9ee13c4853c7deeac9e456d048b3e (diff) | |
QmlCompiler: In debug mode, set instruction pointer before each lookup
This produces some overhead, but helps with debugging. Without the
instruction pointer we cannot determine the line numbers for
console.trace().
Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-119459
Change-Id: I75a6bb1fcedd8514e2ba46d02dd2904ce222f0e4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 208ca15444..b5c2a2dc03 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -67,6 +67,7 @@ private slots: void compositeSingleton(); void compositeTypeMethod(); void consoleObject(); + void consoleTrace(); void construct(); void contextParam(); void conversionDecrement(); @@ -1110,6 +1111,32 @@ void tst_QmlCppCodegen::consoleObject() QVERIFY(!p.isNull()); } +void tst_QmlCppCodegen::consoleTrace() +{ + QQmlEngine engine; + QQmlComponent component(&engine, QUrl(u"qrc:/qt/qml/TestTypes/consoleTrace.qml"_s)); + QVERIFY2(!component.isError(), component.errorString().toUtf8()); + +#if !defined(QT_NO_DEBUG) || defined(QT_TEST_FORCE_INTERPRETER) + // All line numbers in debug mode or when interpreting + + QTest::ignoreMessage(QtDebugMsg, R"(c (qrc:/qt/qml/TestTypes/consoleTrace.qml:6) +b (qrc:/qt/qml/TestTypes/consoleTrace.qml:5) +a (qrc:/qt/qml/TestTypes/consoleTrace.qml:4) +expression for onCompleted (qrc:/qt/qml/TestTypes/consoleTrace.qml:7))"); +#else + // Only top-most line number otherwise + + QTest::ignoreMessage(QtDebugMsg, R"(c (qrc:/qt/qml/TestTypes/consoleTrace.qml:6) +b (qrc:/qt/qml/TestTypes/consoleTrace.qml) +a (qrc:/qt/qml/TestTypes/consoleTrace.qml) +expression for onCompleted (qrc:/qt/qml/TestTypes/consoleTrace.qml))"); +#endif + + QScopedPointer<QObject> object(component.create()); + QVERIFY(!object.isNull()); +} + void tst_QmlCppCodegen::construct() { QQmlEngine engine; |
