title: how does gdb work?
body: <p>I want to know how does gdb work internally.
  e.g. I know a brief idea that it makes use of ptrace() system call to monitor traced program.
  But I want to know how it handles signals, how it inserts new code, and other such fabulous things it does.</p>