Is there a way to automatically avoiding stepping

2019-01-07 14:41发布

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.

5条回答
干净又极端
2楼-- · 2019-01-07 15:00

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.

查看更多
Juvenile、少年°
3楼-- · 2019-01-07 15:04

From Visual Studio 2012, take a look at the following file:

C:\Program Files[ (x86)]\Microsoft Visual Studio 11.0\Common7\Packages\Debugger\Visualizers\default.natstepfilter

查看更多
forever°为你锁心
4楼-- · 2019-01-07 15:14

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

查看更多
【Aperson】
5楼-- · 2019-01-07 15:19

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.

查看更多
女痞
6楼-- · 2019-01-07 15:25

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):

32 bit Windows
    \\HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\8.0\NativeDE\StepOver
64 bit Windows
    \\HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\VisualStudio\8.0\NativeDE\StepOver

Version numbers for the path:

Visual Studio 2005: 8.0
Visual Studio 2008: 9.0
Visual Studio 2010: 10.0
Visual Studio 2012: 11.0
Visual Studio 2013: 12.0

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.

Restart Visual Studio to pick up the changes to the registry.

查看更多
登录 后发表回答