I just discovered a few days ago that gdb + valgrind integration. It's awesome for debugging and finding weird memory errors. A neat thing that isn't explained in the article is that valgrind automatically sends SIGTRAP to gdb whenever there are invalid write/reads (even when those wouldn't cause a segfault), so the program stops and you can inspect the state (get backtrace, jump to different frames with "frame #" and inspect variable values) to detect quickly what's causing the error.<p>By the way, if you're really interested in learning all things gdb, the GNU GDB Manual [1] is really great and detailed, including a PDF version.<p>[1] <a href="http://www.gnu.org/software/gdb/documentation/" rel="nofollow">http://www.gnu.org/software/gdb/documentation/</a>