How to skip a number of iterations of a loop in GDB?
You could use conditional break points
break <lineno> if i > 50
where i
is the loop index
Set a breakpoint in the loop and then call c 50 to continue 50 times
Debugging with GDB
5.2 Continuing and stepping
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 specify a further number of times to ignore a breakpoint at this location; its effect is like that of ignore (see section Break conditions). The argument ignore-count is meaningful only when your program stopped due to a breakpoint. At other times, the argument to continue is ignored.