Add helper method dump_all_state to debug.c