GDB - Setting Breakpoints

From EdWiki

Setting Breakpoints

  • Breakpoints can be used to stop the program run in the middle, at a designated point.The simplest way is the command “break.” This sets a breakpoint at a specified file-line pair:
(gdb) break file1.c:6
  • This sets a breakpoint at line 6, of file1.c. Now, if the program ever reaches that location when running, the program will pause and prompt you for another command.
  • You can set as many breakpoints as you want, and the program should stop execution if it reaches any of them.