When debugging Drupal, I often stick dpm($some_array, "my array"); calls to see what the value of $some_array is.
This fails spectacularly if the code I'm debugging is run very late in the request after drupal_get_messages() has already been called. (Eg most hook_preprocess_THEMEHOOK functions).
In that case, I've found it useful to add these helper functions somewhere (any enabled custom module, or even index.php), use them instead of dpm. They'll serialize objects to apache's error_log (wherever that is), which you can track by opening a terminal tab and running:
tail -f /var/log/apache2/error.log | tr '%' "\n"