One of our favorite tools at yaSSL is valgrind: http://valgrind.org . Originally a memory error detector, it`s now an instrumentation framework for dynamic analysis that also does thread error detection, cache and branch-prediction profiling, and heap profiling. If you`ve never used it, you should. If you are using it, you should probably be using it more.
We recently added an –enable-valgrind option to the wolfSSL lightweight SSL library to encourage us to use it more ourselves. If valgrind is installed on your system all of the wolfSSL tests will be run under it. This allows early detection of difficult to track down errors. The detailed output makes tracking down and fixing errors a relatively simple process.