Display_Expanded_Type_Structure
This command recursively expands all components of composite types into an indented hierarchy for easy structural understanding and traversal.
The hypertable output displays all component types with the type size if it is statically computable. This can be useful for visualizing the internal structure and memory usage of complex type structures that become highly nested with object-oriented programming techniques.
Note: At present, the locator section of the dialog box for this command has no effect. The Of_Type field at the top of the dialog box identifies the type for which an expanded display should be generated. Use of selection in an Ada window is the best way to fill this field with a valid reference. Name references can also have the form "Package_Name.5D." This references the fifth declaration in the package named Package_Name. Note that use clauses and representation specifications are not counted as declarations, but pragmas are counted. Apex will often use these name references to specify a particular declaration.
Command-Line Interface
Display_Expanded_Type_Structure
-To_Depth [positive-expression, default = 999]
-Expand_Access_Types
-Full_Expansion
-Display_In_Bytes
-Display_In_Words
-Use_Configuration [string-expression, default = ""]
-To_Report_Named [string-expression, default =
<default_output_directory>/type_hierarchy]
-Of_Type [string-expression, default = ""]Nonstandard Parameters
- To_Depth: Determines how many levels of the type hierarchy should be expanded.
- Expand_Access_Types: Specifies that the types referenced by any access type should be expanded in the output.
- Full_Expansion: Specifies whether all types should be fully expanded even if they appear previously in the call hierarchy. This provides better local understanding without the need to follow several references. Only self-referencing types will not fully expand if this parameter is True.
- Display_In_Bytes: Specifies the units in which the output should be displayed. The default is Bits. Values are rounded up to the nearest whole byte.
- Display_In_Words: Specifies the units in which the output should be displayed. The default is Bits. Values are rounded up to the nearest whole word.
- Of_Type: Specifies the pathname of the type for which the expanded hierarchy is desired. The syntax of this pathname follows standard UNIX notation up to the compilation-unit name. Ada dot notation is used to select a specific type declaration within the compilation unit.
Note: Only one of the Display_In_Bytes and Display_In_Words options should be enabled at any one time. If both are present, the last one in the option string takes precedence.
Sample Output
Display_Inter_Subsystem_References
This command displays all inter-subsystem references (that is, library units in one subsystem that with units in other subsystems). For each subsystem in the specified configuration or view list, all references to library units in other subsystems are listed. A second output section provides a list of all referenced units. Each unit is followed by a list of units that reference (that is, with) that unit and the subsystem in which those referencing units are located.
This report shows a cross-referenced list of inter-subsystem dependencies, as specified by with clauses. It can serve as reference material for new developers, testers, managers, or others who are not familiar with the subsystem structure. More importantly, it can reveal architectural anomalies that may have been unintentionally introduced during development or maintenance. These can include undesirable reverse dependencies, from a lower layer (base subsystem) to a higher layer (application subsystem), as well as less severe layer-skipping downward dependencies. Portability issues can also be identified via references to compiler-supplied units that may be unique to the vendor.
Command-Line Interface
Display_Inter_Subsystem_References
-In_Configuration [string-expression, default = ""]
-Sort_Subsystems_In_Dependency_Order
-To_Report_Named [string-expression, default =
<default_output_directory>/inter_subsystem_references]
<list of views>Nonstandard Parameters
- In_Configuration: Specifies the name of the configuration file containing subsystem entries.
- Sort_Subsystems_In_Dependency_Order: Specifies whether subsystem listings should appear in dependency (import relationship) or name order.
- <list of views>: This command accepts a configuration (.cfg) file or list of views as input.
Sample Output
Units Referenced in Other Subsystems
Note: Because of the large number of references, no traversal is enabled for this report. It is primarily intended as reference material.
Units Referencing a Specific Unit
Note: Because of the large number of references, no traversal is enabled for this report. It is primarily intended as reference material.
Display_Set_Twice_Before_Use
This command traverses a subprogram or set of subprograms and identifies local variables that are set twice before they are ever used. A variable can be set in any of the following ways:
- Explicit initialization at point of declaration
- Implicit initialization through default initialization of record types
- Assignment
- Use as an out parameter in a procedure call
An uninitialized variable is a program error that is very difficult to find. Multiple initialization of a variable before its value is used can increase code size and execution time. This command will locate areas where these inefficiencies can be reduced. The Display_Set_Use_Problems command should be used in conjunction with this command to locate variables that are used before they are set.
Command-Line Interface
Display_Set_Twice_Before_Use
-Track_All_Record_Components
-Include_All_Path_Violations
-Use_Configuration [string-expression, default = ""]
-To_Report_Named [string-expression, default =
<default_output_directory>/set_twice_before_use_analysis]
<list of units>Nonstandard Parameters
- The Track_All_Record_Components: Specifies whether to track all components of record objects even if they are not referenced in the body of the Ada code. If a record object is only partially set with specific component assignments, use of this option will identify which components were not set when the entire record object is used.
- The Include_All_Path_Violations: Specifies whether to expand the report to list all execution paths on which a variable is used before set. Disabling this option will report only the first path where the problem occurred.
Sample Output
The output on the previous page was generated from the following input program:
procedure Set_Twice_Variables is type Rec_With_Init is record A : Integer := 9; B : Boolean; end record; type Rec_No_Init is record A : Integer; end record; B : Boolean; Var1 : Integer; Var2 : Integer; Var3 : Integer := 6; Var4 : Rec_No_Init; Var5 : Rec_With_Init; Var6 : Rec_With_Init; procedure P (A : out Integer) is begin null; end P; begin if B then Var1 := 8; -- no problem Var2 := 6; P (Var2); -- problem else Var3 := 8; -- problem Var4.A := 8; -- no problem Var5.A := 9; -- problem Var5.B := True; -- no problem Var4.A := 88; -- problem P (Var6.A); -- problem end if; end Set_Twice_Variables;Display_Set_Use_Problems
This command traverses a subprogram or set of subprograms and identifies the following potential problems:
- Variables that are used before they are set on a particular path
- Access variables that are de-referenced before they are set to a non-null value on a particular path
- Out parameters that are not set along a particular path
Uninitialized variables are one of the most difficult program errors to locate. When they occur in fielded systems, they are even more difficult to isolate. This command locates such variables using a program-interpretation technique to walk all paths and account for each variable read and updated along that path.
Command-Line Interface
Display_Set_Use_Problems
-Include_In_Out_Parameters
-Track_All_Record_Components
-Include_All_Path_Violations
-Use_Configuration [string-expression, default = ""]
-To_Report_Named [string-expression, default =
<default_output_directory>/set_use_problem_analysis]
<list of units>Nonstandard Parameters
- Include_In_Out_Parameters: Specifies whether to include parameters of mode in out in the report of out parameters not set along a path.
Note: An in out parameter that is not set does not necessarily indicate a problem with the code.
- The Track_All_Record_Components: Specifies whether to track all components of record objects even if they are not referenced in the body of the Ada code. If a record object is only partially set with specific component assignments, use of this option will identify which components were not set when the entire record object is used.
- The Include_All_Path_Violations: Specifies whether to expand the report to list all execution paths on which a variable is used before set. Disabling this option will report only the first path where the problem occurred.
Sample Output
The output on the previous page was generated from the following program:
An_Exception_1 : exception; An_Exception_2 : exception; type Rec_1 is record Bool_1 : Boolean := True; end record; type Rec_2 is record Bool_2 : Boolean; end record; type Acc is access Rec_2;
procedure Proc (B : out Character; Bool : in out Boolean) is Local_A : Integer := 7; Local_B, New_C : Character; R1 : Rec_1; R2 : Rec_2; An_Acc : Acc; Int : Integer; begin if An_Acc = null then if Local_A = Int then Local_B := '6'; B := '7'; if Local_B = New_C then raise An_Exception_1; else Bool := True; raise An_Exception_2; end if; elsif Local_B = New_C then if R1.Bool_1 then B := '9'; elsif R2.Bool_2 then while Bool = False loop B := 'h'; end loop; end if; end if; end if; exception when An_Exception_1 => null; end Proc;Display_Subprogram_Branch_Points
This command locates all branch points in a subprogram or set of subprograms. A branch point is a case, if, exit, loop, return, or raise statement. The output is presented in indented form to show nesting of branch points.
This output can help in the construction of coverage tests. The branching information can be used to locate each path and the set/used information can be used to understand the input variables for each path and the items updated along that path.
Command-Line Interface
Display_Subprogram_Branch_Points
-Expanded_Output
-Include_Value_Ranges
-Use_Configuration [string-expression, default = ""]
-To_Report_Named [string-expression, default =
<default_output_directory>/branching_analysis]
-In_Unit_Or_Subprogram [string-expression, default = ""]
Nonstandard Parameters
- Expanded_Output: Expands the conditions necessary to execute a path into a vertical format (see sample output on next page) and explicitly lists each set and use along a path.
- Include_Value_Ranges: Specifies the inclusion in the output of value ranges required to make each conditional expression along the path true.
- In_Unit_Or_Subprogram: Specifies the name of the subprogram to analyze or the name of the unit within which to analyze all subprograms.
Sample Output
Expanded Format
Display_Subprogram_Execution_Problems
This command traverses a subprogram or set of subprograms and identifies the following potential problems:
- Functions that have no return statement along a particular path
- The raising of nonvisible exceptions that will propagate out of the subprogram along a particular path
Functions with no return statement on each path may not be caught during testing and therefore can be a very costly bug in fielded systems. The use of nonvisible exceptions is not a bug and may even be the best implementation strategy in some cases, but it can be high risk to future maintenance and update efforts.
Command-Line Interface
Display_Subprogram_Execution_Problems
-Use_Configuration [string-expression, default = ""]
-To_Report_Named [string-expression, default =
<default_output_directory>/subprogram_execution_problem_analysis]
<list of units>Nonstandard Parameters
All parameters are standard parameters.
Sample Output
Nonvisible Exception Raise
Note: The above output was generated from the input program example for the Display_Set_Use_Problems command.
Return Not Found on Path
Note: The output in this table was generated from the input program example given for the Display_Set_Twice_Before_Use command.
Display_Subsystem_Import_Closure
This command displays the complete import closure of all subsystems in a configuration or view. The importing structure is displayed in an indented hierarchy with all imports listed for each view in the configuration. Output is sorted into a hierarchy with the topmost subsystems in the import closure at the beginning (top) of the output. All views are placed in a hypertable for easy location and traversal.
Command-Line Interface
Display_Subsystem_Import_Closure -Full_Expansion
-To_Report_Named [string-expression, default =
<default_output_directory>/subsystem_import_expansion]
<list of views>Nonstandard Parameters
- Full_Expansion: Specifies whether views that appear more than once in the hierarchy should be fully expanded inline or listed with a reference to the previous expansion.
- <list of views>: This command accepts a configuration (.cfg) file or view as input.
Sample Output
Display_Unit_Construct_Counts
This command generates hypertables containing counts of various Ada constructs that appear in the specified set of units. The following major constructs are counted:
- Declarations
- Statements
- Pragmas
- Context clauses
- Representation clauses
Within the major classes, the following subclasses of Ada constructs are counted:
- Compilation-unit kinds
- Parameter modes
- Generic-parameter modes
- Representation-clause kinds
- Length-clause kinds
- Loop kinds
- Select-alternative kinds
- Expression kinds
- Type-definition kinds
The Display_Unit_Construct_Counts procedure counts each selected construct in each unit and displays unit counts in rows of the output table.
This command can be used to profile software and recognize patterns in the development constructs used most frequently in the project.
Command-Line Interface
Display_Unit_Construct_Counts
-Include_Unit_Totals
-Display_Totals_Only
-Include_Major_Element_Counts
-Include_Comp_Unit_Kind_Counts
-Include_Declaration_Kind_Counts
-Include_Statement_Kind_Counts
-Include_Pragma_Kind_Counts
-Include_Context_Clause_Kind_Counts
-Include_Rep_Clause_Kind_Counts
-Include_Length_Clause_Kind_Counts
-Include_Parameter_Mode_Counts
-Include_Generic_Parameter_Mode_Counts
-Include_Loop_Kind_Counts
-Include_Select_Alternative_Kind_Counts
-Include_Expression_Kind_Counts
-Include_Type_Definition_Kind_Counts
-Use_Configuration [string-expression, default = ""]
-To_Report_Named [string-expression, default =
<default_output_directory>/unit_construct_counts]
<list of units>Nonstandard Parameters
- Include_Unit_Totals: Specifies whether to include summary tables of counts for all constructs in all units.
- Display_Totals_Only: Specifies that only summary totals be included and not counts for each individual unit.
- Include_*: Specifies whether to include counts for the * kind of construct.
Sample Output
Note: Because of the high volume of information in these reports, no traversal connections are included.
Display_Unit_Declarations
This command displays the declarations of an Ada unit but filters out the clutter that is often associated with full code. Declarations are presented in a hierarchical format similar to the code itself. Comments, blank lines, and other extraneous details are not included. This provides a high-level representation of code that is easy to scan for overall structure. Traversal to the actual code is always available when more detail is necessary. Use clauses, pragmas, and representation specifications can be included by selecting command options. Additional abbreviated information about each declaration is provided in other columns of the report.
Subprogram and task bodies can also be expanded with the Expand_Bodies option. This will display the overall structure of the bodies including all local and nested declarations, exception handlers, and all accept statements in the case of tasks.
The output provides a condensed view of a unit or set of units. This can be very useful to get an overview of a unit's definition. Traversal is available to the code to see more detail or associated comments.
Command-Line Interface
Display_Unit_Declarations
-To_Depth [positive-expression, default = 999]
-Include_Pragmas
-Include_Rep_Specs
-Include_Use_Clauses
-Expand_Bodies
-Verbose
-Use_Configuration [string-expression, default = ""]
-To_Report_Named [string-expression, default =
<default_output_directory>/unit_declarations]
<list of units>Nonstandard Parameters
- To_Depth: Determines how many declaration nesting levels should be displayed.
- Include_Pragmas: Specifies whether or not to include pragmas in report.
- Include_Rep_Specs: Specifies whether or not to include representation specifications in report.
- Include_Use_Clauses: Specifies whether or not to include use clauses in report.
- Expand_Bodies: Specifies whether or not to expand subprogram, entry, and task bodies to display local declarations, exception handlers, and accept statements (task bodies only).
- Verbose: Specifies whether to add additional detail about listed declarations.
Sample Output
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2000, Rational Software Corporation. All rights reserved. |