From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debugging