There are a number of C++ libraries that make use of templates. STL, Boost, MFC and ATL are some of the well known libraries that make use of templates. One of the downsides of using these libraries is that they can make debugging tedious. Specifically, when stepping through code, you often end up stepping into these templates. However, most often, you don’t care about stepping into these libraries. To avoid stepping into any templates in the Visual Studio debugger, you can add a rule to the StepOver registry by following these steps:

  1. Open the Registry Editor (regedit.exe)
  2. Navigate to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\NativeDE\StepOver registry key
  3. Under the StepOver registry key, create a new String value (REG_SZ) with the following information
Name:            8-OMINO: C++ class and function templates
Data:            \anything:[\<\>]\anything:=NoStepInto

Once you’ve added this rule, it will take effect the next time you start debugging. You can re-enable stepping into templates by either deleting this rule from the registry or changing the data value from NoStepInto to StepInto.

Note: If you are running Visual Studio on a 64-bit version of Windows, the registry key in the above example is in a slightly different location. Since Visual Studio runs as a 32-bit process, the registry key is under the WOW64 hive, that is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\NativeDE\StepOver.