The Visual Studio debugger is amazingly useful. However, you soon learn to sigh the moment you come into contact with something like this:
boost::scoped_ptr<Startup> dlg( new Startup(settings->GetWindowPosition()));
You want to step into the
Startup constructor, but there is a lot of stuff in your way.
- First you will step into
shared_ptr::operator->(did I mention that
- Then you will step into
- Then into
- And then into your
- And finally you'll finish with the
scoped_ptrconstructor if you so choose.
If you've done this a lot you've probably gotten really good at the Step Out shortcut (Shift-F11).
Well, here are two alternatives!
First, while program execution is paused, right-click anywhere in the source window and look for the Step Into Specific item. You can select any of these functions to instantly step inside.
Alternatively, there is a special undocumented (and unsupported) registry key that you can use to specify functions that you always want to skip. Navigate to
HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\NativeDE\StepOver (users of a 64-bit variant of Windows will want to check
HKLM\SOFTWARE\Wow6432Node\Microsoft\... instead) and add some string values like this example:
Name: 50 (priority, higher values have greater priority)
The backslashes are necessary because
: (colon) is a special character in Visual Studio regex. You sometimes see two backslashes used in other examples, this is only necessary if you are directly editing a
.reg file (which I don't recommend). These rules will adjust the behaviour of the Step-Into command and make it skip anything from the
boost namespaces, as well as the basic
operator new. It will still step into an overloaded
operator new, so don't fear. There are more details on this blog post, as well as microsoft.public.vsnet.debugging.
One more thing: you can combine these two approaches. Say that you've added a skip for the entire
boost namespace, but you decide you really want to take a peek inside one particular line and see exactly what is happening to your parameters. Pause execution on that line, and then right-click and use Step Into Specific. This is still the same list as before and it works the same as before, regardless of any NoStepInto rules.