如何在VS中高效地调试宏? [英] How to debug macros efficiently in VS?

查看:173
本文介绍了如何在VS中高效地调试宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的(非托管)C ++代码中有一个非常复杂的宏。有没有办法在VS调试器中扩展宏?或者也许有另一种方法来调试宏?



我想在其中放置一个断点。



(是的,我知道宏是坏的。)

解决方案

通过右键单击并转到属性,转到项目或源文件属性。在配置属性 - > C / C ++ - >预处理器下,将生成预处理文件设置为带或不带行号,无论您选择哪种。这将显示您的宏在上下文中的扩展。如果您需要在实时编译代码中进行调试,只需剪切并粘贴即可,并在调试时将其替换为宏。


I've got a pretty complicated macro inside my (unmanaged) C++ code. Is there any way to expand macros in VS debugger? Or maybe there is another way to debug macros there?

F.e. I'd like to place a breakpoint inside it.

(Yes, I know macros are bad.)

解决方案

Go to either project or source file properties by right-clicking and going to "Properties". Under Configuration Properties->C/C++->Preprocessor, set "Generate Preprocessed File" to either with or without line numbers, whichever you prefer. This will show what your macro expands to in context. If you need to debug it on live compiled code, just cut and paste that, and put it in place of your macro while debugging.

这篇关于如何在VS中高效地调试宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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