For the scope of this tutorial I am only talking about Software breakpoints :-

Breakpoints are the instructions that pause the control flow of the program and gives the control to the debugger...We all know that the main executable is nothing but some opcodes(hex numbers) The debugger adds a opcode before a function or in the middle of the function (as desired) ..

Now that we know something about the Breakpoints lets use it in our program :-

Lets put a breakpoint at very beginning of the program..And trace what's happening

Code:

(gdb) break main
Breakpoint 1 at 0x804844d: file debugMe.c, line 4.

We successfully added a breakpoint and now lets run the program rest the GDB output is quite self-explanatory