For those wondering what GDB
are, there are some links.
LordSputnik has the best approach to debugging, just dump the variables to display.
The Raspberry Pi has some JTAG
support on the GPIO pins, if you need to step through what the CPU is doing for super serious debugging.