7.3.2 gnatfind Switches
The command invocation for gnatfind is:
$ gnatfind [`switches`] `pattern`[:`sourcefile`[:`line`[:`column`]]]
[`file1` `file2` ...]
with the following iterpretation of the command arguments:
An entity will be output only if it matches the regular expression found
in pattern, see Regular Expressions in gnatfind and gnatxref.
Omitting the pattern is equivalent to specifying
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.
gnatfind will 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.
A decimal integer identifying the line number containing
the reference to the entity (or entities) to be located.
A decimal integer identifying the exact location on the
line of the first character of the identifier for the
entity reference. Columns are numbered from 1.
- `file1 file2 ...'
The search will be restricted to these source files. If none are given, then
the search will be conducted for every library file in the search path.
These files must appear only after the pattern or sourcefile.
These file names are considered to be regular expressions, so for instance
source*.adb is the same as giving every file in the current
directory whose name starts with
source and whose extension is
The location of the spec of the entity will always be displayed, even if it
isn't in one of
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, gnatfind may
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.
If `–version' was not used, display usage, then exit disregarding
all other options.
If this switch is present, gnatfind and gnatxref will 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 gnatfind and gnatxref
much faster, and their output much smaller. Read-only here refers to access
or permission status in the file system for the current user.
When looking for source files also look in directory DIR. The order in which
source file search is undertaken is the same as for `gnatmake'.
When searching for library and object files, look in directory
DIR. The order in which library files are searched is the same as for
Do not look for sources in the system default directory.
Do not look for library files in the system default directory.
Specify an alternate ali file extension. The default is ali and other
extensions (e.g. gli for 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.
Specifies the default location of the runtime library. Same meaning as the
equivalent `gnatmake' flag (Switches for gnatmake).
If this switch is set, then gnatfind will output the parent type
reference for each matching derived types.
By default, gnatfind accept the simple regular expression set for
pattern. If this switch is set, then the pattern will be
considered as full Unix-style regular expression.
If this switch is set, the output file names will be preceded by their
directory (if the file was found in the search path). If this switch is
not set, the directory will not be printed.
If this switch is set, information is output only for library-level
entities, ignoring local entities. The use of this switch may accelerate
gnatfind and gnatxref.
Specify a project file (GNAT Project Manager) to use.
By default, gnatxref and gnatfind will 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
By default, gnatfind will output only the information about the
declaration, body or type completion of the entities. If this switch is
set, the gnatfind will 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).
If this switch is set, then gnatfind will output the content
of the Ada source file lines were the entity was found.
If this switch is set, then gnatfind will 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
you specify * at the end of the command line.