www.delorie.com/gnu/docs/gcc/gnat_ug_166.html   search  
 
Buy the book!


Untitled Document

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

12.6 Examples of gnatfind Usage

gnatfind ^-f^/FULL_PATHNAME^ xyz:main.adb
Find declarations for all entities xyz referenced at least once in main.adb. The references are search in every library file in the search path.

The directories will be printed as well (as the `^-f^/FULL_PATHNAME^' switch is set)

The output will look like:
 
^directory/^[directory]^main.ads:106:14: xyz <= declaration
^directory/^[directory]^main.adb:24:10: xyz <= body
^directory/^[directory]^foo.ads:45:23: xyz <= declaration

that is to say, one of the entities xyz found in main.adb is declared at line 12 of main.ads (and its body is in main.adb), and another one is declared at line 45 of foo.ads

gnatfind ^-fs^/FULL_PATHNAME/SOURCE_LINE^ xyz:main.adb
This is the same command as the previous one, instead gnatfind will display the content of the Ada source file lines.

The output will look like:

 
^directory/^[directory]^main.ads:106:14: xyz <= declaration
   procedure xyz;
^directory/^[directory]^main.adb:24:10: xyz <= body
   procedure xyz is
^directory/^[directory]^foo.ads:45:23: xyz <= declaration
   xyz : Integer;

This can make it easier to find exactly the location your are looking for.

gnatfind ^-r^/REFERENCES^ "*x*":main.ads:123 foo.adb
Find references to all entities containing an x that are referenced on line 123 of main.ads. The references will be searched only in main.adb and foo.adb.

gnatfind main.ads:123
Find declarations and bodies for all entities that are referenced on line 123 of main.ads.

This is the same as gnatfind "*":main.adb:123.

gnatfind ^mydir/^[mydir]^main.adb:123:45
Find the declaration for the entity referenced at column 45 in line 123 of file main.adb in directory mydir. Note that it is usual to omit the identifier name when the column is given, since the column position identifies a unique reference.

The column has to be the beginning of the identifier, and should not point to any character in the middle of the identifier.


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

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003