6.4. Example of the Use of gnatxref

test.adb


01 with Part1; -- unused
02 with Part2; use Part2;
03 procedure Test is
04
05    Thing : Number;
06    type Client is record
07       Number : Integer;
08       State : Boolean;
09    end record;
10    type Color is (Red, Green); -- unused
11    My_Client : Client;
12
13 begin
14    My_Client.Number := 1;
15    My_Client.State := True;
16    Thing := 20;
17    Thing := Thing + Thing;
18 end;

part1.ads


01 package Part1 is
02    type Useless is new Integer;
03 end;

part2.ads


01 package Part2 is
02    type Number is new Integer range 1 .. 1000;
03    The_Number : constant := 42;
04 end;

The result of invoking gnatxref test is:


$ prefix-gnatxref test
Part1 U part1.ads:1:9 {} {test.adb:1:6 }
Part2 U part2.ads:1:9 {} {test.adb:2:6 2:17 }
Number I part2.ads:2:9 {} {test.adb:5:12 }
Test U test.adb:3:11 {} {}
Thing I test.adb:5:4 {test.adb:16:4 17:4 } {test.adb:17:13 17:21 }
Client R test.adb:6:9 {} {test.adb:11:16 }
Number I test.adb:7:7 {} {test.adb:14:14 }
State E test.adb:8:7 {} {test.adb:15:14 }
Color E test.adb:10:9 {} {}
My_Client R test.adb:11:4 {test.adb:14:14 15:14 } {test.adb:14:4 15:4 }