Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
242 views
in Technique[技术] by (71.8m points)

c++ - Is there a way to automatically avoiding stepping into certain functions in Visual Studio?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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_MACHINESoftwareMicrosoftVisualStudio8.0NativeDEStepOver
64 bit Windows
    \HKEY_LOCAL_MACHINESoftwareWow6432NodeMicrosoftVisualStudio8.0NativeDEStepOver

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...