Visualize C++ types
The Visual Studio Natvis framework customizes the way native types appear in debugger variable windows, such as the Locals and Watch windows, and in DataTips. You can add visualization rules to .natvis
files. By default, the user-specific files are in %USERPROFILE%\Documents\Visual Studio 2022\Visualizers
.
You can embed debugger visualizations into the program database (PDB) file generated by LINK
. It contains type and symbolic debugging information collected when compiling and linking the project.
Embedding Natvis files into PDB files has the following benefits:
- Portability - The visualization logic travels with the binary, ensuring that anyone using the binary (such as other developers, testers, or users) benefits from the custom debug visualizations without needing to manually copy the .natvis file to a specific directory.
- Version consistency - The visualizer is guaranteed to match the version of the binary, as they are packaged together. If the binary changes, the visualizer reflects the correct internal structures or changes, avoiding mismatches.
- Ease of distribution - When distributing the binary (for example, for internal builds or external releases), the embedded Natvis file is automatically included, so you don't need to distribute a separate one and install it on each computer.
- Security - A Natvis file that is a part of the binary is more secure and controlled, as users cannot modify it.
Embed Natvis files in PDB files
To embed Natvis files into PDB files:
- Go to Extensions > Qt VS Tools > Options > Qt > General > Natvis.
- Set Embed .natvis file into PDB to Enable.
The embedded Natvis file takes precedence over user-specific Natvis files.
See also Debug applications.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.