[Development] [Windows] State of the Qt6 natvis file

Jörg Bornemann joerg.bornemann at qt.io
Fri Feb 28 12:26:26 CET 2025


On 2/21/25 4:40 PM, Nicolas Arnaud-Cormos via Development wrote:

> I think a better solution would be to have the natvis files embedded 
> into the pdb on Windows, for multiple reasons:
> - no need to set a natvis file on VSCode or VS for those not using the 
> extension,
> - in case of internal changes for the Qt classes, we could adapt the 
> file and ty it to a specific Qt version,
> - slightly more visible place for people to contribute.

Embedding into the DLLs doesn't cut it, unfortunately, as Kai already 
pointed out. But we could add CMake code that embeds the natvis files in 
the user's binaries (as Marcus already wrote).

Having the natvis files directly in Qt has only one disadvantage: we 
can't add the natvis files to already released Qt versions.

> Another solution, at least better than right now, would be to have a 
> repo for the natvis, that could be used by both the VsTools extension 
> and the VSCode extension.
> Not my best choice, but at least it will give a better visibility to it 
> and reduce the pain to contributions.

This was considered in the beginning of the VS Code Extension's 
development, and we even have the (unused) repo in place: 
https://code.qt.io/cgit/qt-labs/vs-debugtools.git/

We never continued with this, because we reconsidered and wanted to add 
the natvis files to the Qt repositories instead. Here's a deferred 
change that does this: 
https://codereview.qt-project.org/c/qt/qtbase/+/560899

At the end of the day, the change tried too much:
- natvis files are installed to lib (finally!)
- -qtnamespace is automatically replaced (no more search & replace!)
- the natvis files are split per module (maybe not needed?)
- an autotest was added (too ambitious?)

Esp. the last point was essentially the blocker. We're using cdb here to 
test the debugging visualizers, and - as it turns out - cdb uses yet 
another natvis dialect than what VS understands. We really wanted to 
have an autotest since we cannot change released Qt versions...

We can probably improve things already by ditching the testing attempt, 
but keep in mind that we're dealing with three different natvis dialects:
- full blown VS natvis
- reduced (or just old?) natvis of cdb
- severely reduced natvis subset of cppdbg for VS Code

The cdb one isn't that important, unless Qt Creator starts to use that.



Cheers,

Joerg
-- 
Jörg Bornemann | The Qt Company


More information about the Development mailing list