开发者

Is there a Visual Studio macro to set a breakpoint on the start of every method in a class?

Is there a Visual Studio macro (either for ve开发者_开发知识库rsion 2008 or 2010) to set a breakpoint on the start of every method in a class?

I've seen hints of references, but I've not been able to dig an actual one out.


A Visual Studio extension named OzCode does have a feature to set/unset breakpoints on all members of a class. I use this extension a lot, as it has some very nice debugging enhancements.

Admittedly though, I haven't used the set/unset breakpoint feature much, but it's an option for you.


There are some good ideas here: How to put breakpoint in every function of .cpp file?


Wouldn't you be better off just single-stepping through your source code?

I can't imagine why a breakpoint at the start of every method would be any better than single-stepping. You're going to end up breaking everywhere anyway, and single-stepping provides the additional advantage of showing you the logical flow of your code paths.

You'll probably definitely want to learn the keyboard shortcut keys, but they can depend on how you have your VS environment set up. Look in your "Debug" menu for the "Step Over" and "Step Into" items. (Normally, Step Over is F10 and Step Into is F11.) The only difference is that, if the currently highlighted line contains a function call, Step Into will allow you to single-step through the code in the called function (this is probably most like what you want to do), while Step Over will simply call the function and stop on the next line in the current function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜