DynaFix: Iterative Automated Program Repair Driven by Execution-Level Dynamic Information
Zhili Huang, Ling Xu, Chao Liu, Weifeng Sun, Xu Zhang, Yan Lei, Hongyu Zhang
原文摘要
Automated Program Repair (APR) seeks to generate correct patches for buggy programs, but recent Large Language Model (LLM)-based repair systems remain sensitive to superficial code changes and often rely on coarse test outcomes during iterative repair. We propose DynaFix, an LLM-based APR framework that integrates execution-level dynamic information into a closed-loop repair workflow. The distinguishing feature of DynaFix lies not in using execution-level information per se, but in repeatedly updating and exploiting such information throughout the iterative repair process. In each repair round, DynaFix uses ByteTrace to collect variable states, branch paths, and call stacks, incorporates these runtime signals into structured prompts, validates generated patches through re-execution, and feeds the resulting updated traces into subsequent repair iterations. This process grounds patch generation in concrete execution behavior rather than static code alone. We evaluate DynaFix on Defects4J v2.0, the Real-World Benchmark, and a code perturbation benchmark, Defects4J-Trans. DynaFix repairs 236 single-function Defects4J bugs with GPT-4 and 186 with GPT-4o, including 23 bugs not fixed by existing baselines. On Defects4J-Trans, DynaFix achieves 15.6%-32.1% higher aggregate repair counts than ReinFix and shows higher repair retention under semantics-preserving transformations. It also reduces token consumption by 60%-70% compared with state-of-the-art LLM-based APR methods. These results show that repeatedly updating and exploiting execution-level information throughout iterative repair can substantially improve the effectiveness, robustness, and cost efficiency of LLM-based program repair.
cs.SE · cs.AI