How can I make gdb stop at the breakpoint after loop has been executed n number of times

debugging, for-loop, gdb, loops

Solution

You need to use the `ignore` command. Set a breakpoint at the relevant place in your loop and then use `ignore` to indicate how many times that the breakpoint is to be ignored.

Syntax, as per `help ignore` is:

Set ignore-count of breakpoint number N to COUNT. Usage is `ignore N COUNT'.

Problem

I want to stop the execution, when the loop has been executed n number of times. I don't want to use the conditional breakpoint using value of loop-counter because initial value of loop-counter is different at different time of run.

Original source

Related problems