Next: , Previous: Tools Supporting Project Files, Up: Top


13 The Cross-Referencing Tools gnatxref and gnatfind

The compiler generates cross-referencing information (unless you set the ‘-gnatx’ switch), which are saved in the .ali files. This information indicates where in the source each entity is declared and referenced. Note that entities in package Standard are not included, but entities in all other predefined units are included in the output.

Before using any of these two tools, you need to compile successfully your application, so that GNAT gets a chance to generate the cross-referencing information.

The two tools gnatxref and gnatfind take advantage of this information to provide the user with the capability to easily locate the declaration and references to an entity. These tools are quite similar, the difference being that gnatfind is intended for locating definitions and/or references to a specified entity or entities, whereas gnatxref is oriented to generating a full report of all cross-references.

To use these tools, you must not compile your application using the -gnatx switch on the gnatmake command line (see The GNAT Make Program gnatmake). Otherwise, cross-referencing information will not be generated.

Note: to invoke gnatxref or gnatfind with a project file, use the gnat driver (see The GNAT Driver and Project Files).