dm: Move the tree/uclass dump code into its own file