Link files

Code Coverage for Ada

Link files are the library management system used for Ada Coverage. These libraries contain the entire Ada compilation units contained by compiler sources, the predefined Ada environment and the source files of your projects. You must use link files when using Code Coverage in Ada for the Ada Coverage analyzer to correctly analyze your source code.

You can include a link file within another link file, which is an easy way to manage your source code.

Link File Syntax

Link files have a line-by-line syntax. Comments start with a double hyphen (--), and end at the end of the line. Lines can be empty.

There are two types of configuration lines:

  • Link file inclusion: The link filename can be relative to the link file that contains this line or absolute.

<link filename> LINK

  • Compilation unit description: The source filename is the file containing the described compilation unit (absolute or relative to the link filename). The full unit name is the Ada full unit name (beware of separated units, or child units).

<source filename> <full unit name> <type> [ada83]

The <type> is one of the following flags:

    • SPEC for specification

    • BODY for a body

    • PROC for procedure or function

Use the optional ada83 flag if the source file cannot be compiled in Ada 95 mode, and must be analyzed in Ada 83 mode.

Generating a Link File

The link file can be generated either manually or automatically with the Ada Link File Generator (attolalk) tool. See the Studio Reference section of the help for more information about command line tools.

Sending the Link File to the Instrumentor

The loading order of link files is important. If the same unit name is found twice or more in one (or more) loaded link files, the Instrumentor issues a warning and uses the last encountered unit.

Included link files are analyzed when the file including the link file is loaded.

In Ada, Code Coverage loads the link files in the following order:

  • By default, either adalib83.alk or adalib95.alk is loaded. These files are part of the Target Deployment Port.

  • If you use the -STDLINK command line option, the specified standard link file is loaded first. See the Studio Reference section of the help for more information

  • The link file specified by the ATTOLCOV_ADALINK environment variable is loaded.

  • The link files specified by the -Link option is loaded.

Now, you can start analyzing the file instrument.

Loading A Permanent Link File

You can ask Code Coverage to load the link file at each execution. To do that, set the environment variable ATTOLCOV_ADALINK with the link filename separated by ':' on a UNIX system, or ';' in Windows. For example:

ATTOLCOV_ADALINK="compiler.alk/projects/myproject/myproject.alk"

A Link file specified on the command line is loaded after the link file specified by this environment variable.

Related Topics

Selecting coverage types | Code Coverage settings