Qt VS Code Extensions Manual Tests Debugger

From Qt Wiki
Revision as of 08:40, 8 April 2025 by Lucie (talk | contribs)
Jump to navigation Jump to search


This is about catching the Qt types not properly understood by the debugger.

Found problems are to be reported in https://bugreports.qt.io/browse/VSCODEEXT-154?filter=27222

Auto test is meant to replace the manual testing


Pre-requisit Result Annotation
Have VS code installed (https://code.visualstudio.com/docs/setup/setup-overview)
Have a Qt installation (https://account.qt.io/s/downloads)
Have the Qt C++ Extension Pack installed, a Qt installation registered

The natvis files and the related test files are located in the qt-labs/vs-debugtools repo. This is the debugging_helpers vscodeext submodule.

To use the latest vs-debugtools, use a local vscodeext. To set up everything, run:

npm ci
git submodule update --init --remote --recursive
npm run prepareNatvisFiles
npm run all_dev

To access the test files, open debugging_helper and make sure .vscode/setting.json has:

"cmake.useCMakePresets": "never"

since CMakePresets are not supported and block Qt kit visibility (ongoing).

Select a Qt kit.

In test-app/main.cpp, place a break point at the return call.

Check that the debugger output is as expected.

This is a work in progress, need to use the latest natvis files from https://github.com/narnaud/natvis4qt (to be moved to qt-labs/vs-debugtools QTVSADDINBUG-1310)


Qt6 Tested type Variable Name Expectation Result
Core Types
QByteArray qByteArray
QChar qChar
QDate qDate
QDate with currentDateTime() qDateTimeLocal
QDate with currentDateTimeUtc() qDateTimeUtc
QDate with currentDateTimeUtc() Asia qDateTimeBrunei
QDate with currentDateTimeUtc() South Pole qDateTimeSouthPole
QDate with currentDateTimeUtc() Canada qDateTimeYukon
QDate with currentDateTimeUtc() Pacific qDateTimeMarquesas
QDate with currentDateTimeUtc() Troll qDateTimeShouldFail
QDate with currentDateTimeUtc() qDateTimeSecOffset
QDate default qDateTimeDefault
QDir qDir
QFile qFile
QFileInfo qFileInfo
enum SelectionFlags qFlags
QJsonDocument qJsonDocument
QLine qLine
QPoint qPoint
QPointF qPointF
QRect qRect
QRectF qRectF
QSize qSize
QSizeF qSizeF
QString qString
QStringView qStringView
QTime qTime VSCODEEXT-160
QUrl qUrl VSCODEEXT-159
QUuid VSCODEEXT-161
Container Types
QByteArrayList qByteArrayList
QHash qHash
QMap qMap
QMultiHash qMultiHash
QSet qSet
QVarLengthArray qVarLengthArray
std::map<int, QString> stdMap
std::unordered_map<int, QString> stdUnorderedMap
std::unordered_multimap<int, QString> stdUnorderedMultimap
std::unordered_set<std::string> stdSet
QBasicAtomicInteger Problem or adapt expectation Type is QAtomicOps<int> instead of QBasicAtomicInteger<int>

In Raw View value type is <int> instead of std::atomic<int>

QBasicAtomicPointer Adapt expectation? Raw View type is QBasicAtomicPointer<void>::AtomicType instead of QBasicAtomicPointer<void>
QChar QChar_Latin1 Adapt expectations. Problem? Raw View is not as expected. No latin 1 nor unicode, only ucs. The type and value of ucs are as expected. Need to check those of latin 1 and unicode though.
QChar QChar_non_Latin1 Adapt expectations. See QChar_Latin1, values are not as expected
QPair<int, int> type show is QPair<int, int> instead of expected std::pair<int,int>