Visual Studio 2013 C++:STL 容器的元素显示在调试器中 [英] Visual Studio 2013 C++: STL container's elements display in debugger

查看:28
本文介绍了Visual Studio 2013 C++:STL 容器的元素显示在调试器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C++ 调试期间的 MSVS 2013(自动和监视窗口)仅显示 STL 容器的大小:

MSVS 2013 during C++ debugging (Autos and Watch windows) shows only size of STL container's:

MSVS 2010: "[9](9,8,7,6,5,4,3,2,1)"
MSVS 2013: "{ size=9 }"

在 MSVS 2013 中查看元素的值需要行展开.
有没有办法让 MSVS 2013 在调试器中显示像 MSVS 2010 这样的 STL 容器?
我试图删除 stl.natvis(它在 2013 年使用过),但没有帮助:autoexp.dat 仍未使用.
是否可以强制 MSVS 2013 使用 autoexp.dat?
是否可以修改 stl.natvis 脚本(根据容器元素的值构造 DisplayString)?
还有什么办法吗?

Line expand is required to see element's value in MSVS 2013.
Is there any way to make MSVS 2013 show STL containers like MSVS 2010 in debugger?
I tried to remove stl.natvis (it is used in 2013), but it doesn't help: autoexp.dat is still not used.
Is possible to force MSVS 2013 use autoexp.dat?
Is it possible to modify stl.natvis scripts (construct DisplayString from container element's values)?
Any other way?

推荐答案

我找到了一种强制 MSVS 2012/2013 使用 autoexp.dat 的方法:设置启用编辑并继续"和启用本机编辑并继续".
它禁用 C++ 的数据查看增强"(natvis)和 std::vector 的元素(std::list、std::map、...) 显示在变量的主线上(MSVS 2010 样式).
但是,仍然很有趣,是否可以修改 stl.natvis 以获得相同的显示结果?

I found one way to force MSVS 2012/2013 use autoexp.dat: set "Enable Edit And Continue" and "Enable Native Edit and Continue".
It disables "data viewing enhancements" (natvis) for C++, and elements of std::vector (std::list, std::map, ...) become displayed on the main line of the variable (MSVS 2010 style).
But, it still would be interesting, is it possible to modify stl.natvis to get the same display result?

这篇关于Visual Studio 2013 C++:STL 容器的元素显示在调试器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆