help while I was in the GDB but didn't find anything about step-into, step-over and step-out. I put a breakpoint in an Assembly program in
break _start). Afterwards I typed
next and it finished the debugging. I guess it was because it finished
_start and didn't step-into as I wanted.
help running provides some hints:
next instuctions (and also
(gdb) help next
Step program, proceeding through subroutine calls.
Usage: next [N]
Unlike "step", if the current source line calls a subroutine,
this command does not enter the subroutine, but instead steps over
the call, in effect treating it as a single source line.
So we can see that
step steps into subroutines, but
next will step over subroutines.
stepi (and the
nexti) are distinguishing by "line" or "instruction" increments.
step -- Step program until it reaches a different source line
stepi -- Step one instruction exactly
(gdb) help finish
Execute until selected stack frame returns.
Upon return, the value returned is printed and put in the value history.
A lot more useful information is at https://sourceware.org/gdb/onlinedocs/gdb/Continuing-and-Stepping.html
I came here because I had the same question. I eventually figured that for my purpose any time I could use something like "step-out" of a loop I can just set another breakpoint after the loop and then let the program
continue to finish the loop and run into the breakpoint afterward. Sorry if that is obvious to most people but it is probably helpful for someone looking for an answer to this question.