Saturday, September 25, 2010

Faster debug start time in Visual C++ 2010 by skipping symbol loading

When you start debugging in Visual Studio, Visual Studio will try to load debug symbols for your executable file and DLLs it uses. The symbol loading time is insignificant if your program uses only a couple of DLLs.
What if you have a handful of DLLs or just being paranoid? Here's how to stop loading the DLL symbols and, except of course, your executable file:
  1. In Visual Studio 2010, go to Tools->Options->Debugging->Symbols
  2. Click "Only specified modules"

  3. Click "Specify modules"
  4. Clear "Always load symbols located next to modules"
  5. Click the new icon
  6. Enter your executable filename. If you don't specify your program here, breakpoints will not be hit.


The idea is, most of the time, you want to debug only your executable, leaving those DLLs behind. In case you want to dig into those DLLs, just change the option to "All modules, unless excluded", or whichever way you want.
Note that these symbol options has global effect. Be careful if you work on several projects at one time. You may need to change those options back and forth.