natvis
vs studio的natvis存放在
%VSINSTALLDIR%Common7PackagesDebuggerVisualizers
vscode指定natvis
launch.json中指定,“visualizerFile”: “”
microsoft官方示例native-debugger-objects-in-natvis:
代码语言:javascript复制class CDog
{
public:
CDog(){m_age = 8; m_weight = 30;}
long m_age;
long m_weight;
};
int main()
{
CDog MyDog;
printf_s("%d, %dn", MyDog.m_age, MyDog.m_weight);
return 0;
}
针对dog类定义dog.natvis文件,内容如下
代码语言:javascript复制<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="https://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="CDog">
<DisplayString>{{Age = {m_age} years. Weight = {m_weight} pounds.}}</DisplayString>
</Type>
</AutoVisualizer>
开发natvis工具https://github.com/microsoft/ConcordExtensibilitySamples.git
linux上使用vscode可以全局搜索stl.natvis,使用visualizerFile配置指定文件
[Visualized View]:Explicit refresh required for visualized expressions
launch.json文件中需要添加"showDisplayString":true,解析错误提示 { size=-var-create: unable to create variable object }