Not supported on windows
Supported on linux
Not supported on android
info checkpoints command
Displays the list of created checkpoints
Syntax
info checkpoints
Remarks
See the description of the checkpoint command for an overview of GDB checkpoints. Use the restart command to go to a checkpoint.
Examples
We will demonstrate the use of the info checkpoints command using a basic C++ program that iterates from 0 to 9 and displays a message in each iteration:
#include <stdio.h>
int main(int argc, char **argv)
{
for(int i = 0; i < argc; i++)
printf("Arg %d: %s\n", i, argv[i]);
return 0;
}
int main(int argc, char **argv)
{
for(int i = 0; i < argc; i++)
printf("Arg %d: %s\n", i, argv[i]);
return 0;
}
We will create several checkpoints at different stages of execution and use the info checkpoints command to display information about them.
(gdb) start
Temporary breakpoint 1 at 0x804847a: file test.cpp, line 11.
Starting program: /home/bazis/test
Temporary breakpoint 1, main (argc=1, argv=0xbffff064) at test.cpp:11
11 for (int i = 0; i < 10; i++)
(gdb) checkpoint
checkpoint: fork returned pid 2059.
(gdb) step
12 report(i);
(gdb) checkpoint
checkpoint: fork returned pid 2060.
(gdb) step
report (iteration=0) at test.cpp:6
6 printf("Pid %d, iteration %dgetpid(), iteration);
(gdb) checkpoint
checkpoint: fork returned pid 2061.
(gdb) info checkpoints
3 process 2061 at 0x8048453, file test.cpp, line 6
2 process 2060 at 0x8048484, file test.cpp, line 12
1 process 2059 at 0x804847a, file test.cpp, line 11
* 0 process 2055 (main process) at 0x8048453, file test.cpp, line 6
(gdb) backtrace
#0 report (iteration=0) at test.cpp:6
#1 0x08048490 in main (argc=1, argv=0xbffff064) at test.cpp:12
(gdb) restart 1
Switching to process 2059
#0 main (argc=1, argv=0xbffff064) at test.cpp:11
11 for (int i = 0; i < 10; i++)
(gdb) backtrace
#0 main (argc=1, argv=0xbffff064) at test.cpp:11
(gdb) restart 0
Switching to process 2055
#0 report (iteration=0) at test.cpp:6
6 printf("Pid %d, iteration %dgetpid(), iteration);
Temporary breakpoint 1 at 0x804847a: file test.cpp, line 11.
Starting program: /home/bazis/test
Temporary breakpoint 1, main (argc=1, argv=0xbffff064) at test.cpp:11
11 for (int i = 0; i < 10; i++)
(gdb) checkpoint
checkpoint: fork returned pid 2059.
(gdb) step
12 report(i);
(gdb) checkpoint
checkpoint: fork returned pid 2060.
(gdb) step
report (iteration=0) at test.cpp:6
6 printf("Pid %d, iteration %dgetpid(), iteration);
(gdb) checkpoint
checkpoint: fork returned pid 2061.
(gdb) info checkpoints
3 process 2061 at 0x8048453, file test.cpp, line 6
2 process 2060 at 0x8048484, file test.cpp, line 12
1 process 2059 at 0x804847a, file test.cpp, line 11
* 0 process 2055 (main process) at 0x8048453, file test.cpp, line 6
(gdb) backtrace
#0 report (iteration=0) at test.cpp:6
#1 0x08048490 in main (argc=1, argv=0xbffff064) at test.cpp:12
(gdb) restart 1
Switching to process 2059
#0 main (argc=1, argv=0xbffff064) at test.cpp:11
11 for (int i = 0; i < 10; i++)
(gdb) backtrace
#0 main (argc=1, argv=0xbffff064) at test.cpp:11
(gdb) restart 0
Switching to process 2055
#0 report (iteration=0) at test.cpp:6
6 printf("Pid %d, iteration %dgetpid(), iteration);
Compatibility with VisualGDB
You can use the info checkpoints command with VisualGDB using the GDB Session window in Visual Studio.