Ada Analyzer

Technical Specification

The Ada Analyzer is a set of support tools that can scan large amounts of Ada code, locating items of interest and cataloging information for developers, managers, quality-assurance personnel, and integration and testing personnel. The key benefits of these tools are: The Ada Analyzer traverses any set of compiled Ada units (either Ada 83 or Ada 95), locates constructs that match specific selection criteria, and places relevant information about those constructs in a hypertable object. Hypertables contain not only textual information about each construct located, but also traversal connections to the actual Ada source from which the information was derived. Users thus can scan the summary information for interesting items and then traverse to the actual software for additional detailed analysis. Sorting options and additional filtering switches are available to organize information into the optimal format for analysis.

The Ada Analyzer does not attempt to rate software with numbers or judge construct usage as good or bad. Instead, it collects overview information so that analysts can better understand the content of their software and make decisions about possible improvements. It provides insight rather than value judgment. The resulting tables can be included in documentation, printed and distributed to developers or managers for reference, or used interactively to visit software constructs for further inspection or repair.

The following diagram illustrates how the Ada Analyzer facilitates interactive analysis.

Interactive Analysis Diagram

Supported Analysis Objectives

The Ada Analyzer supports specific analysis objectives. For example, if the objective is to improve execution speed and reduce code size, a set of recommended analysis procedures is available with insight into how the output can be used to achieve specific improvements. The tools support the following analysis objectives: Each of these objectives will be explained in more detail with specific selection criteria later in this document.

Usage Scenarios

The Ada Analyzer can be used throughout the development lifecycle by a variety of project personnel, each having different analysis objectives.

Customization

An important aspect of the Ada Analyzer is it is easily modifiable to support local requirements. Local development specifications and cross-compilation tools often make it necessary to build custom analysis tools that better match local needs. Several templates are available to make building new locator tools, standards conformance checks, and metrics as simple as possible. The templates handle all traversal, sorting, and table building. The user must define only which Ada constructs should be included and what information for that element should appear in the hypertable output. An extensive library of utilities is available to assist in this process. For all but the most complicated requirements, this process will take approximately one day to develop and test.

Delivered Software

All software for the Ada Analyzer is included with each release. Ada interfaces are annotated with descriptions of the purpose and use of each interface, the testing performed on the interface, and additional keywords to help in cross-referencing. Parameter explanations have been added where necessary as well as a list of all exceptions raised by each subprogram. Implementation software (bodies) are commented with effective information about implementation strategy and approach. Almost all packages have corresponding test procedures that generate consistent reports on the success or failure of the test criteria. Test programs not only verify tool correct-ness but also serve as an example of use and expected output.

The software will be delivered in two layers. The utilities (lower) layer will be delivered in code-only form with Ada specifications; the analysis layer will be delivered in source form to facilitate local customizations and extensions.

Documentation

In addition to annotated software, a complete Ada Analyzer User's Guide is available both as hard copy and on-line This document provides a tutorial on the general use of all tools and hypertable output. It describes each analysis objective and explains which tools can be used effectively to accomplish each objective. The content of all hypertable output is fully explained with information on how to interpret it to achieve the objective. An extensive cross-reference section and index are included to enable users to find tools when they have specific analysis requirements in mind.

A separate section of this document describes in detail how to customize existing analysis tools or build new ones. It provides a step-by-step method for each process. Some sorting, filtering, and information content can be adjusted by policy switches contained in files. An explanation of all options and the editing of these policy switches and files is provided.

Ada 95 Support

The Ada Analyzer can analyze code compiled either with the Apex Ada83 or Ada 85 compilers. All commands recognize Ada 95 constructs and incorporate them into report output when appropriate. In particular, the following commands specifically address Ada95 constructs.

Detailed Analysis Descriptions

Software quality can be measured in many dimensions, including correctness, efficiency, portability, maintainability, readability, and adherence to development standards. Soft-ware quality can be evaluated to determine its status or *goodness? measured against specific criteria or it can be analyzed with the objective of locating areas for improvement. Both objectives are supported by the Ada Analyzer tools, but much greater emphasis is placed on the analysis objectives. The following sections provide details on how the analysis objectives listed above can be achieved.

Design and Structure

The high-level structure of a program is often difficult to see when looking through each individual package. Graphical representations of software are extremely effective when the number of structures is small, but they often are not effective in representing large programs with many individual items and relationships. The following analysis objectives are supported by the tools. Output from these tools offers additional help in understanding the design structure of a program.

Code Correctness

Code correctness clearly is one of the most important goals in programming. Since programs often are very complicated, it is all but impossible to avoid making programming mistakes. Although it is equally impossible to judge whether a program construct is correct, constructs with a high likelihood for error can be located for further inspection. The following locator tools can be used to find potential problems with code correctness:

Code Efficiency

Software efficiency certainly is negatively affected by the selection of inappropriate implementation algorithms. Such problems are identified most effectively through code reviews and are difficult to detect statically with tools. It is possible, however, to identify constructs that either generate large amounts of code or execute more slowly. Often it is also possible to locate redundancy in software as well as places where compiler directives such as pragma Inline or pragma Pack would positively or negatively affect software efficiency. Many efficiency issues are related directly to the cross-compiler's ability to generate efficient code for the target. When areas of compiler inefficiency are identified, Ada constructs that affect the resulting efficiency of the software also can be identified. Location of any kind of declaration, statement, or expression (If the compiler has difficulty with specific constructs, all usages can be quickly located and checked with the generated assembly code).

Conformance to Programming Standards and Readability

Almost every project has a set of programming guidelines if only to try to achieve some consistency across the software. Sometimes these criteria are a fairly strict set of rules that must not be violated without explanation. Tools can be used to locate violations of these standards. Specific readability analysis is also provided. See the sections titled "Standards Conformance Libraries" at the end of this document for a complete list of all checks.

Portability and Compatibility

Software developed on the Rational Environment is almost always cross-compiled for another target. Maintaining software that is compatible with the target-dependent-feature support of the cross-compiler can be performed in part with semantic checking built into the compiler. Most projects have more stringent portability requirements than can be checked with compiler tools, however. Additional compatibility checking can be performed with the following tools: One key benefit of this analysis is the identification of software incompatibilities before the effort is made to download and compile the software on the target.

Software Content

These tools offer no particular objective but can be used to support any of the above analysis objectives:
Tasking
Generics
Subprogram data reference
Exceptions
Types
Annotations

Summary

The Ada Analyzer allows users to analyze software rapidly from a variety of perspectives to better understand the content of their software systems. During development and maintenance phases of the software lifecycle, the tools can continually summarize expanding interfaces and use of key constructs, and they can gauge progress toward completion. Projects in the later stages of development can use the tools to reduce code size and improve execution speed. Testers can better understand the relationship between the software modules and benefit from call-tree and subprogram-path (branching) analysis. Maintenance projects can use similar features to get a quick over-view of the software they are asked to update. Finally, the Ada Analyzer tools can assist developers and QA personnel in assessing the quality of Ada software or its conformance to required standards

Sample Output

The following screen images provide two examples of output tables generated by the Ada Analyzer. The first example displays a hypertable containing Ada with clauses that are not used or are used incorrectly in the analyzed software. The first two columns contain the name of the subsystem and library unit in which the problem occurs. The third column contains the name of the unit withed by the suspect with clause, and the fourth column contains a description of the problem. Four different kinds of potential problems are recognized:
Table 1 - Unused and Misplaced "with" Clauses
Unit
Unused "with"
Status
Unused_With_Clauses'B Representation_Clauses Unused
Unused_With_Clauses'S Ada_Program Movable to body
Unused_With_Clauses'S Compilation_Units  Used only for use/rena|
Unused_With_Clauses'S Names_And_Expressions Unused
Unused_With_Clauses'S Type_Information Repeat "with"
Unused_With_Clauses'S Type_Information Used only for use/rena|
Unused_With_Clauses.Subun| Declarations Repeat "with"
Unused_With_Clauses.Subun| Declarations Unused
Unused_With_Clauses.Subun| What Repeat "with"
 
The next sample output collects all exception declarations, handlers, and raise statements into a single hypertable. The first two columns contain the name of the exception and kind of use. The third column specifies whether the exception appears in a visible specification. The table columns are sorted to highlight which handlers and raise statements exist for each exception declaration and where these constructs are located. Declarations without handlers and/or raise statements might indicate a potential problem. Use of predefined exceptions or anonymous raises also may be of interest as well as raises via the Ada 95 Ada.Exceptions.Raise_Exception interface.
 
Table 1 - Exception Declarations, Handlers, and Raise Statements
Exception
This Usage
Context
Unit
ANONYMOUS< Raise Proc body Some_Exceptions'B
Except1 Decl Pkg spec Some_Exceptions'S
Except1 Handler  Proc body Some_Exceptions'B
Except1 Raise  Proc body Some_Exceptions'B
Except2 Decl Pkg spec Some_Exceptions'S
Except2 Handler  Proc body  Some_Exceptions'B
Except2 Raise  Proc body Some_Exceptions'B
Except4 Decl Proc body Some_Exceptions'B
Except4 Handler Proc body Some_Exceptions'B
Exception3 Decl Pkg spec  Some_Exceptions'S
Exception3 Handler Proc body Some_Exceptions'B
Exception3 Rename Excep rename Some_Exceptions'S
via Raise Exception Unknown raise Func body Ada95_Exceptions'B

Ada Analyzer Commands

Code_Correctness

Design_And_System_Structure

Execution_Analysis

Metrics_Collection

Readability

Report_Management

Software_Complexity

Software_Content

Software_Optimization

Standards_Conformance

Standards Conformance and Compatibility Rule Libraries

This section lists all currently supported rules for checking the conformance of Ada software to quality standards and guidelines. These checks are grouped into four separate rule libraries:
 

Software Productivity Consortium's Guidelines:

Little Tree Consulting's Software-Quality Guidelines:

For Rational Target Compatibility

For Code Correctness:

For Maintainability:

For Efficiency:

For Readability:

For Portability:

For Program Structure:

For Program Format:

Ada 95 Rules:

Real Time Restrictions (Annex D):

Safety and Security Restrictions (Annex H):

Spark Ada Subset Restrictions:

Metrics:


products
ada analyzer data sheet | ada analyzer pdf (3.4 meg)
ada analyzer/ ada repair training | ada type interchange generator (ATIG) | ada repair
little tree home | about little tree | technical articles | email