Setting Breakpoints on All Class Methods

In a recent video John Robbins (probably the world’s leading debugging expert) made a public request of his audience: write a VS addin that enables setting function breakpoints by partial name matches. That is, let the user type C*::M* in some input dialog, and breakpoints would be set at CMyWnd::Move() and in Cookie::Monster() alike.

Well Naveen did pick up the gauntlet and wrote a nice addin to do exactly that. It even goes as far as regular expressions.

Both the original challenge and the given addin relate to managed code only – and it occurred to me this may be the first example in recorded history of a debugging goodie that’s available to native devs before managed devs.   Windbg has had the bm command forever, and while VS does not get quite there  – a while ago Habib Heydarian posted about an undocumented-VS trick that goes a major part of the way:

In the breakpoints window (Ctrl+B) you can type ‘YoueClassName::*’ to simultaneously set breakpoints to all class methods. This was useful to me recently when trying to find the first entry point to a module, and surely it would yet come handy in many other scenarios. In response to my email question, Habib Heydarian confirmed that (a) it is indeed undocumented and as such unsupported – so YMMV, (b) there isn’t any non trivial wildcard pattern matching available yet.  In response to another email question I learnt from John Robbins that  he checked with the expression evaluator developers and they don’t support any form of wildcards for .NET code either. However, it’s on their list of features for Dev 11.  Thus, the brief (and utterly insignificant) favoring of native over managed devs is about to come to an end.

Advertisement
This entry was posted in Debugging, VC++, Visual Studio. Bookmark the permalink.

2 Responses to Setting Breakpoints on All Class Methods

  1. Kobi Kai says:

    Holy Zarkwan! been using that in gdb for years…

  2. Anonymous says:

    FYI, ClassName::* method does not work for templated member methods.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s