Chapter 9. The Library Browser gnatls

Table of Contents
9.1. Running gnatls
9.2. Switches for gnatls
9.3. Example of the Use of gnatls

gnatls is a tool that outputs information about compiled units. It gives the relationship between objects, unit names and source files. It can also be used to check the source dependencies of a unit as well as various characteristics.

9.1. Running gnatls

The gnatls command has the form:


$ prefix-gnatls switches object_or_ali_file

The main argument is the list of object or ali files (see Section A.8.) for which information is requested.

In normal mode, without additional option, gnatls produces a four-column listing. Each line represents information for a specific object. The first column gives the full path of the object, the second column gives the name of the principal unit in this object, the third column gives the status of the source and the fourth column gives the full path of the source representing this unit. Here is a simple example of use:


$ prefix-gnatls *.o
./demo1.o            demo1            DIF demo1.adb
./demo2.o            demo2             OK demo2.adb
./hello.o            h1                OK hello.adb
./instr-child.o      instr.child      MOK instr-child.adb
./instr.o            instr             OK instr.adb
./tef.o              tef              DIF tef.adb
./text_io_example.o  text_io_example   OK text_io_example.adb
./tgef.o             tgef             DIF tgef.adb

The first line can be interpreted as follows: the main unit which is contained in object file demo1.o is demo1, whose main source is in demo1.adb. Furthermore, the version of the source used for the compilation of demo1 has been modified (DIF). Each source file has a status qualifier which can be OK, MOK, DIF or NFP:

OK (unchanged)

The version of the source file used for the compilation of the specified unit corresponds exactly to the actual source file.

MOK (slightly modified)

The version of the source file used for the compilation of the specified unit differs from the actual source file but not enough to require re-compilation (this information is not currently used by gnatmake but may be in some future version of the system).

DIF (modified)

No version of the source found on the path corresponds to the source used to build this object.

??? (file not found)

No source file was found for this unit.

HID (hidden, unchanged version not first on PATH)

The version of the source that corresponds exactly to the source used for compilation has been found on the path but it is hidden by another version of the same source that has been modified.