Debugging Tricks

'Debugging' drupal can be difficult is you don't have eclipse set up with xdebug etc etc.

I knew a certain bug occurred when the code went into a certain function. But what I didn't know is what was calling that code. So I added the following 3 lines to the function.

echo '';
print_r(debug_backtrace());
echo '';

debug_backtrace is a php function that prints all the functions that were called before the one that you are currently in. This showed me which functions caused the problem.

Also have a look at Quick and Dirty Debugging by Lullabot