continue command
Continues program execution after a breakpoint.
Syntax
continue [Repeat count]
c
c [Repeat count]
Parameters
- Repeat count
- If this parameter is specified, GDB will auto-continue the next Repeat count - 1 times when the current breakpoint is hit.
Remarks
The continue is also used to start debugging in the following cases:
- To resume a process after attaching to it with attach
- To start debugging with gdbserver
Examples
This example illustrates the use of the Repeat count parameter. The following program is being debugged:
void func(int arg)
{
printf("%d\n", arg);
}
int main(int argc, char *argv[])
{
for (int i = 0; i < 5; i++)
func(i);
return 0;
}
When a continue command is issued without any parameters, GDB breaks in the next loop iteration. When a repeat count of 3 is specified, GDB skips the next 2 iterations. In case of a single breakpoint this is equivalent to issuing the continue command 3 times.
Breakpoint 1 at 0x80483ea: file 0.cpp, line 5.
(gdb) r
Starting program: /home/testuser/0.elf
Breakpoint 1, func (arg=0) at 0.cpp:5
5 printf("Iteration %darg);
(gdb) c
Continuing.
Iteration 0
Breakpoint 1, func (arg=1) at 0.cpp:5
5 printf("Iteration %darg);
(gdb) c 3
Will ignore next 2 crossings of breakpoint 1. Continuing.
Iteration 1
Iteration 2
Iteration 3
Breakpoint 1, func (arg=4) at 0.cpp:5
5 printf("Iteration %darg);
Common errors
Using the continue command before a program is started will result in an error. If you encounter it, use the run command to start the program instead:
The program is not being run.
(gdb) run
Starting program: /home/testuser/0.elf
Iteration 0
Iteration 1
Iteration 2
Iteration 3
Iteration 4
[Inferior 1 (process 31852) exited normally]
(gdb)
Compatibility with VisualGDB
Do not execute the continue command manually under Visual Studio. Press F5 or use the Debug->Continue command to continue execution after a breakpoint is hit: