如何查看发布版本中的变量值
我希望能够在调试发布应用程序时看到变量值。 我已将编译器选项设置为 Z7 并给出了 /DEBUG 和 /PDB: 链接器选项。现在我有一个应用程序的 pdb。
通过此设置,我可以在代码中放置一个断点 (Windbg),并且它可以正确命中。但我看不到变量值。
本地窗口仅显示指针值,但我看不到其内容。例如,如果我有一个指向内部有 int 的结构的指针,它只显示指针的值。如果我通过单击树中的 + 来展开相同的内容,我会看到变量名称,其值为
我应该如何使发布版本显示变量值?
I want to be able to see the variable values while debugging a release application.
I have set the compiler option as Z7 and given a /DEBUG and /PDB: linker option. Now I have a pdb for the application.
With this set up I am able to put a break point (Windbg) inside the code and it hits properly. But I am not able to see the variable values.
The Locals window only shows the pointer value but I cant see the contents of the same. For instance if I have a pointer to a structure that has an int inside it, it just shows the value of the pointer. If I expand the same by clicking + in the tree, I see the variable name with the value as <Memory access error>
How should I make the release builds show the variable values?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很多时候,你看不到它们,因为它们不存在。如果您查看优化后的汇编代码,您会发现许多中间变量被完全删除,以提高性能。这很可能就是您所看到的,唯一的解决方法是遵循反汇编并观察正确的内存位置/寄存器。
Many times, you cannot see them because they don't exist. If you look at the optimized assembly code, you will find that many intermediate variables are completely removed in favor of performance. That is most likely what you're seeing, and the only way around it is to follow the disassembly and watch the right memory locations / registers.