Add a debugging function to dump the stack.