有没有办法自动避免进入 Visual Studio 中的某些功能?
我知道仅启用我的代码"调试选项,但这仅适用于托管代码.
我正在寻找一种无需单步执行即可进入函数调用的方法,例如,STL 字符串转换运算符,因为在函数的一个参数中存在从 char* 到字符串的隐式转换.
解决方案我发现了这个 博客条目 有解决方案.虽然我更愿意说不要介入任何不属于这个项目的事情",但这看起来可行.
查看了一些博客和新闻组后,方法是在此注册表项下为每个不想步入的函数添加一个条目(假设为 VS 2005):
<前>32 位 Windows\HKEY_LOCAL_MACHINESoftwareMicrosoftVisualStudio8.0NativeDEStepOver64 位 Windows\HKEY_LOCAL_MACHINESoftwareWow6432NodeMicrosoftVisualStudio8.0NativeDEStepOver路径的版本号:
<前>Visual Studio 2005:8.0Visual Studio 2008:9.0Visual Studio 2010:10.0Visual Studio 2012:11.0Visual Studio 2013:12.0该键包含一组影响步进执行方式的规则.每条规则都被指定为一个单独的条目,其名称是一个十进制数,其值是一个函数名称模式,用于指定我们想要影响哪些函数.例如
<前>"10" = "boost::scoped_ptr.*::.*=NoStepInto"防止进入 boost::scoped_ptr 函数.
规则从高值到低值进行评估,直到找到匹配的模式,或者没有剩下的规则.在这种情况下,函数被步进.
函数名是正则表达式.
冒号需要用反斜杠引用.
您可以指定 StepInto 和 NoStepInto.这为您提供了一种方法,可以避免进入同一作用域/命名空间中的除少数函数之外的所有函数.
重新启动 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.
解决方案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.
相关文章