you can add custom view for debugger.
https://www.cppstories.com/2021/natvis-tutorial/
https://devblogs.microsoft.com/cppblog/debug-visualizers-in-visual-c-2015/
create into your root folder xxx.natvis
make sure in the launch.json to add
"visualizerFile": "${workspaceFolder}/xxx.natvis",
"showDisplayString": true,
more sample:
https://learn.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects?view=vs-2019
note:
the Name of the class must be full qualified e.g. contain namespace name if exist.
even typedef name should be act as new Name in the natvis file.
ty
enjoy
Yaniv
sample template class:
template<typename T> class MyObject
{
public:
MyObject() : myVal( 5 ) {}
T myVal;
};
sample template natvis file:
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="MyObject<*>">
<DisplayString>{{myVal = {myVal}}}</DisplayString>
<Expand>
<Item Name="[myVal]">myVal</Item>
</Expand>
</Type>
</AutoVisualizer>
No comments:
Post a Comment