How do I know what variables are available for a theme function? I am using the Menu block module. In one template I have used kpr($page); to see what hooks the menu block is calling. I then created the correct function in my theme's template.php file mytheme_menu_block_wrapper__1(). The examples I have read suggest that this should not take any arguments.

So what I'm really interested in learning is how to debug drupal.

Is there a function that I can call that will show me all the available variables, something like drupal_special_dump() that would show all variables I can use?  Any help would be appreciated.
The Devel module, and it's fantastic dpm() function, is the most widely used debug method for Drupal (at least I'm pretty sure it is).

It can be used on any variable, including arrays and objects, and will post a message to the standard message area containing a nicely structured representation of the variable. It looks something like this:



You would use it as simply as:

function mytheme_menu_block_wrapper__1($vars) {
  dpm($vars);
}


FYI I think all theme functions in Drupal 7 will receive at least one argument which will contain the data for that theme function. That argument is represented by $vars in the above example.

If you're looking to get hold of a list of variables that have been defined for the whole page request you might want to look at the PHP get_defined_vars() function instead.