7.8. Continuing Execution
To resume the execution of the program you are debugging after it reached a breakpoint, run the following command:
continue
The execution stops again when another breakpoint is reached. To skip a certain number of breakpoints (typically when you are debugging a loop), you can run the
continue command in the following form:
continue number
The
gdb utility also allows you to stop the execution after executing a single line of code. To do so, run:
step
Finally, you can execute a certain number of lines by using the
step command in the following form:
step number
Example 7.10. Continuing the Execution of the fibonacci Binary File
Assuming that you have followed the instructions in Example 7.8, “Executing the fibonacci Binary File”, and the execution of the
fibonacci binary stopped after reaching the breakpoint at line 10, you can resume the execution by running the following command:
(gdb) continue
Continuing.
Breakpoint 1, main (argc=1, argv=0x7fffffffe4d8) at fibonacci.c:10
10 printf("%ld ", b);
The execution stops the next time the breakpoint is reached. To execute the next three lines of code, type:
(gdb) step 3
13 b = sum;
This allows you to verify the current value of the
sum variable before it is assigned to b:
(gdb) print sum
$3 = 2