This article suggests ways of avoiding bugs in your code as well as strategies for finding these bugs using the dbx command-line debugger.
dbx