问题
I am developing some debug visualizations for my custom classes in VSCode using Natvis. Using CustomListItems with a simple example and I can't get it to work. Basically, I think the following code should display 16 items all with value 1 but I get only the basic type of the class..
<Type Name="vq23_t">
<DisplayString>16 x q23 Array</DisplayString>
<Expand>
<CustomListItems>
<Size>16</Size>
<Variable Name="ind" InitialValue="0" />
<Loop Condition="ind < 16">
<Item Name="{ind}"> 1 </Item>
<exec> ++ind </exec>
</Loop>
</CustomListItems>
</Expand>
</Type>
What I get:
pout: 16 x q23 Array
>[Raw View]: 0x56594b40 <xin>
Spent a lot of time trying various things out so I reduced the problem to this basic level and can't get it to work.
回答1:
As described on MSDN you can activate logging for debugging natvis.
The solution for your case is to change the order of Size
and Variable
and to change exec
to Exec
.
<Type Name="vq23_t">
<DisplayString>16 x q23 Array</DisplayString>
<Expand>
<CustomListItems>
<Variable Name="ind" InitialValue="0" />
<Size>16</Size>
<Loop Condition="ind < 16">
<Item Name="{ind}"> 1 </Item>
<Exec> ++ind </Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>
来源:https://stackoverflow.com/questions/65742034/using-customlistitems-in-vscode-natvis