The command line for
$ gnatfind [switches] pattern[:sourcefile[:line[:column]]] [file1 file2 ...]
Omitting the pattern is equivalent to specifying ‘*’, which will match any entity. Note that if you do not provide a pattern, you have to provide both a sourcefile and a line.
Entity names are given in Latin-1, with uppercase/lowercase equivalence
for matching purposes. At the current time there is no support for
8-bit codes other than Latin-1, or for wide characters in identifiers.
gnatfindwill look for references, bodies or declarations of symbols referenced in sourcefile, at line line and column column. See Examples of gnatfind Usage for syntax examples.
These file names are considered to be regular expressions, so for instance specifying source*.adb is the same as giving every file in the current directory whose name starts with source and whose extension is adb.
The location of the spec of the entity will always be displayed, even if it isn't in one of file1, file2,... The occurrences of the entity in the separate units of the ones given on the command line will also be displayed.
Note that if you specify at least one file in this part,
sometimes not be able to find the body of the subprograms.
At least one of 'sourcefile' or 'pattern' has to be present on the command line.
The following switches are available:
Display Copyright and version, then exit disregarding all other options.
gnatxrefwill parse the read-only files found in the library search path. Otherwise, these files will be ignored. This option can be used to protect Gnat sources or your own libraries from being parsed, thus making
gnatxrefmuch faster, and their output much smaller. Read-only here refers to access or permission status in the file system for the current user.
aliand other extensions (e.g.
glifor C/C++ sources when using -fdump-xref) may be specified via this switch. Note that if this switch overrides the default, which means that only the new extension will be considered.
gnatfindwill output the parent type reference for each matching derived types.
gnatfindaccept the simple regular expression set for ‘pattern’. If this switch is set, then the pattern will be considered as full Unix-style regular expression.
gnatfindwill try to locate a project file in the current directory.
If a project file is either specified or found by the tools, then the content
of the source directory and object directory lines are added as if they
had been specified respectively by ‘-aI’ and
gnatfindwill output only the information about the declaration, body or type completion of the entities. If this switch is set, the
gnatfindwill locate every reference to the entities in the files specified on the command line (or in every file in the search path if no file is given on the command line).
gnatfindwill output the content of the Ada source file lines were the entity was found.
gnatfindwill output the type hierarchy for the specified type. It act like -d option but recursively from parent type to parent type. When this switch is set it is not possible to specify more than one file.
All these switches may be in any order on the command line, and may even appear after the file names. They need not be separated by spaces, thus you can say ‘gnatxref -ag’ instead of ‘gnatxref -a -g’.
As stated previously, gnatfind will search in every directory in the
search path. You can force it to look only in the current directory if
* at the end of the command line.