Visual C++ (2008) 调试快照
有时我需要跟踪我感兴趣的对象上变量值发生变化的几行代码。当对象发生变化时,我需要比较变量以查看发生了什么,以及它是否与预期值不同。这类似于监视窗口,但可以保存并显示代码。在监视窗口中,您可以按最后添加的顺序排列一堆变量名称(不能轻易更改!?),没有代码来显示它们的来源。
目前,我正在记事本++中输入所有内容。 那么,是否有办法捕获包含变量值的几行代码的快照?
Sometimes I need to keep track of several lines of code where variable values change on the object I am interested in. When the object changes, I need to compare the variables to see what is happening, and whether it is different than expected values. This is similar to a watch window, but one that can be saved and shows the code along with it. In the watch window, you can have a bunch of variable names in order of last added (which can't be changed easily!?) with no code to show where they came from.
Currently, I am typing everything in notepad++. So, is there anyway to capture a snapshot of a few lines of code which includes the variable values?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当变量发生变化时,截取桌面的屏幕截图。您将获得代码(您可以选择确切的代码以进一步增强)和变量作为可视快照。如您所知,刚刚更改的变量也将用红色表示。
如果您可以容纳所需的所有信息,您还可以将窗口调整得更小,然后使用 Shift+PrintScreen 来制作更紧凑的快照。
当您拥有快照集合时,只需使用查看器滚动它们,您就应该拥有一个非常整洁的快照调试步进工具。
Make a screenshot of your desktop when variables change. You'll have the code (you can select the exact code to further enhance), and the variables as a visual snapshot. The variables that just changed will also as you know be indicated with red color.
You can also resize the window smaller if you can fit all info you need, and then use shift+printscreen to make more compact snapshots.
When you have your collection of snapshots just scroll through them with a viewer and you should have a pretty neat snapshot-debug-stepping-thingy.