Ok folks, head over to http://direc.org/linux/gdb/ for the best tuturial I have ever come across on using GDB to debug C programs.
I wish I had seen that years ago, it would have saved me a lot of time and printf statements as GDB is not easy to learn, unless you find that tutorial. It shows how powerfull GDB can be both clearly and very quickly.
Also found a few good debugging tips at http://blog.sanctum.geek.nz/series/unix-as-ide/ mentioning valgrind and ltrace as debugging tools. And a usefull read on tips for using unix in general even if you are not into debugging; although it didn’t mention screen :-).
Update…. the direc.org URL no longer works, just says the domain name is available. Damb, wish I had saved all the info. It was the best tutorial I had even come across, now its gone.