I'm having trouble with the natvis extension of visual studio 2015.
In my efforts I need to access a map, but the TreeItems
node of natvis does not seem to work for me. I'm actually using the sample code:
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="std::map<*>">
<DisplayString>{{size = {_Mysize}}}</DisplayString>
<Expand>
<Item Name="[size]">_Mysize</Item>
<Item Name="[comp]">comp</Item>
<TreeItems>
<Size>_Mysize</Size>
<HeadPointer>_Myhead->_Parent</HeadPointer>
<LeftPointer>_Left</LeftPointer>
<RightPointer>_Right</RightPointer>
<ValueNode Condition="!((bool)_Isnil)">_Myval</ValueNode>
</TreeItems>
</Expand>
</Type>
</AutoVisualizer>
But I get this error on a map<int,int>:
Error: Function std::_Tree_comp_alloc<std::_Tmap_traits<int,int,std::less<int>,std::allocator<std::pair<int const ,int> >,0> >::_Mysize has no address, possibly due to compiler optimizations.
Error while evaluating '_Mysize' in the context of type 'Program.exe!std::map<int,int,std::less<int>,std::allocator<std::pair<int const ,int> > >'.
I'm building in debug mode and I double checked, that optimizations are disabled (\Od)
Maybe the natvis definition for msvc2015 has changed, but I couldn't find anything. Maybe the sample code is not supposed to work, but I find it hard to get things started from a not working example.