Resources
GDB tips – Breakpoint commands
Sometimes you want to execute a command or sequence of commands every time a breakpoint is hit. You can do this using `commands [NUMBER]’, where [NUMBER] is the identifier of the breakpoint that you are interested in. This will give you a secondary prompt where you can type any valid GDB commands. Once you’ve finished entering the commands to be executed, type `end` to return to the regular GDB prompt. The commands you just entered will now be executed whenever the specified breakpoint is hit. You can use the extra command `silent` if you want to suppress normal breakpoint output.