Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Automatic Patch Generation Learned
from Human-Written Patches
Dongsun Kim, Jaechang Nam, Jaewoo Song, and Sunghun Kim
The ...
2
Repair
2
Repair
2
Repair
GenProgGenProg
3
GenProg
C. Le Goues, M. Dewey-Vogt, S. Forrest, and W.Weimer,“A systematic study of automated
program repair: Fixing 55 ...
3
GenProg
State-of-the-art
C. Le Goues, M. Dewey-Vogt, S. Forrest, and W.Weimer,“A systematic study of automated
program r...
3
GenProg
State-of-the-art
Genetic Programming
C. Le Goues, M. Dewey-Vogt, S. Forrest, and W.Weimer,“A systematic study of...
3
GenProg
State-of-the-art
Genetic Programming
Random Mutation
C. Le Goues, M. Dewey-Vogt, S. Forrest, and W.Weimer,“A sys...
3
GenProg
State-of-the-art
Genetic Programming
Random Mutation
Systematically Evaluated
C. Le Goues, M. Dewey-Vogt, S. For...
4
Buggy Code
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMatch...
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMatch...
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMatch...
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMatch...
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMatch...
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMatch...
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMatch...
6
GenProg repairs bugs1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, ind...
6
GenProg repairs bugs1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, ind...
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMatch...
7
Would you accept?
7
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMat...
7
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMat...
7
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMat...
8
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMat...
8
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1502 stop, index);
1503 if (kidMat...
9
9
9
•Random
9
•Random
•Unnatural
9
•Random
•Unnatural
•Harder  to  understand
10
10
10
Random
Evolution
10
Random
Evolution
Explores the large
search space
10
Random
Evolution
Explores the large
search space
but sometimes produces
random results
10
Random
Evolution
Intelligent
Design
Explores the large
search space
but sometimes produces
random results
10
Random
Evolution
Intelligent
Design
Explores the large
search space Leverages human knowledge
but sometimes produces
ra...
11
Human-written Patches
11
Human-written Patches
Readable
11
Human-written Patches
Readable
Natural
11
Human-written Patches
Readable
Natural
Easy to understand
11
Human-written Patches
Readable
Natural
Easy to understand
We can learn how to generate
patches from human knowledge.
12
12
JDT
12
>60,000
Patches
JDT
12
Manual
Classification
>60,000
Patches
JDT
12
Manual
Classification
#patches
Patterns
>60,000
Patches
JDT
12
Manual
Classification
#patches
Patterns
>60,000
Patches
JDT
12
Manual
Classification
#patches
Patterns
Top frequent
patterns
account for >20~30%
>60,000
Patches
JDT
13
Common Fix Patterns
Altering method parameters
obj.method(v1,v2)0→0obj.method(v1,v3)
Altering method parameters
obj.met...
13
Common Fix Patterns
Adding a checker
obj.m1())→)if(obj'!='null)){obj.m1()}
Adding a checker
obj.m1())→)if(obj'!='null))...
14
PAR
Pattern-based Automatic Program Repair
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
16
+
-
+
Using Human Knowledge
for patch generation
16
+
-
+
Fix Templates
Using Human Knowledge
for patch generation
16
+
-
+
Fix Templates
Program Edit Script
Using Human Knowledge
for patch generation
16
+
-
+
Fix Templates
Program Edit Script
Using Human Knowledge
for patch generation
10
16
+
-
+
Fix Templates
Program Edit Script
Manually created from fix patterns
Using Human Knowledge
for patch generation
10...
16
+
-
+
Fix Templates
Program Edit Script
Manually created from fix patterns
Highly reusable
Using Human Knowledge
for pat...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
19
Fault
Locations
J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault localizatio...
19
TP TF
Fault
Locations
J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault local...
19
TP TF
Fault
Locations
J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault local...
19
TP TF
Fault
Locations
J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault local...
19
TP TF
Fault
Locations
J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault local...
19
TP TF
Fault
Locations
J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault local...
19
TP TF
Fault
Locations
Fault
locations
J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to as...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
23
How a Fix Template works
23
How a Fix Template works
23
How a Fix Template works
+
-
+
23
How a Fix Template works
+
-
+
23
How a Fix Template works
+
-
+
23
How a Fix Template works
+
-
+
23
AST Analysis
→Collects necessary AST nodes
How a Fix Template works
+
-
+
23
AST Analysis
→Collects necessary AST nodes
Context Check
→Examines applicability
How a Fix Template works
+
-
+
23
AST Analysis
→Collects necessary AST nodes
Context Check
→Examines applicability
Program Editing
→Modifies the sou...
Using a Fix Template:An Example
24
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1...
Using a Fix Template:An Example
24
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes(state, (RENode)ren.kid,
1...
+
-
+Null Pointer Checker
Using a Fix Template:An Example
24
1500 num = state.parenCount;
1501 int kidMatch = matchRENodes...
+
-
+Null Pointer Checker
Using a Fix Template:An Example
24
obj ref.: state, parens[i], ...
1500 num = state.parenCount;
...
+
-
+Null Pointer Checker
Using a Fix Template:An Example
24
obj ref.: state, parens[i], ...
Check obj ref.: PASS
1500 num...
+
-
+Null Pointer Checker
Using a Fix Template:An Example
24
obj ref.: state, parens[i], ...
Check obj ref.: PASS
Edit: In...
+
-
+Null Pointer Checker
Using a Fix Template:An Example
24
obj ref.: state, parens[i], ...
Check obj ref.: PASS
Edit: In...
+
-
+Null Pointer Checker
Using a Fix Template:An Example
24
obj ref.: state, parens[i], ...
Check obj ref.: PASS
Edit: In...
+
-
+Null Pointer Checker
Using a Fix Template:An Example
24
obj ref.: state, parens[i], ...
Check obj ref.: PASS
Edit: In...
25
List of Templates
25
List of Templates
Parameter Replacer
Method
Replacer
Parameter Adder
and Remover
Expression
Replacer
Expression Adder
a...
26
Creating Patch Candidates
26
Creating Patch Candidates
26
Fault location #1
Fault location #2
Fault location #3
Fault location #4
Fault location #N
...
Creating Patch Candidates
26
Fault location #1
Fault location #2
Fault location #3
Fault location #4
Fault location #N
...
Creating Patch Candidates...
26
Fault location #1
Fault location #2
Fault location #3
Fault location #4
Fault location #N
...
Creating Patch Candidates...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefined) {
lhs = strings[pc + 1];
}
Scriptable calleeScope = ...;
Buggy
Program
...
31
Evaluation:
Experiment Design
31
Evaluation:
Experiment Design
31
Evaluation:
Experiment Design
PAR GenProg
31
Evaluation:
Experiment Design
PAR GenProg
31
Evaluation:
Experiment Design
PAR GenProg
31
Evaluation:
Experiment Design
PAR GenProg
# #
32
RQ1(Fixability): How many bugs
are fixed successfully?
RQ2(Acceptability):Which approach
can generate more acceptable bu...
33
Subject # bugs LOC # test cases
Rhino 17 51,001 5,578
AspectJ 18 180,394 1,602
log4j 15 27,855 705
Math 29 121,168 3,53...
34
RQ1: Fixability
34
RQ1: Fixability
PAR GenProg
0
6
12
18
24
30
34
RQ1: Fixability
PAR GenProg
0
6
12
18
24
30
27
34
RQ1: Fixability
PAR GenProg
0
6
12
18
24
30
27
16
34
RQ1: Fixability
PAR GenProg
0
6
12
18
24
30
27
16
PAR GenProg
27 16
>
35
RQ2: Acceptability
35
RQ2: Acceptability
User Study #1: Ranking between
PAR and GenProg
36
36
PAR
36
PAR GenProg
36
PAR GenProg
5
37
User Study #1
Ranking Patches
37
User Study #1
Bug Description
Ranking Patches
37
User Study #1
Bug Description
Buggy Code
Ranking Patches
37
User Study #1
Bug Description
Buggy Code
Anonymized Patch #1
Ranking Patches
37
User Study #1
Bug Description
Buggy Code
Anonymized Patch #1
Anonymized Patch #2
Ranking Patches
37
User Study #1
Bug Description
Buggy Code
Anonymized Patch #1
Anonymized Patch #2
Anonymized Patch #3
Ranking Patches
37
User Study #1
Bug Description
Buggy Code
Anonymized Patch #1
Anonymized Patch #2
Anonymized Patch #3
Ranking Patches
37
User Study #1
Bug Description
Buggy Code
Anonymized Patch #1
Anonymized Patch #2
Anonymized Patch #3
Rank patches
17  S...
37
User Study #1
Bug Description
Buggy Code
Anonymized Patch #1
Anonymized Patch #2
Anonymized Patch #3
2
1
3
Rank patches...
User Study #1: Results
Student  group  (avg.  ranking)
38
(the lower the better)
Developer  group  (avg.  ranking)
(the lo...
User Study #1: Results
Student  group  (avg.  ranking)
38
0
0.75
1.5
2.25
3
1.72 1.57
2.67
PAR GenProgHuman
(the lower the...
User Study #1: Results
Student  group  (avg.  ranking)
38
0
0.75
1.5
2.25
3
1.72 1.57
2.67
PAR GenProgHuman
(the lower the...
User Study #1: Results
Student  group  (avg.  ranking)
38
0
0.75
1.5
2.25
3
1.72 1.57
2.67
PAR GenProgHuman
(the lower the...
User Study #1: Results
Student  group  (avg.  ranking)
38
0
0.75
1.5
2.25
3
1.72 1.57
2.67
PAR GenProgHuman
(the lower the...
User Study #1: Results
Student  group  (avg.  ranking)
38
0
0.75
1.5
2.25
3
1.72 1.57
2.67
PAR GenProgHuman
(the lower the...
39
RQ2: Acceptability
User Study #1: Ranking between
PAR and GenProg
39
RQ2: Acceptability
User Study #1: Ranking between
PAR and GenProg
User Study #2: Pair-wise Comparison
between
Human-wri...
40
40
PAR
27
40
PAR
27
GenProg
16
41
User Study #2
Pair-wise Comparison
41
User Study #2
Bug DescriptionPair-wise Comparison
41
User Study #2
Bug Description
Buggy Code
Pair-wise Comparison
41
User Study #2
Bug Description
Buggy Code
Anonymized Patch #1
Pair-wise Comparison
41
User Study #2
Bug Description
Buggy Code
Anonymized Patch #1
Anonymized Patch #2
Pair-wise Comparison
41
User Study #2
Bug Description
Buggy Code
Anonymized Patch #1
Anonymized Patch #2
Choose acceptable
patch(es)
72  Studen...
41
User Study #2
Bug Description
Buggy Code
Anonymized Patch #1
Anonymized Patch #2
Patch #1 Patch #2
Both Not sure
Choose...
User Study #2: Results
GenProg
42
PAR
User Study #2: Results
GenProg
42
0
10
20
30
40
21
28
37
14
responses(%)
PAR HumanBoth Not
Sure
PAR
User Study #2: Results
GenProg
42
0
10
20
30
40
21
28
37
14
responses(%)
PAR HumanBoth Not
Sure
PAR
0
15
30
45
60
20
12
51...
User Study #2: Results
GenProg
42
0
10
20
30
40
21
28
37
14
responses(%)
PAR HumanBoth Not
Sure
PAR
0
15
30
45
60
20
12
51...
User Study #2: Results
GenProg
42
0
10
20
30
40
21
28
37
14
responses(%)
PAR HumanBoth Not
Sure
PAR
0
15
30
45
60
20
12
51...
User Study #2: Results
GenProg
42
0
10
20
30
40
21
28
37
14
responses(%)
PAR HumanBoth Not
Sure
PAR
0
15
30
45
60
20
12
51...
43
Limitations
• Fix templates are written manually.
• But it is one-time cost, these are highly reusable.
•We entirely re...
44
Summary
44
Summary
Observed common patches
#patches
Patterns
44
Summary
Observed common patches
#patches
Patterns
Fix Templates and PAR
if(lhs == DBL_MRK) lhs = ...;
if(lhs == undefin...
44
Summary
Can fix more bugs with more acceptability
Observed common patches
#patches
Patterns
Fix Templates and PAR
if(lhs...
45
Future Work
Automatic Fix Template Identification
• More templates can fix more bugs.
More Test Cases
• More test cases m...
46
Acknowledgement
•Westley Weimer
• Claire Le Goues
•Thomas Zimmermann
• Christian Bird
47
Summary
Fix Templates and PAR
Can fix more bugs with more acceptability
Observed common patches
#patches
Patterns
if(lhs...
Upcoming SlideShare
Loading in …5
×

of

Automatic Patch Generation Learned from Human-Written Patches Slide 1 Automatic Patch Generation Learned from Human-Written Patches Slide 2 Automatic Patch Generation Learned from Human-Written Patches Slide 3 Automatic Patch Generation Learned from Human-Written Patches Slide 4 Automatic Patch Generation Learned from Human-Written Patches Slide 5 Automatic Patch Generation Learned from Human-Written Patches Slide 6 Automatic Patch Generation Learned from Human-Written Patches Slide 7 Automatic Patch Generation Learned from Human-Written Patches Slide 8 Automatic Patch Generation Learned from Human-Written Patches Slide 9 Automatic Patch Generation Learned from Human-Written Patches Slide 10 Automatic Patch Generation Learned from Human-Written Patches Slide 11 Automatic Patch Generation Learned from Human-Written Patches Slide 12 Automatic Patch Generation Learned from Human-Written Patches Slide 13 Automatic Patch Generation Learned from Human-Written Patches Slide 14 Automatic Patch Generation Learned from Human-Written Patches Slide 15 Automatic Patch Generation Learned from Human-Written Patches Slide 16 Automatic Patch Generation Learned from Human-Written Patches Slide 17 Automatic Patch Generation Learned from Human-Written Patches Slide 18 Automatic Patch Generation Learned from Human-Written Patches Slide 19 Automatic Patch Generation Learned from Human-Written Patches Slide 20 Automatic Patch Generation Learned from Human-Written Patches Slide 21 Automatic Patch Generation Learned from Human-Written Patches Slide 22 Automatic Patch Generation Learned from Human-Written Patches Slide 23 Automatic Patch Generation Learned from Human-Written Patches Slide 24 Automatic Patch Generation Learned from Human-Written Patches Slide 25 Automatic Patch Generation Learned from Human-Written Patches Slide 26 Automatic Patch Generation Learned from Human-Written Patches Slide 27 Automatic Patch Generation Learned from Human-Written Patches Slide 28 Automatic Patch Generation Learned from Human-Written Patches Slide 29 Automatic Patch Generation Learned from Human-Written Patches Slide 30 Automatic Patch Generation Learned from Human-Written Patches Slide 31 Automatic Patch Generation Learned from Human-Written Patches Slide 32 Automatic Patch Generation Learned from Human-Written Patches Slide 33 Automatic Patch Generation Learned from Human-Written Patches Slide 34 Automatic Patch Generation Learned from Human-Written Patches Slide 35 Automatic Patch Generation Learned from Human-Written Patches Slide 36 Automatic Patch Generation Learned from Human-Written Patches Slide 37 Automatic Patch Generation Learned from Human-Written Patches Slide 38 Automatic Patch Generation Learned from Human-Written Patches Slide 39 Automatic Patch Generation Learned from Human-Written Patches Slide 40 Automatic Patch Generation Learned from Human-Written Patches Slide 41 Automatic Patch Generation Learned from Human-Written Patches Slide 42 Automatic Patch Generation Learned from Human-Written Patches Slide 43 Automatic Patch Generation Learned from Human-Written Patches Slide 44 Automatic Patch Generation Learned from Human-Written Patches Slide 45 Automatic Patch Generation Learned from Human-Written Patches Slide 46 Automatic Patch Generation Learned from Human-Written Patches Slide 47 Automatic Patch Generation Learned from Human-Written Patches Slide 48 Automatic Patch Generation Learned from Human-Written Patches Slide 49 Automatic Patch Generation Learned from Human-Written Patches Slide 50 Automatic Patch Generation Learned from Human-Written Patches Slide 51 Automatic Patch Generation Learned from Human-Written Patches Slide 52 Automatic Patch Generation Learned from Human-Written Patches Slide 53 Automatic Patch Generation Learned from Human-Written Patches Slide 54 Automatic Patch Generation Learned from Human-Written Patches Slide 55 Automatic Patch Generation Learned from Human-Written Patches Slide 56 Automatic Patch Generation Learned from Human-Written Patches Slide 57 Automatic Patch Generation Learned from Human-Written Patches Slide 58 Automatic Patch Generation Learned from Human-Written Patches Slide 59 Automatic Patch Generation Learned from Human-Written Patches Slide 60 Automatic Patch Generation Learned from Human-Written Patches Slide 61 Automatic Patch Generation Learned from Human-Written Patches Slide 62 Automatic Patch Generation Learned from Human-Written Patches Slide 63 Automatic Patch Generation Learned from Human-Written Patches Slide 64 Automatic Patch Generation Learned from Human-Written Patches Slide 65 Automatic Patch Generation Learned from Human-Written Patches Slide 66 Automatic Patch Generation Learned from Human-Written Patches Slide 67 Automatic Patch Generation Learned from Human-Written Patches Slide 68 Automatic Patch Generation Learned from Human-Written Patches Slide 69 Automatic Patch Generation Learned from Human-Written Patches Slide 70 Automatic Patch Generation Learned from Human-Written Patches Slide 71 Automatic Patch Generation Learned from Human-Written Patches Slide 72 Automatic Patch Generation Learned from Human-Written Patches Slide 73 Automatic Patch Generation Learned from Human-Written Patches Slide 74 Automatic Patch Generation Learned from Human-Written Patches Slide 75 Automatic Patch Generation Learned from Human-Written Patches Slide 76 Automatic Patch Generation Learned from Human-Written Patches Slide 77 Automatic Patch Generation Learned from Human-Written Patches Slide 78 Automatic Patch Generation Learned from Human-Written Patches Slide 79 Automatic Patch Generation Learned from Human-Written Patches Slide 80 Automatic Patch Generation Learned from Human-Written Patches Slide 81 Automatic Patch Generation Learned from Human-Written Patches Slide 82 Automatic Patch Generation Learned from Human-Written Patches Slide 83 Automatic Patch Generation Learned from Human-Written Patches Slide 84 Automatic Patch Generation Learned from Human-Written Patches Slide 85 Automatic Patch Generation Learned from Human-Written Patches Slide 86 Automatic Patch Generation Learned from Human-Written Patches Slide 87 Automatic Patch Generation Learned from Human-Written Patches Slide 88 Automatic Patch Generation Learned from Human-Written Patches Slide 89 Automatic Patch Generation Learned from Human-Written Patches Slide 90 Automatic Patch Generation Learned from Human-Written Patches Slide 91 Automatic Patch Generation Learned from Human-Written Patches Slide 92 Automatic Patch Generation Learned from Human-Written Patches Slide 93 Automatic Patch Generation Learned from Human-Written Patches Slide 94 Automatic Patch Generation Learned from Human-Written Patches Slide 95 Automatic Patch Generation Learned from Human-Written Patches Slide 96 Automatic Patch Generation Learned from Human-Written Patches Slide 97 Automatic Patch Generation Learned from Human-Written Patches Slide 98 Automatic Patch Generation Learned from Human-Written Patches Slide 99 Automatic Patch Generation Learned from Human-Written Patches Slide 100 Automatic Patch Generation Learned from Human-Written Patches Slide 101 Automatic Patch Generation Learned from Human-Written Patches Slide 102 Automatic Patch Generation Learned from Human-Written Patches Slide 103 Automatic Patch Generation Learned from Human-Written Patches Slide 104 Automatic Patch Generation Learned from Human-Written Patches Slide 105 Automatic Patch Generation Learned from Human-Written Patches Slide 106 Automatic Patch Generation Learned from Human-Written Patches Slide 107 Automatic Patch Generation Learned from Human-Written Patches Slide 108 Automatic Patch Generation Learned from Human-Written Patches Slide 109 Automatic Patch Generation Learned from Human-Written Patches Slide 110 Automatic Patch Generation Learned from Human-Written Patches Slide 111 Automatic Patch Generation Learned from Human-Written Patches Slide 112 Automatic Patch Generation Learned from Human-Written Patches Slide 113 Automatic Patch Generation Learned from Human-Written Patches Slide 114 Automatic Patch Generation Learned from Human-Written Patches Slide 115 Automatic Patch Generation Learned from Human-Written Patches Slide 116 Automatic Patch Generation Learned from Human-Written Patches Slide 117 Automatic Patch Generation Learned from Human-Written Patches Slide 118 Automatic Patch Generation Learned from Human-Written Patches Slide 119 Automatic Patch Generation Learned from Human-Written Patches Slide 120 Automatic Patch Generation Learned from Human-Written Patches Slide 121 Automatic Patch Generation Learned from Human-Written Patches Slide 122 Automatic Patch Generation Learned from Human-Written Patches Slide 123 Automatic Patch Generation Learned from Human-Written Patches Slide 124 Automatic Patch Generation Learned from Human-Written Patches Slide 125 Automatic Patch Generation Learned from Human-Written Patches Slide 126 Automatic Patch Generation Learned from Human-Written Patches Slide 127 Automatic Patch Generation Learned from Human-Written Patches Slide 128 Automatic Patch Generation Learned from Human-Written Patches Slide 129 Automatic Patch Generation Learned from Human-Written Patches Slide 130 Automatic Patch Generation Learned from Human-Written Patches Slide 131 Automatic Patch Generation Learned from Human-Written Patches Slide 132 Automatic Patch Generation Learned from Human-Written Patches Slide 133 Automatic Patch Generation Learned from Human-Written Patches Slide 134 Automatic Patch Generation Learned from Human-Written Patches Slide 135 Automatic Patch Generation Learned from Human-Written Patches Slide 136 Automatic Patch Generation Learned from Human-Written Patches Slide 137 Automatic Patch Generation Learned from Human-Written Patches Slide 138 Automatic Patch Generation Learned from Human-Written Patches Slide 139 Automatic Patch Generation Learned from Human-Written Patches Slide 140 Automatic Patch Generation Learned from Human-Written Patches Slide 141 Automatic Patch Generation Learned from Human-Written Patches Slide 142 Automatic Patch Generation Learned from Human-Written Patches Slide 143 Automatic Patch Generation Learned from Human-Written Patches Slide 144 Automatic Patch Generation Learned from Human-Written Patches Slide 145 Automatic Patch Generation Learned from Human-Written Patches Slide 146 Automatic Patch Generation Learned from Human-Written Patches Slide 147 Automatic Patch Generation Learned from Human-Written Patches Slide 148 Automatic Patch Generation Learned from Human-Written Patches Slide 149 Automatic Patch Generation Learned from Human-Written Patches Slide 150 Automatic Patch Generation Learned from Human-Written Patches Slide 151 Automatic Patch Generation Learned from Human-Written Patches Slide 152 Automatic Patch Generation Learned from Human-Written Patches Slide 153 Automatic Patch Generation Learned from Human-Written Patches Slide 154 Automatic Patch Generation Learned from Human-Written Patches Slide 155 Automatic Patch Generation Learned from Human-Written Patches Slide 156 Automatic Patch Generation Learned from Human-Written Patches Slide 157 Automatic Patch Generation Learned from Human-Written Patches Slide 158 Automatic Patch Generation Learned from Human-Written Patches Slide 159 Automatic Patch Generation Learned from Human-Written Patches Slide 160 Automatic Patch Generation Learned from Human-Written Patches Slide 161 Automatic Patch Generation Learned from Human-Written Patches Slide 162 Automatic Patch Generation Learned from Human-Written Patches Slide 163 Automatic Patch Generation Learned from Human-Written Patches Slide 164 Automatic Patch Generation Learned from Human-Written Patches Slide 165 Automatic Patch Generation Learned from Human-Written Patches Slide 166 Automatic Patch Generation Learned from Human-Written Patches Slide 167 Automatic Patch Generation Learned from Human-Written Patches Slide 168 Automatic Patch Generation Learned from Human-Written Patches Slide 169 Automatic Patch Generation Learned from Human-Written Patches Slide 170 Automatic Patch Generation Learned from Human-Written Patches Slide 171
Upcoming SlideShare
Good Hunting: Locating, Prioritizing, and Fixing Bugs Automatically (Keynote, IWESEP 2013)
Next
Download to read offline and view in fullscreen.

0 Likes

Share

Download to read offline

Automatic Patch Generation Learned from Human-Written Patches

Download to read offline

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

Automatic Patch Generation Learned from Human-Written Patches

  1. 1. Automatic Patch Generation Learned from Human-Written Patches Dongsun Kim, Jaechang Nam, Jaewoo Song, and Sunghun Kim The Hong Kong University of Science and Technology, China 24 May 2013 the 35th International Conference on Software Engineering (ICSE 2013)
  2. 2. 2 Repair
  3. 3. 2 Repair
  4. 4. 2 Repair GenProgGenProg
  5. 5. 3 GenProg C. Le Goues, M. Dewey-Vogt, S. Forrest, and W.Weimer,“A systematic study of automated program repair: Fixing 55 out of 105 bugs for $8 each,” in ICSE ’12.
  6. 6. 3 GenProg State-of-the-art C. Le Goues, M. Dewey-Vogt, S. Forrest, and W.Weimer,“A systematic study of automated program repair: Fixing 55 out of 105 bugs for $8 each,” in ICSE ’12.
  7. 7. 3 GenProg State-of-the-art Genetic Programming C. Le Goues, M. Dewey-Vogt, S. Forrest, and W.Weimer,“A systematic study of automated program repair: Fixing 55 out of 105 bugs for $8 each,” in ICSE ’12.
  8. 8. 3 GenProg State-of-the-art Genetic Programming Random Mutation C. Le Goues, M. Dewey-Vogt, S. Forrest, and W.Weimer,“A systematic study of automated program repair: Fixing 55 out of 105 bugs for $8 each,” in ICSE ’12.
  9. 9. 3 GenProg State-of-the-art Genetic Programming Random Mutation Systematically Evaluated C. Le Goues, M. Dewey-Vogt, S. Forrest, and W.Weimer,“A systematic study of automated program repair: Fixing 55 out of 105 bugs for $8 each,” in ICSE ’12.
  10. 10. 4 Buggy Code
  11. 11. 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 4 in Interpreter.java reported as Mozilla Bug #76683 Buggy Code
  12. 12. 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 4 in Interpreter.java reported as Mozilla Bug #76683 Buggy Code
  13. 13. 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 4 in Interpreter.java reported as Mozilla Bug #76683 Null Pointer Exception Buggy Code
  14. 14. 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 5 GenProg repairs bugs
  15. 15. 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // deleted. 1507 } 1508 state.parenCount = num; 5 GenProg repairs bugs 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; Buggy  Code GenProg
  16. 16. 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // deleted. 1507 } 1508 state.parenCount = num; 5 GenProg repairs bugs 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; Buggy  Code GenProg
  17. 17. 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // deleted. 1507 } 1508 state.parenCount = num; 5 GenProg repairs bugs 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; Buggy  Code GenProg This patch passes ALL test cases.
  18. 18. 6 GenProg repairs bugs1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // deleted. 1507 } 1508 state.parenCount = num;
  19. 19. 6 GenProg repairs bugs1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // deleted. 1507 } 1508 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // deleted. 1507 } 1508 state.parenCount = num;
  20. 20. 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 6 GenProg repairs bugs1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // deleted. 1507 } 1508 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // deleted. 1507 } 1508 state.parenCount = num;
  21. 21. 7 Would you accept?
  22. 22. 7 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // do nothing. 1507 } 1508 state.parenCount = num; Would you accept?
  23. 23. 7 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // do nothing. 1507 } 1508 state.parenCount = num; Would you accept?
  24. 24. 7 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // do nothing. 1507 } 1508 state.parenCount = num; Would you accept? 17  Students 68  Developers
  25. 25. 8 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // do nothing. 1507 } 1508 state.parenCount = num; Would you accept? 17  Students 68  Developers
  26. 26. 8 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // do nothing. 1507 } 1508 state.parenCount = num; Would you accept? 9.4% 90.6% 17  Students 68  Developers
  27. 27. 9
  28. 28. 9
  29. 29. 9 •Random
  30. 30. 9 •Random •Unnatural
  31. 31. 9 •Random •Unnatural •Harder  to  understand
  32. 32. 10
  33. 33. 10
  34. 34. 10 Random Evolution
  35. 35. 10 Random Evolution Explores the large search space
  36. 36. 10 Random Evolution Explores the large search space but sometimes produces random results
  37. 37. 10 Random Evolution Intelligent Design Explores the large search space but sometimes produces random results
  38. 38. 10 Random Evolution Intelligent Design Explores the large search space Leverages human knowledge but sometimes produces random results
  39. 39. 11 Human-written Patches
  40. 40. 11 Human-written Patches Readable
  41. 41. 11 Human-written Patches Readable Natural
  42. 42. 11 Human-written Patches Readable Natural Easy to understand
  43. 43. 11 Human-written Patches Readable Natural Easy to understand We can learn how to generate patches from human knowledge.
  44. 44. 12
  45. 45. 12 JDT
  46. 46. 12 >60,000 Patches JDT
  47. 47. 12 Manual Classification >60,000 Patches JDT
  48. 48. 12 Manual Classification #patches Patterns >60,000 Patches JDT
  49. 49. 12 Manual Classification #patches Patterns >60,000 Patches JDT
  50. 50. 12 Manual Classification #patches Patterns Top frequent patterns account for >20~30% >60,000 Patches JDT
  51. 51. 13 Common Fix Patterns Altering method parameters obj.method(v1,v2)0→0obj.method(v1,v3) Altering method parameters obj.method(v1,v2)0→0obj.method(v1,v3)
  52. 52. 13 Common Fix Patterns Adding a checker obj.m1())→)if(obj'!='null)){obj.m1()} Adding a checker obj.m1())→)if(obj'!='null)){obj.m1()}
  53. 53. 14 PAR Pattern-based Automatic Program Repair
  54. 54. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 15
  55. 55. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 15 + - + Human Knowledge
  56. 56. 16 + - + Using Human Knowledge for patch generation
  57. 57. 16 + - + Fix Templates Using Human Knowledge for patch generation
  58. 58. 16 + - + Fix Templates Program Edit Script Using Human Knowledge for patch generation
  59. 59. 16 + - + Fix Templates Program Edit Script Using Human Knowledge for patch generation 10
  60. 60. 16 + - + Fix Templates Program Edit Script Manually created from fix patterns Using Human Knowledge for patch generation 10 JDT
  61. 61. 16 + - + Fix Templates Program Edit Script Manually created from fix patterns Highly reusable Using Human Knowledge for patch generation 10 JDT
  62. 62. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 17
  63. 63. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 18 if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Fault Localization
  64. 64. 19 Fault Locations J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault localization,” in Proceedings of the 24th International Conference on Software Engineering, NewYork, NY, USA, 2002, pp. 467–477.
  65. 65. 19 TP TF Fault Locations J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault localization,” in Proceedings of the 24th International Conference on Software Engineering, NewYork, NY, USA, 2002, pp. 467–477.
  66. 66. 19 TP TF Fault Locations J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault localization,” in Proceedings of the 24th International Conference on Software Engineering, NewYork, NY, USA, 2002, pp. 467–477.
  67. 67. 19 TP TF Fault Locations J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault localization,” in Proceedings of the 24th International Conference on Software Engineering, NewYork, NY, USA, 2002, pp. 467–477.
  68. 68. 19 TP TF Fault Locations J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault localization,” in Proceedings of the 24th International Conference on Software Engineering, NewYork, NY, USA, 2002, pp. 467–477.
  69. 69. 19 TP TF Fault Locations J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault localization,” in Proceedings of the 24th International Conference on Software Engineering, NewYork, NY, USA, 2002, pp. 467–477.
  70. 70. 19 TP TF Fault Locations Fault locations J.A. Jones, M. J. Harrold, and J. Stasko,“Visualization of test information to assist fault localization,” in Proceedings of the 24th International Conference on Software Engineering, NewYork, NY, USA, 2002, pp. 467–477.
  71. 71. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 20 if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Fault Localization
  72. 72. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 21
  73. 73. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 22 Template-based Patch Candidate Generation + - + - + + Fix Template Patch Candidate Fault Location
  74. 74. 23 How a Fix Template works
  75. 75. 23 How a Fix Template works
  76. 76. 23 How a Fix Template works
  77. 77. + - + 23 How a Fix Template works
  78. 78. + - + 23 How a Fix Template works
  79. 79. + - + 23 How a Fix Template works
  80. 80. + - + 23 AST Analysis →Collects necessary AST nodes How a Fix Template works
  81. 81. + - + 23 AST Analysis →Collects necessary AST nodes Context Check →Examines applicability How a Fix Template works
  82. 82. + - + 23 AST Analysis →Collects necessary AST nodes Context Check →Examines applicability Program Editing →Modifies the source code How a Fix Template works
  83. 83. Using a Fix Template:An Example 24 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num;
  84. 84. Using a Fix Template:An Example 24 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num;
  85. 85. + - +Null Pointer Checker Using a Fix Template:An Example 24 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num;
  86. 86. + - +Null Pointer Checker Using a Fix Template:An Example 24 obj ref.: state, parens[i], ... 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num;
  87. 87. + - +Null Pointer Checker Using a Fix Template:An Example 24 obj ref.: state, parens[i], ... Check obj ref.: PASS 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num;
  88. 88. + - +Null Pointer Checker Using a Fix Template:An Example 24 obj ref.: state, parens[i], ... Check obj ref.: PASS Edit: Insert ... ... + if( ) { state.parens[i].length = 0; + } ... ... state != null && state.parens[i] != null 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num;
  89. 89. + - +Null Pointer Checker Using a Fix Template:An Example 24 obj ref.: state, parens[i], ... Check obj ref.: PASS Edit: Insert ... ... + if( ) { state.parens[i].length = 0; + } ... ... state != null && state.parens[i] != null 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num;
  90. 90. + - +Null Pointer Checker Using a Fix Template:An Example 24 obj ref.: state, parens[i], ... Check obj ref.: PASS Edit: Insert ... ... + if( ) { state.parens[i].length = 0; + } ... ... state != null && state.parens[i] != null 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != -1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != -1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 // deleted. 1507 } 1508 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != -1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != -1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 if( state != null && state.parens[i] != null) 1507 state.parens[i].length = 0; 1508 } 1509 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num;
  91. 91. + - +Null Pointer Checker Using a Fix Template:An Example 24 obj ref.: state, parens[i], ... Check obj ref.: PASS Edit: Insert ... ... + if( ) { state.parens[i].length = 0; + } ... ... state != null && state.parens[i] != null 1502 stop, index); 1503 if (kidMatch != -1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != -1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 if( state != null && state.parens[i] != null) 1507 state.parens[i].length = 0; 1508 } 1509 state.parenCount = num; 1502 stop, index); 1503 if (kidMatch != -1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != -1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 { 1506 if( state != null && state.parens[i] != null) 1507 state.parens[i].length = 0; 1508 } 1509 state.parenCount = num; 1500 num = state.parenCount; 1501 int kidMatch = matchRENodes(state, (RENode)ren.kid, 1502 stop, index); 1503 if (kidMatch != 1) return kidMatch; 1504 for (int i = num; i < state.parenCount; i++) 1505 state.parens[i].length = 0; 1506 state.parenCount = num;
  92. 92. 25 List of Templates
  93. 93. 25 List of Templates Parameter Replacer Method Replacer Parameter Adder and Remover Expression Replacer Expression Adder and Remover Object Initializer Range Checker Collection Size Checker Null Pointer Checker Class Cast Checker
  94. 94. 26 Creating Patch Candidates
  95. 95. 26 Creating Patch Candidates
  96. 96. 26 Fault location #1 Fault location #2 Fault location #3 Fault location #4 Fault location #N ... Creating Patch Candidates
  97. 97. 26 Fault location #1 Fault location #2 Fault location #3 Fault location #4 Fault location #N ... Creating Patch Candidates + - + ... + - + + - + + - + + - + Fix Templates
  98. 98. 26 Fault location #1 Fault location #2 Fault location #3 Fault location #4 Fault location #N ... Creating Patch Candidates + - + ... + - + + - + + - + + - + Fix Templates ... Patch Candidates
  99. 99. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 27 Template-based Patch Candidate Generation + - + - + + Fix Template Patch Candidate Fault Location
  100. 100. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 28 Patch Evaluation
  101. 101. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 29 Patch Evaluation
  102. 102. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 29 Patch Evaluation T Repaired Test Cases
  103. 103. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 29 Patch Evaluation T Repaired Test Cases
  104. 104. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 29 Patch Evaluation T Repaired PassTest Cases
  105. 105. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 29 Patch Evaluation T Repaired T Repaired PassTest Cases
  106. 106. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 29 Patch Evaluation T Repaired T Repaired Pass Fail Test Cases
  107. 107. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 29 Patch Evaluation T Repaired T Repaired + - + - + + Fix Template Patch Candidate Fault Location Pass Fail Test Cases
  108. 108. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 30
  109. 109. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 30
  110. 110. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 30
  111. 111. if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 30
  112. 112. 31 Evaluation: Experiment Design
  113. 113. 31 Evaluation: Experiment Design
  114. 114. 31 Evaluation: Experiment Design PAR GenProg
  115. 115. 31 Evaluation: Experiment Design PAR GenProg
  116. 116. 31 Evaluation: Experiment Design PAR GenProg
  117. 117. 31 Evaluation: Experiment Design PAR GenProg # #
  118. 118. 32 RQ1(Fixability): How many bugs are fixed successfully? RQ2(Acceptability):Which approach can generate more acceptable bug patches? Evaluation: Research Questions #
  119. 119. 33 Subject # bugs LOC # test cases Rhino 17 51,001 5,578 AspectJ 18 180,394 1,602 log4j 15 27,855 705 Math 29 121,168 3,538 Lang 20 54,537 2,051 Collections 20 48,049 11,577 Total 119 351,406 25,051 Experiment Subjects
  120. 120. 34 RQ1: Fixability
  121. 121. 34 RQ1: Fixability PAR GenProg 0 6 12 18 24 30
  122. 122. 34 RQ1: Fixability PAR GenProg 0 6 12 18 24 30 27
  123. 123. 34 RQ1: Fixability PAR GenProg 0 6 12 18 24 30 27 16
  124. 124. 34 RQ1: Fixability PAR GenProg 0 6 12 18 24 30 27 16 PAR GenProg 27 16 >
  125. 125. 35 RQ2: Acceptability
  126. 126. 35 RQ2: Acceptability User Study #1: Ranking between PAR and GenProg
  127. 127. 36
  128. 128. 36 PAR
  129. 129. 36 PAR GenProg
  130. 130. 36 PAR GenProg 5
  131. 131. 37 User Study #1 Ranking Patches
  132. 132. 37 User Study #1 Bug Description Ranking Patches
  133. 133. 37 User Study #1 Bug Description Buggy Code Ranking Patches
  134. 134. 37 User Study #1 Bug Description Buggy Code Anonymized Patch #1 Ranking Patches
  135. 135. 37 User Study #1 Bug Description Buggy Code Anonymized Patch #1 Anonymized Patch #2 Ranking Patches
  136. 136. 37 User Study #1 Bug Description Buggy Code Anonymized Patch #1 Anonymized Patch #2 Anonymized Patch #3 Ranking Patches
  137. 137. 37 User Study #1 Bug Description Buggy Code Anonymized Patch #1 Anonymized Patch #2 Anonymized Patch #3 Ranking Patches
  138. 138. 37 User Study #1 Bug Description Buggy Code Anonymized Patch #1 Anonymized Patch #2 Anonymized Patch #3 Rank patches 17  Students 68  Developers Ranking Patches
  139. 139. 37 User Study #1 Bug Description Buggy Code Anonymized Patch #1 Anonymized Patch #2 Anonymized Patch #3 2 1 3 Rank patches 17  Students 68  Developers Ranking Patches
  140. 140. User Study #1: Results Student  group  (avg.  ranking) 38 (the lower the better) Developer  group  (avg.  ranking) (the lower the better)
  141. 141. User Study #1: Results Student  group  (avg.  ranking) 38 0 0.75 1.5 2.25 3 1.72 1.57 2.67 PAR GenProgHuman (the lower the better) Developer  group  (avg.  ranking) (the lower the better)
  142. 142. User Study #1: Results Student  group  (avg.  ranking) 38 0 0.75 1.5 2.25 3 1.72 1.57 2.67 PAR GenProgHuman (the lower the better) Developer  group  (avg.  ranking) (the lower the better) Significantly Different
  143. 143. User Study #1: Results Student  group  (avg.  ranking) 38 0 0.75 1.5 2.25 3 1.72 1.57 2.67 PAR GenProgHuman (the lower the better) Developer  group  (avg.  ranking) 1 1.35 1.7 2.05 2.4 1.81 1.82 2.36 (the lower the better) PAR GenProgHuman Significantly Different
  144. 144. User Study #1: Results Student  group  (avg.  ranking) 38 0 0.75 1.5 2.25 3 1.72 1.57 2.67 PAR GenProgHuman (the lower the better) Developer  group  (avg.  ranking) 1 1.35 1.7 2.05 2.4 1.81 1.82 2.36 (the lower the better) PAR GenProgHuman Significantly Different Significantly Different
  145. 145. User Study #1: Results Student  group  (avg.  ranking) 38 0 0.75 1.5 2.25 3 1.72 1.57 2.67 PAR GenProgHuman (the lower the better) Developer  group  (avg.  ranking) 1 1.35 1.7 2.05 2.4 1.81 1.82 2.36 (the lower the better) PAR GenProgHuman Significantly Different Significantly Different PAR generates better ranking patches than GenProg
  146. 146. 39 RQ2: Acceptability User Study #1: Ranking between PAR and GenProg
  147. 147. 39 RQ2: Acceptability User Study #1: Ranking between PAR and GenProg User Study #2: Pair-wise Comparison between Human-written Patches Vs. PAR or GenProg
  148. 148. 40
  149. 149. 40 PAR 27
  150. 150. 40 PAR 27 GenProg 16
  151. 151. 41 User Study #2 Pair-wise Comparison
  152. 152. 41 User Study #2 Bug DescriptionPair-wise Comparison
  153. 153. 41 User Study #2 Bug Description Buggy Code Pair-wise Comparison
  154. 154. 41 User Study #2 Bug Description Buggy Code Anonymized Patch #1 Pair-wise Comparison
  155. 155. 41 User Study #2 Bug Description Buggy Code Anonymized Patch #1 Anonymized Patch #2 Pair-wise Comparison
  156. 156. 41 User Study #2 Bug Description Buggy Code Anonymized Patch #1 Anonymized Patch #2 Choose acceptable patch(es) 72  Students 96  Developers Pair-wise Comparison
  157. 157. 41 User Study #2 Bug Description Buggy Code Anonymized Patch #1 Anonymized Patch #2 Patch #1 Patch #2 Both Not sure Choose acceptable patch(es) 72  Students 96  Developers Pair-wise Comparison
  158. 158. User Study #2: Results GenProg 42 PAR
  159. 159. User Study #2: Results GenProg 42 0 10 20 30 40 21 28 37 14 responses(%) PAR HumanBoth Not Sure PAR
  160. 160. User Study #2: Results GenProg 42 0 10 20 30 40 21 28 37 14 responses(%) PAR HumanBoth Not Sure PAR 0 15 30 45 60 20 12 51 17responses(%) GenProg HumanBoth Not Sure
  161. 161. User Study #2: Results GenProg 42 0 10 20 30 40 21 28 37 14 responses(%) PAR HumanBoth Not Sure PAR 0 15 30 45 60 20 12 51 17responses(%) GenProg HumanBoth Not Sure 49%
  162. 162. User Study #2: Results GenProg 42 0 10 20 30 40 21 28 37 14 responses(%) PAR HumanBoth Not Sure PAR 0 15 30 45 60 20 12 51 17responses(%) GenProg HumanBoth Not Sure 49% 32%
  163. 163. User Study #2: Results GenProg 42 0 10 20 30 40 21 28 37 14 responses(%) PAR HumanBoth Not Sure PAR 0 15 30 45 60 20 12 51 17responses(%) GenProg HumanBoth Not Sure 49% 32% PAR generates more acceptable patches than GenProg
  164. 164. 43 Limitations • Fix templates are written manually. • But it is one-time cost, these are highly reusable. •We entirely re-implemented GenProg by Java. •All subjects are collected from open source projects. • Some participants may not be thoroughly qualified.
  165. 165. 44 Summary
  166. 166. 44 Summary Observed common patches #patches Patterns
  167. 167. 44 Summary Observed common patches #patches Patterns Fix Templates and PAR if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location
  168. 168. 44 Summary Can fix more bugs with more acceptability Observed common patches #patches Patterns Fix Templates and PAR if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 0 6 12 18 24 30 16 27 0 0.75 1.5 2.25 3 1 1.35 1.7 2.05 2.4 0 10 20 30 40 PAR HumanBoth Not Sure 0 15 30 45 60 GenProg HumanBoth Not Sure 49% 32%
  169. 169. 45 Future Work Automatic Fix Template Identification • More templates can fix more bugs. More Test Cases • More test cases may lead us to better patches.
  170. 170. 46 Acknowledgement •Westley Weimer • Claire Le Goues •Thomas Zimmermann • Christian Bird
  171. 171. 47 Summary Fix Templates and PAR Can fix more bugs with more acceptability Observed common patches #patches Patterns if(lhs == DBL_MRK) lhs = ...; if(lhs == undefined) { lhs = strings[pc + 1]; } Scriptable calleeScope = ...; Buggy Program (a) Fault Localization + - + - + + (b) Template-based Patch Candidate Generation Fail Pass (c) Patch Evaluation T Repaired Fix Template Patch Candidate Repaired Program Fault Location 0 6 12 18 24 30 16 27 0 0.75 1.5 2.25 3 1 1.35 1.7 2.05 2.4 0 10 20 30 40 PAR HumanBoth Not Sure 0 15 30 45 60 GenProg HumanBoth Not Sure 49% 32%

Views

Total views

737

On Slideshare

0

From embeds

0

Number of embeds

2

Actions

Downloads

8

Shares

0

Comments

0

Likes

0

×