program slicing with exception handling
play

Program slicing with exception handling Carlos S. Galindo Jim enez - PowerPoint PPT Presentation

Introduction Problems and proposals Conclusions Program slicing with exception handling Carlos S. Galindo Jim enez Universidad Polit ecnica de Valencia Dec 18th, 2019 Introduction Problems and proposals Conclusions Table of Contents


  1. Introduction Problems and proposals Conclusions Program slicing with exception handling Carlos S. Galindo Jim´ enez Universidad Polit´ ecnica de Valencia Dec 18th, 2019

  2. Introduction Problems and proposals Conclusions Table of Contents Introduction Program slicing The System Dependence Graph Exception handling Problems and proposals Problem 1: incorrect slices with nested unconditional jumps Problem 2: incorrect weak slices Problem 3: incomplete catch treatment Conclusions 2/21

  3. Introduction Problems and proposals Conclusions Overview Introduction Program slicing The System Dependence Graph Exception handling Problems and proposals Conclusions 3/21

  4. Introduction Problems and proposals Conclusions Program slicing 1 void f(int x) { 1 void f(int x) { int sum = 0; int sum = 0; 2 2 int prod = 0; int prod = 0; 3 3 while (x > 0) { while (x > 0) { 4 4 sum += x; sum += x; 5 5 prod *= x; prod *= x; 6 6 x--; x--; 7 7 } } 8 8 log("sum: " + sum); log("sum: " + sum); 9 9 log(" prod: " + prod); log(" prod: " + prod); 10 10 11 } 11 } Example adapted from [Tip95]. 4/21

  5. Introduction Problems and proposals Conclusions Program slicing 1 void f(int x) { 1 void f(int x) { int sum = 0; int sum = 0; 2 2 int prod = 0; int prod = 0; 3 3 while (x > 0) { while (x > 0) { 4 4 sum += x; sum += x; 5 5 prod *= x; prod *= x; 6 6 x--; x--; 7 7 } } 8 8 log("sum: " + sum); log("sum: " + sum); 9 9 log(" prod: " + prod); log(" prod: " + prod); 10 10 11 } 11 } Example adapted from [Tip95]. 4/21

  6. Introduction Problems and proposals Conclusions Program slicing 1 void f(int x) { 1 void f(int x) { int sum = 0; int sum = 0; 2 2 int prod = 0; int prod = 0; 3 3 while (x > 0) { while (x > 0) { 4 4 sum += x; sum += x; 5 5 prod *= x; prod *= x; 6 6 x--; x--; 7 7 } } 8 8 log("sum: " + sum); log("sum: " + sum); 9 9 log(" prod: " + prod); log(" prod: " + prod); 10 10 11 } 11 } Example adapted from [Tip95]. 4/21

  7. Introduction Problems and proposals Conclusions Program slicing 1 void f(int x) { 1 void f(int x) { int sum = 0; int sum = 0; 2 2 int prod = 0; int prod = 0; 3 3 while (x > 0) { while (x > 0) { 4 4 sum += x; sum += x; 5 5 prod *= x; prod *= x; 6 6 x--; x--; 7 7 } } 8 8 log("sum: " + sum); log("sum: " + sum); 9 9 log(" prod: " + prod); log(" prod: " + prod); 10 10 11 } 11 } Example adapted from [Tip95]. 4/21

  8. Introduction Problems and proposals Conclusions Program slicing Applications 1 void f(int x) { int sum = 0; 2 ◮ Debugging int prod = 0; 3 ◮ Program specialization while (x > 0) { 4 sum += x; 5 ◮ Software maintenance prod *= x; 6 ◮ Code obfuscation x--; 7 } ◮ Dead code removal 8 log("sum: " + sum); 9 ◮ Program parallelization log(" prod: " + prod); 10 11 } 5/21

  9. Introduction Problems and proposals Conclusions Program slicing Metrics Completeness. The slice includes all instructions that are necessary. Correctness. The statements included affect the slicing criterion. Correct and Correct and Incorrect and Incorrect and complete: incomplete: complete: incomplete: 6/21

  10. Introduction Problems and proposals Conclusions Program slicing Metrics Completeness. The slice includes all instructions that are necessary. Correctness. The statements included affect the slicing criterion. Correct and Correct and Incorrect and Incorrect and complete: incomplete: complete: incomplete: 6/21

  11. Introduction Problems and proposals Conclusions Program slicing Metrics Completeness. The slice includes all instructions that are necessary. Correctness. The statements included affect the slicing criterion. Correct and Correct and Incorrect and Incorrect and complete: incomplete: complete: incomplete: 6/21

  12. Introduction Problems and proposals Conclusions Program slicing Metrics Completeness. The slice includes all instructions that are necessary. Correctness. The statements included affect the slicing criterion. Correct and Correct and Incorrect and Incorrect and complete: incomplete: complete: incomplete: 6/21

  13. Introduction Problems and proposals Conclusions Program slicing Metrics Completeness. The slice includes all instructions that are necessary. Correctness. The statements included affect the slicing criterion. Correct and Correct and Incorrect and Incorrect and complete: incomplete: complete: incomplete: 6/21

  14. Introduction Problems and proposals Conclusions Program slicing Metrics Completeness. The slice includes all instructions that are necessary. Correctness. The statements included affect the slicing criterion. Correct and Correct and Incorrect and Incorrect and complete: incomplete: complete: incomplete: 6/21

  15. Introduction Problems and proposals Conclusions The System Dependence Graph Creation 1 void f(int x) { int sum = 0; 2 int prod = 0; 3 while (x >0) { 4 sum += sum; 5 prod *= prod; 6 x--; 7 } 8 log(sum); 9 log(prod); 10 11 } 7/21

  16. Introduction Problems and proposals Conclusions The System Dependence Graph Creation Enter f() 1 void f(int x) { int sum = 0; 2 int prod = 0; 3 while (x >0) { 4 sum += sum; 5 prod *= prod; 6 2: int sum = 0 3: int prod = 0 4: while (x > 0) 9: log("sum: " + sum) 10: log("prod: " + prod) x--; 7 } 8 log(sum); 9 5: sum += sum 6: prod *= prod 7: x-- log(prod); 10 11 } 7/21

  17. Introduction Problems and proposals Conclusions The System Dependence Graph Creation 1 void f(int x) { Enter f() int sum = 0; 2 int prod = 0; 3 while (x >0) { 4 sum += sum; 5 prod *= prod; 6 2: int sum = 0 3: int prod = 0 4: while (x > 0) 9: log("sum: " + sum) 10: log("prod: " + prod) x--; 7 } 8 log(sum); 9 5: sum += sum 6: prod *= prod 7: x-- log(prod); 10 11 } 7/21

  18. Introduction Problems and proposals Conclusions The System Dependence Graph Creation 1 void f(int x) { Enter f() int sum = 0; 2 int prod = 0; 3 x = x_in while (x >0) { 4 sum += sum; 5 prod *= prod; 6 2: int sum = 0 3: int prod = 0 4: while (x > 0) 9: log("sum: " + sum) 10: log("prod: " + prod) x--; 7 } 8 log(sum); 9 5: sum += sum 6: prod *= prod 7: x-- log(prod); 10 11 } 7/21

  19. Introduction Problems and proposals Conclusions The System Dependence Graph Creation 1 void f(int x) { Enter f() int sum = 0; 2 int prod = 0; 3 x = x_in while (x >0) { 4 sum += sum; 5 prod *= prod; 6 2: int sum = 0 3: int prod = 0 4: while (x > 0) 9: log("sum: " + sum) 10: log("prod: " + prod) x--; 7 } 8 log(sum); 9 5: sum += sum 6: prod *= prod 7: x-- log(prod); 10 11 } 7/21

  20. Introduction Problems and proposals Conclusions The System Dependence Graph Creation 1 void f(int x) { Enter f() int sum = 0; 2 int prod = 0; 3 x = x_in while (x >0) { 4 sum += sum; 5 prod *= prod; 6 2: int sum = 0 3: int prod = 0 4: while (x > 0) 9: log("sum: " + sum) 10: log("prod: " + prod) x--; 7 } 8 log(sum); 9 5: sum += sum 6: prod *= prod 7: x-- log(prod); 10 11 } 7/21

  21. Introduction Problems and proposals Conclusions The System Dependence Graph Creation 1 void f(int x) { Enter f() int sum = 0; 2 int prod = 0; 3 while (x >0) { 4 x = x_in sum += sum; 5 prod *= prod; 6 x--; 7 2: int sum = 0 3: int prod = 0 4: while (x > 0) 9: log("sum: " + sum) 10: log("prod: " + prod) } 8 log(sum); 9 log(prod); 10 5: sum += sum 6: prod *= prod 7: x-- 11 } 7/21

  22. Introduction Problems and proposals Conclusions The System Dependence Graph Traversal 1 void f(int x) { Enter f() int sum = 0; 2 int prod = 0; 3 x = x_in while (x>0) { 4 sum += sum; 5 prod*=prod; 6 2: int sum = 0 3: int prod = 0 4: while (x > 0) 9: log("sum: " + sum) 10: log("prod: " + prod) x--; 7 } 8 log(sum); 9 5: sum += sum 6: prod *= prod 7: x-- log(prod); 10 11 } 8/21

  23. Introduction Problems and proposals Conclusions The System Dependence Graph Traversal 1 void f(int x) { Enter f() int sum = 0; 2 int prod = 0; 3 x = x_in while (x>0) { 4 sum += sum; 5 prod*=prod; 6 2: int sum = 0 3: int prod = 0 4: while (x > 0) 9: log("sum: " + sum) 10: log("prod: " + prod) x--; 7 } 8 log(sum); 9 5: sum += sum 6: prod *= prod 7: x-- log(prod); 10 11 } 8/21

  24. Introduction Problems and proposals Conclusions The System Dependence Graph Traversal 1 void f(int x) { Enter f() int sum = 0; 2 int prod = 0; 3 x = x_in while (x>0) { 4 sum += sum; 5 prod*=prod; 6 2: int sum = 0 3: int prod = 0 4: while (x > 0) 9: log("sum: " + sum) 10: log("prod: " + prod) x--; 7 } 8 log(sum); 9 5: sum += sum 6: prod *= prod 7: x-- log(prod); 10 11 } 8/21

Recommend


More recommend