[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13. The GNAT library browser 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.

13.1 Running gnatls  
13.2 Switches for gnatls  
13.3 Example of gnatls Usage  

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.1 Running gnatls

The gnatls command has the form

   $ gnatls switches object_or_ali_file

The main argument is the list of object or `ali' files (see section 2.7 The Ada Library Information Files) 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:

   $ 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 (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 recompilation. If you use gnatmake with the qualifier -m (minimal recompilation), a file marked MOK will not be recompiled.

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.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.2 Switches for gnatls

gnatls recognizes the following switches:

Consider all units, including those of the predefined Ada library. Especially useful with -d.

List sources from which specified units depend on.

Output the list of options.

Only output information about object files.

Only output information about source files.

Only output information about compilation units.

Source and Object path manipulation. Same meaning as the equivalent $ gnatmake flags 6.2 Switches for gnatmake

Verbose mode. Output the complete source and object paths. Do not use the default column layout but instead use long format giving as much as information possible on each requested units, including special characteristics such as:

The unit is preelaborable in the Ada 95 sense.

No elaboration code has been produced by the compiler for this unit.

The unit is pure in the Ada 95 sense.

The unit contains a pragma Elaborate_Body.

The unit contains a pragma Remote_Types.

The unit contains a pragma Shared_Passive.

This unit is part of the predefined environment and cannot be modified by the user.

The unit contains a pragma Remote_Call_Interface.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.3 Example of gnatls Usage

Example of using the verbose switch. Note how the source and object paths are affected by the -I switch.

   $ gnatls -v -I.. demo1.o

   GNATLS 3.10w (970212) Copyright 1999 Free Software Foundation, Inc.

   Source Search Path:

   Object Search Path:

      Unit =>
        Name   => demo1
        Kind   => subprogram body
        Flags  => No_Elab_Code
        Source => demo1.adb    modified

The following is an example of use of the dependency list. Note the use of the -s switch which gives a straight list of source files. This can be useful for building specialized scripts.

   $ gnatls -d demo2.o
   ./demo2.o   demo2        OK demo2.adb
                            OK gen_list.ads
                            OK gen_list.adb
                            OK instr.ads
                            OK instr-child.ads

   $ gnatls -d -s -a demo1.o

[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Tom Bennet on August, 25 2000 using texi2html