Added dump_stack() method for debugging.

  This is just a trivial helper, and shouldn't be used unless debugging.