1 / 25

Analysis and Testing of Programs with Exception-Handling Constructs

Analysis and Testing of Programs with Exception-Handling Constructs. Saurabh Sinha and Jean Harrold. Sookmyung Women ’ s Univ. PSLAB Ohe, hee jeong. 1. Introduction. Motivation

pmaloof
Download Presentation

Analysis and Testing of Programs with Exception-Handling Constructs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Analysis and Testing of Programs with Exception-Handling Constructs Saurabh Sinha and Jean Harrold Sookmyung Women’s Univ. PSLAB Ohe, hee jeong

  2. 1. Introduction • Motivation • Many software-engineering tasks require information about the control flow, control dependence, and data dependence among statements in a program • analysis techniques should account for the effects of exception-handling constructs • Contribution • Effects of exception-handling constructs on several analysis • Control flow analysis • Control dependency analysis

  3. 2. Exception in Java • Exception is an object • derived from the class java.lang.Throwable • Throw statement • variable, method call, new instance expression • Exception criteria • Non-resumable model of exception handing • A java exception can be propagated up on the call stack

  4. 3. Effects of Exception-handling Constructs on Analysis Techniques

  5. Exception-handling constructs • Belong to a class of structure that cause arbitrary interprocedural control flow • Interprocedural contorl • Jump statement, halt statement • Common effect • Control may not return from the called procedure back to the call site • Affect the flow of control across procedure

  6. 3.1 The Vending-Machine program

  7. 3.2 Effects of Exception on analysis techniques • Control flow analysis • incorporate the exception-induced control flow • influence control flow not only within a method, but across methods • Data flow analysis • Definition-use pair may not be detected the pair • Exception-handling constructs introduce additional definition-use pairs in a program through the exception object. • Data dependence analysis • Consider the presence of potentially non-returning call site (PNRCs) • Necessitate the computation of interprocedural control dependence

  8. 4. Analysis Techniques to Accommodate Exception-Handling Constructs

  9. 4. 1 Control-Flow Analysis • Control flow analysis • exception-handling constructs • The intraprocedural control-flow • The interprocedural control-flow

  10. 4.1.1 Intraprocedural analysis <Intraprocedure control flow in java exception-handling constructs>

  11. 4. 1.1 Intraprocedural analysis

  12. 4.1.1 Intraprocedural analysis

  13. 4.1.2 Interprocedural analysis • Interprocedural control-flow graph • Program P consists of CFGs for each method or procedure in P • call node--->connected to the entry node of the called method by a call edge • exit node ---> connected to the corresponding return node by a return edge

  14. 4.1.2 Interprocedural analysis

  15. 4.1.2 Interprocedural analysis

  16. 4.1.3 Type inferencing for exception types • The CFG construction requires information about exception types that can be raised at throw statements. • Recent work uses points-to analysis to infer types in programs that contain exception-handling constructs • Only consider the variables or method call

  17. 4.1.3 Type inferencing for exception types • Four inexpensive approaches • Conservative approximation • Intraprocedural flow-sensitive analysis • Interprocedural flow-insensitive analysis • Combination of the intraprocedural flow-sensitive and the interprocedural flow-insensitive analysis

  18. 4.2 Control-Dependence Analysis • The interprocedural control-dependence algorithm computes statement-based control dependences without constructing an IIFG • Phase 1 • identifies PNRCs that are caused by throw statement and halt statement • Uses this information to compute partial control dependences • Phase 2 • Use partial control dependences to compute statement-based interprocedural control dependences

  19. 4.2.1 Computation of partial control dependency • Phase 1 : identifies call sites that are PNRCs Step1 : for each call site, computes the set of nodes to which control can return following the call site Step 2 : constructs an augmented control-flow graph that summarized the effects of external control dependences on statements in a method.

  20. 4.2.1 Computation of partial control dependency • Partial control dependence • Intraprocedural control dependences that are computed by applying a traditional technique for computing control dependence to the ACFG • The partial control dependences for nodes that are control dependent on predicates in called methods contain a return-predicate node

  21. 4.2.1 Computation of partial control dependency

  22. 4.2.2 computation of interprocedural control dependences • Partial control dependences • Contain placeholder nodes-representing entry or return predicates-must be adjusted • To compute interprocedural control dependences, phase 2 constructs an interprocedural representation of the program by connecting the ACFGs using call, return, and exceptional-return edges

  23. 4.2.2 computation of interprocedural control dependences

More Related