The invention relates to an automatic program repairing method based on data flow driving, which takes an error file and a method signature as input, and reports error information in a defect positioning tool or an integrated
development environment. Secondly, handing over error information and original defect codes to a large
language model, extracting an element
list related to defects from the large
language model, then constructing defect contexts, using a search tool to retrieve key element definitions and dependency relationships, integrating
control flow and error mode information, and finally obtaining defect information; then, the retrieved information, the original defect codes and the potential defect types are integrated into cue words, and the cue words are submitted to a large
language model to generate candidate patches. And then the candidate patch is verified, and if the candidate patch does not pass the
verification,
error reporting information during the
verification is combined with the candidate patch to carry out iterative optimization until the candidate patch successfully passes all test
verification or the maximum number of iterations is reached. According to the method, context
semantics are enhanced by means of
data flow analysis, and the repairing accuracy and efficiency are improved.