continue <n>
นี่เป็นวิธีที่สะดวกในการข้ามครั้งสุดท้ายของ Hit เบรกพอยต์n - 1
(ดังนั้นจึงหยุดที่การตีที่ n):
main.c
#include <stdio.h>
int main(void) {
int i = 0;
while (1) {
i++; /* Line 6 */
printf("%d\n", i);
}
}
การใช้งาน:
gdb -n -q main.out
เซสชัน GDB:
Reading symbols from main.out...done.
(gdb) start
Temporary breakpoint 1 at 0x6a8: file main.c, line 4.
Starting program: /home/ciro/bak/git/cpp-cheat/gdb/main.out
Temporary breakpoint 1, main () at main.c:4
4 int i = 0;
(gdb) b 6
Breakpoint 2 at 0x5555555546af: file main.c, line 6.
(gdb) c
Continuing.
Breakpoint 2, main () at main.c:6
6 i++; /* Line 6 */
(gdb) c 5
Will ignore next 4 crossings of breakpoint 2. Continuing.
1
2
3
4
5
Breakpoint 2, main () at main.c:6
6 i++; /* Line 6 */
(gdb) p i
$1 = 5
(gdb)
(gdb) help c
Continue program being debugged, after signal or breakpoint.
Usage: continue [N]
If proceeding from breakpoint, a number N may be used as an argument,
which means to set the ignore count of that breakpoint to N - 1 (so that
the breakpoint won't break until the Nth time it is reached).