| Automatic software repair plays an important role in automating the activity of software maintenance and improving both software quality and trustworthy.Although the research on automatic software repair has made some progress,current techniques still suffer from the limitation of repair effectiveness and efficiency.This dissertation mainly studied the automatic software repair technology based on heuristic search,which transforms the automatic software repair into a search problem of finding the correct patch from the potential search space based on some heuristic information.This dissertation does a research into three search spaces for automatic software repair and optimizes the three search spaces to a certain extent on the basis of prior art.Firstly,the minimum suspicious value and maximum number of suspicious locations are preset to limit the size of suspicious space;then,we expand the operation space to increase the chance of repairing more bugs;finally,in order to limit the size of ingredient space,the source of fixing ingredient is limited to the defect program itself.To alleviate the problem of large search space and low search efficiency in the existing automatic software repair techniques based on search,this dissertation proposes two kinds of software automatic repair approaches and justifies the advantage of each method on the real-life,large-scale faults in open source.The main contributions are summarized as follows:(1)For the problems of large search and low search efficiency in existing techniques,an automatic software repair approach based on genetic programming and code similarity is proposed.We design and implement its prototype tool GPSRepair(Genetic Programming with Similarity Repair).First,the suspicious space is obtained by fault localization technique.Second,the candidate patches are generated by mutation and crossover.Third,each candidate patch is validated by test suite and its similarity to the original program is calculated.Fourth,the fitness value of each patch individual is calculated,and a new generation population is selected according to the fitness value.Finally,repeat the steps above until a patch that passes all test cases is generated.The experimental results on 224 real Java software defects in Defects4 j defect data set show that GPSRepair has better repair capabilities than the existing automatic software repair methods.(2)Patch validation consumes too much computing resources in existing techniques,thus this dissertation proposes an automatic software repair approach based on random search strategy.We design and implement its prototype tool RSSRepair(Random Search Strategy Repair).RSSRepair removes the crossover process and fitness function in GPSRepair.The selection method for each individual is uniform random selection.First,the suspicious space and the failing test cases are obtained by fault localization technique.Second,the original test suite is refactored to assign the ability of invalid patch recognition to each test case.Third,the candidate patches are generated by mutation;fourth,accelerate the candidate patch verification process by using test case sorting technique.Finally,repeat the steps above until a patch that passes all test cases is generated.The experimental results on 224 real Java software defects in Defects4 j defect data set show that RSSRepair has better repair efficiency than the existing automatic software repair methods. |