help running provides some hints:
There are step and next instuctions (and also nexti and stepi).
(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.
The step and stepi (and the next and nexti) are distinguishing by "line" or "instruction" increments.
step -- Step program until it reaches a different source line
stepi -- Step one instruction exactly
Related is finish:
(gdb) help finish
Execute until selected stack frame returns.
Usage: finish
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
Answer from Stephen Harris on Stack Exchangehelp running provides some hints:
There are step and next instuctions (and also nexti and stepi).
(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.
The step and stepi (and the next and nexti) are distinguishing by "line" or "instruction" increments.
step -- Step program until it reaches a different source line
stepi -- Step one instruction exactly
Related is finish:
(gdb) help finish
Execute until selected stack frame returns.
Usage: finish
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
Use command 'finish'; this sometimes does the same thing as 'step-out'. It'll finish what the stack is doing (a function, usually), and go to the next line after that. Look up the command for more info.
Can gdb step in a root function?
Can't see the source code of my assembly program with GDB
The only proper way to debug 16-bit code on Qemu+GDB
gdb: How to stepi right through the end of main
What do you mean by "starts stepping before main" and about stepping after the end of main?
More on reddit.com