Program Analysis and Debugging |
5 |
![]() |
-Xlistx also can be used to make detailed source code listings and cross-reference tables.
Note - Although a subset of-Xlistoptions are available with this release (1.2) of f90, a conventional cross-reference map is produced but global program checking is not performed; full checking will appear in a subsequent release of the f90 compiler.
Example: Compile three files for basic global program checking:
demo% f77 -Xlist any1.f any2.f any3.f |
In the preceding example, the compiler:
Example: Display to terminal:
demo% f77 -Xlisto /dev/tty any1.f |
Default Output Features
The -Xlist option provides a combination of features available for output. With no other -Xlist options, you get the following by default:
demo% f77 -Xlistfln/tmp *.f |
Libraries compiled with
-Xlist options have their analysis files built into the binary files automatically, enabling GPC over programs that link these libraries. Some Examples of
Source code used in the following examples, Repeat.f: -Xlist and Global Program Checking
Compiling the same program with
-Xlist also produces a cross-reference table:
Output file: f77 -Xlist Repeat.f (Continued)
In the cross-reference table in the preceding example:
Described below are options for producing the listing, errors, and cross- reference table. Multiple suboptions may appear on the command line.
demo% f77 -Xlistc -Xlist any.f |
demo% f77 -Xlistc any.f |
Here is a summary of all -Xlist suboptions:
-Xlist Suboption Reference
-Xlistc
Show call graphs (and cross-routine errors).
-XlistE
Show cross-routine errors.
-Xlisterr[nnn]
Suppress error nnn in the verification report.
-Xlistf
For faster output, produce source file listings and cross-checking and verify
sources, but do not generate object files.
-Xlistflndir
Put the .fln files into the dir directory, which must already exist.
-Xlisth
Halt the compilation if errors are detected while cross-checking the program. In
this case, the report is redirected to stdout instead of the *.lst file.
-XlistI
List and cross-check include files.
This suboption by itself does not show a cross reference. The default is to show the listing and cross-reference.
The suboption is the letter ell for length, not the digit one. For example, -Xlistl45 sets the page length to 45 lines. The default is 66.
With n=0 (-Xlistl0) this option shows listings and cross-references with no page breaks for easier on-screen viewing.
To display directly to the screen, use the command: -Xlisto /dev/tty
If the identifiers are defined in the include files but not referenced in the source files, then they are not shown in the cross-reference table.
This suboption has no effect if the suboption -XlistI is used.
The default is not to show the occurrences in #include or INCLUDE files.
For example, -Xlistw132 sets the page width to 132 columns. The default is 79.
If nnn is not specified, then all warning messages are suppressed from printing. To suppress more than one, but not all warnings, use this option repeatedly. For example, -Xlistwar338 suppresses warning message number 338.
The cross-reference table answers the following questions about each identifier:
Example: Explain a message and find a type mismatch:
Special Compiler Options
Some compiler options are useful for debugging. They check subscripts, spot undeclared variables, show stages of the compile-link sequence, display versions of software, and so on. Subscript Bounds (-C)
The -C option adds checks for out-of-bounds array subscripts.
Undeclared Variable Types (-u)
The -u option checks for any undeclared variables. Version Checking (-V)
The -V option causes the name and version ID of each phase of the compiler to be displayed. This option can be useful in tracking the origin of ambiguous error messages and in reporting compiler failures, and to verify the level of installed compiler patches.
Interactive Debugging With dbx and The WorkShop
The Sun WorkShop provides a tightly integrated development environment for building and browsing, as well as debugging applications written in Fortran, C, C++, and Pascal.
-g on the compilation command. For example, -g suppresses the automatic inlining usually obtained with -O4. -g cancels any parallelization option (-autopar, -explicitpar, -parallel), as well as -depend and -reduction. Debugging is facilitated by specifying -g without any optimization options. See the dbx documentation for details.
error(1) is available if the operating system was installed with a developer install, rather than an end-user install; it can also be installed from the package, SUNWbtool.
Warning - This utility rewrites your source files and does not work if the source files are read-only, or in a read-only directory.
Facilities also exist in the Sun WorkShop for viewing compiler diagnostics. Refer to the Sun WorkShop: Getting Started guide.