- Step into will cause the debugger to descend into any method calls on the current line. If there are multiple method calls, they'll be visited in order of execution; if there are no method calls, this is same as step over. This is broadly equivalent to following every individual line of execution as would be seen by the interpreter.
- Step over proceeds to the next line in your current scope (i.e. it goes to the next line), without descending into any method calls on the way. This is generally used for following the logic through a particular method without worrying about the details of its collaborators, and can be useful for finding at what point in a method the expected conditions are violated.
- Step out proceeds until the next "return" or equivalent - i.e. until control has returned to the preceding stack frame. This is generally used when you've seen all you need to at this point/method, and want to bubble up the stack a few layers to where the value is actually used.
Imagine the following code, which entered through main()
and is now on the first line of bar
:
function main() {
val s = foo();
bar(s);
}
function foo() {
return "hi";
}
function bar(s) {
val t = s + foo(); // Debugger is currently here
return t;
}
Then:
- Step into will proceed into the
foo
call, and the current line will then become the return "hi";
line within foo
.
- Step over will ignore the fact that another method is being invoked, and will proceed to the
return t;
line (which lets you quickly see what t
is evaluated as).
- Step out will finish the execution of the rest of the
bar
method, and control will return to the last line of the main
method.