Is it possible to set breakpoints automatically (e

2019-07-20 21:55发布

问题:

I would like to set breakpoints only at some kind of wrong behaviour hints (e.g. ERROR-trace macros, etc.) for being able to find possible errors early during development. So, I wonder if it is possible to set BPs at places in code found by regex? May-be using some scripting or automation features of VS.

Thank you for any hint!

回答1:

You can place a breakpoint on all overloaded versions of a method in Visual Studio using this trick : write the name of the method in the search box (main toolbar) and hit F9.

If you want more power, you can use WinDbg. The command bm (Set Symbol Breakpoint) allows pattern-matching expressions like this (see here for details):

0:000> bm myprogram!mem* 
   4: 0040d070 MyProgram!memcpy
   5: 0040c560 MyProgram!memmove
   6: 00408960 MyProgram!memset