Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
To resume execution at a different place, you can use return (see “Returning from a
function” (page 116)) to go back to the calling function; or jump (see “Continuing at a
different address” (page 114)) to go to an arbitrary location in your program.
A typical technique for using stepping is to set a breakpoint (see “Breakpoints (page 46))
at the beginning of the function or the section of your program where a problem is
believed to lie, run your program until it stops at that breakpoint, and then step through
the suspect area, examining the variables that are interesting, until you see the problem
happen.
step Continue running your program until control reaches a different
source line, then stop it and return control to GDB. This command
is abbreviated s.
WARNING! If you use the step command while control is
within a function that was compiled without debugging
information, execution proceeds until control reaches a function
that does have debugging information. Likewise, it will not step
into a function which is compiled without debugging information.
To step through functions without debugging information, use
the stepi command, described below.
The step command only stops at the first instruction of a source
line. This prevents the multiple stops that could otherwise occur
in switch statements, for loops, and so on. step continues to stop
if a function that has debugging information is called within the
line. In other words, step steps inside any functions called within
the line.
Also, the step command only enters a function if there is line
number information for the function. Otherwise it acts like the
next command. This avoids problems when using cc -gl on
MIPS machines. Previously, step entered subroutines if there was
any debugging information about the routine.
step count Continue running as in step, but do so count times. If a
breakpoint is reached, or a signal not related to stepping occurs
before count steps, stepping stops right away.
next [count] Continue to the next source line in the current (innermost) stack
frame. This is similar to step, but function calls that appear within
the line of code are executed without stopping. Execution stops
when control reaches a different line of code at the original stack
level that was executing when you gave the next command.
This command is abbreviated n.
An argument count is a repeat count, as for step.
60 Stopping and Continuing