views:

986

answers:

4

I'm aware of the "Enable just my code" debug option, but that only works for managed code.

I'm looking for a way to step into a function call without having to step through, for example, an STL string cast operator because there is an implicit conversion from a char* to a string in one of the function's parameters.

+7  A: 

I found this blog entry which has a solution. Although I'd prefer to be able to say "don't step into anything that isn't part of this project", this looks workable.

EDIT: After looking at a few blogs and newsgroups, the method is to add an entry for each function that you don't want to step into under this registry key (assuming VS 2005):

    \\HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\8.0\NativeDE\StepOver

This key contains a set of rules which affect how stepping is performed. Each rule is specified as a separate entry whose name is a decimal number and whose value is a function name pattern that specifies which functions we want to affect. e.g.

    "10" = "boost\:\:scoped_ptr.*\:\:.*=NoStepInto"

prevents stepping into boost::scoped_ptr functions.

The rules are evaluated from high to low values until a matching pattern is found, or there are no rules left. In that case the function is stepped into.

Function names are regular expressions.

Colons need to be quoted with a backslash.

You can specify StepInto as well as NoStepInto. This gives you a way to avoid stepping into all but a few functions in the same scope/namespace.

Ferruccio
+3  A: 

My copy-past:

Avoiding Stepping Into Things

It's often useful to avoid stepping into some common code like constructors or overloaded operators. autoexp.dat provides this capability. Add a section called "[ExecutionControl]". Add keys where the key is the function name and the value is "NoStepInto". You can specify an asterisk (*) as a wildcard as the first set of colons for a namespace or class.

autoexp.dat is only read on Visual Studio's start up.

To ignore the function myfunctionname, and all calls to the class CFoo:

[ExecutionControl]

myfunctionname=NoStepInto

CFoo::*=NoStepInto

To ignore construction and assignment of MFC CStrings: (Notice the extra = in CString::operator=.)

[ExecutionControl]

CString::CString=NoStepInto

CString::operator==NoStepInto

To ignore all ATL calls:

[ExecutionControl]

ATL::*=NoStepInto

from this (http://www.highprogrammer.com/alan/windev/visualstudio.html) article.

Also you can use "Step Into Specific Function" from pupup menu.

Edit Sorry, it looks like that autoexp.dat doesn't works in vs 2003/2005. The same you can do with registry settings. http://groups.google.com/group/microsoft.public.vsnet.debugging/browse_thread/thread/b03dee5a626470c0/26addb1b539883e8

bb
It looks like the AUTOEXP.DAT file is supported only in Visual Studio 6. Newer versions use registry entries.
Ferruccio
Thank you. I've edited my post.
bb
+1  A: 

VS6 used to let you define values in the autoexp file that let you skip stepping into common functions (e.g. string constructors). Starting with VS7 these exclusions were moved to the registry. Ease of use takes a serious hit.

In VS7 and higher Microsoft, in their wisdom, moved these exclusions to the registry. Here are some examples:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\NativeDE\StepOver]
"10"="CString\\:\\:CString=NoStepInto"
"11"=".*\\.c_str.*=NoStepInto"

Key names represent the search order. Key values contain VS regular expressions to search for.

If you create your own exclusions, be sure to get the name out of the disassembly view. The declaration in source may not match the compiler generated name, especially for templated functions.

Aaron Saarela
+1  A: 

There is also the "step into specific" entry on the context menu, that will list the functions that could be stepped into on the current line, and you can pick the one you want.

Rob K
Thanks. I never noticed that.
Ferruccio