简体   繁体   English

Visual C ++(2008)调试快照

[英]Visual C++ (2008) debugging snapshot

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++. 目前,我正在用notepad ++键入所有内容。 So, is there anyway to capture a snapshot of a few lines of code which includes the variable values? 因此,是否有捕获几行代码(包含变量值)的快照的方法?

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. 如果可以容纳所需的所有信息,也可以将窗口的大小缩小,然后使用shift + printscreen制作更紧凑的快照。

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. 当您拥有快照集合时,只需使用查看器在快照中滚动即可,您应该拥有一个漂亮的快照-调试-步进-东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM