Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 889
Ferruccio Avatar asked Mar 09 '09 15:03

Ferruccio


People also ask

How do I skip a step while debugging in Visual Studio?

You can also click on the line you want to skip to and hit Ctrl+F10 (Run to Cursor). It will jump directly to that line.

How do I stop a process in Visual Studio?

If you're building, try hitting CTRL-Break.

How do I stop a Visual Studio Debug session?

To end a debugging session in Microsoft Visual Studio, from the Debug menu, choose Stop Debugging.

How do I disable just my code in Visual Studio?

To enable or disable Just My Code in Visual Studio, under Tools > Options (or Debug > Options) > Debugging > General, select or deselect Enable Just My Code.


1 Answers

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.

like image 99
Ferruccio Avatar answered Sep 21 '22 17:09

Ferruccio