One of the most common debugging procedures is stepping — executing code one unit (statement, line, or machine instruction) at a time. With the Visual Studio debugger, you can choose the step unit you want to use — a language statement, a source line, or an assembly instruction.
To change the step unit
The Debug menu provides three commands for stepping through code:
Step Into and Step Over differ in only one respect — the way they handle function calls. Either command instructs the debugger to execute the next unit of code. If the next unit contains a function call, Step Into executes only the call itself, then halts at the first unit of code inside the function. Step Over executes the entire function, then halts at the first unit outside the function. Use Step Into if you want to look inside the function call. Use Step Over if you want to avoid stepping into functions that have already been thoroughly debugging and are probably not the cause of your problem. (For example, Windows APIs.)
On a nested function call, Step Into steps into the most deeply nested function. If you use Step Into on a call like Func1(Func2),
the debugger steps into the function Func2
. If you want to step into another function within the nest, use Step Into Specific Function command from the shortcut menu.
Use Step Out when you are inside a function call and want to return to the calling function. Step Out resumes execution of your code until the function returns, then breaks at the return point in the calling function.
You cannot access the Step commands if your application is running. You must wait for the program to reach a breakpoint or choose Break from the Debug menu before you can begin stepping.
To step into a program that is not yet executing
To step while debugging
When you are stepping into a nested function call, you can use Stepping into a Specific Function, to choose which function you want to step into.