Book contents
- Frontmatter
- Contents
- Preface
- 1 Introduction
- 2 State constraints
- 3 Subprogram simplification
- 4 Program set
- 5 Pathwise decomposition
- 6 Tautological constraints
- 7 Program recomposition
- 8 Discussion
- 9 Automatic generation of symbolic traces
- Appendix A Examples
- Appendix B Logico-mathematical background
- References
- Index
Appendix A - Examples
Published online by Cambridge University Press: 03 September 2009
- Frontmatter
- Contents
- Preface
- 1 Introduction
- 2 State constraints
- 3 Subprogram simplification
- 4 Program set
- 5 Pathwise decomposition
- 6 Tautological constraints
- 7 Program recomposition
- 8 Discussion
- 9 Automatic generation of symbolic traces
- Appendix A Examples
- Appendix B Logico-mathematical background
- References
- Index
Summary
Presented in this appendix are four examples showing in various degrees of detail how the present method can be applied to programs written in C++.
Example A.1 shows how to insert constraints into a program to form a subprogram representing an execution path. It also shows how the rules developed in Chapter 3 can be used to simplify the subprogram to the extent possible.
Example A.2 shows that the present method is not only applicable to an execution path but also to the one that includes a loop construct as well. The analysis is done for all possible execution paths in the program, and thus the result constitutes a direct proof of the correctness.
The program in Example A.3 is adopted from a legacy software tool. A portion of this program (printed in boldface type) is difficult to understand. When the present method was used to analyze that part of the program, it was found that it consists of only nine feasible execution paths, despite of the fact that it contains three “for” loops and six “if” statements. Furthermore, it was found that all the path subprograms can be greatly simplified to explicate the function of the program.
The program in Example A.4 is a stack class. It is used to illustrate how the present method can be applied to an object-oriented program.
- Type
- Chapter
- Information
- Path-Oriented Program Analysis , pp. 109 - 168Publisher: Cambridge University PressPrint publication year: 2007