Debugging with GDB (September 2007)
44 Debugging with GDB
When this message is printed, you need to disable or remove some of the hardware-
assisted breakpoints and watchp oints, and then continue.
5.2 Continuing and stepping
Continuing means resuming program execution until your program completes normally.
In contrast, stepping means executing just one more “step” of your program, where “step”
may mean either one line of source code, or one machine instruction (depending on what
particular command you use). Either when continuing or when stepping, your program may
stop even sooner, due to a breakpoint or a signal. (If it stops due to a signal, you may want
to use handle, or use ‘signal 0’ to resume execution. See
Section 5.3 [Signals], page 46.)
continue [ignore-count]
c [ignore-count]
fg [ignore-count]
Resume program execution, at the address where your program last stopped;
any breakpoints set at that address are bypassed. The optional argument
ignore-count allows you to spe cify a further number of times to ignore a break-
point at this location; its effect is like that of ignore (see Section 5.1.5 [Break
conditions], page 40).
The argument ignore-count is meaningful only when your program stopped due
to a breakpoint. At other times, the argument to continue is ignored.
The synonyms c and fg (for foreground, as the debugged program is deemed
to be the foreground program) are provided purely for convenience, and have
exactly the same behavior as continue.
To resume execution at a different place, you can use return (see Section 11.4 [Returning
from a function], page 99) to go back to the calling function; or jump (see Section 11.2
[Continuing at a different address], page 98) to go to an arbitrary location in your program.
A typical technique for using stepping is to set a breakpoint (see Section 5.1 [Breakpoints;
watchpoints; and catchpoints], page 33) 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 com piled without debugging information, ex-
ecution 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