GPRinspect Reference
GPRinspect loads a GPR project tree and displays its structure and contents: project relationships, source directories, attributes, packages, variables, and type definitions. It is primarily a diagnostic tool for understanding how a project tree is interpreted by the GPR project model.
Command Line
Syntax
gprinspect [-P<proj>.gpr] [switches]
Project file and common switches
See Common Command-Line Options for project file discovery rules, project and configuration switches, and common diagnostic switches.
Switches
Output format
--display=formatSelect the output format. Accepted values:
textual(default)Human-readable indented text.
jsonPretty-printed JSON.
json-compactCompact JSON with no extra whitespace. Suitable for machine processing.
Project scope
-r/--recursiveDisplay all projects in the tree, not only the root project.
--views=name[,name…]Restrict display to the named project views (comma-separated). Implies
-r. Only available with--display=textual.
Content selection
With no content switch, GPRinspect shows only the structural information for each project (directories, relationships, library properties).
--allDisplay everything: attributes, packages, variables, and type definitions.
--attributesDisplay project-level and package-level attributes and their values.
-c/--from-configInclude attributes inherited from the active configuration project in the attribute display. Requires
--attributesor--all.--packagesDisplay the packages declared in each project and their attributes.
--variablesDisplay variables and type definitions declared in each project.
Registry
--gpr-registry-file=fileLoad additional attribute definitions from file before loading the project tree. Use this to recognize attributes defined by external tools (such as GNATcheck or GNATprove) when inspecting projects that use them.
Output structure
Textual output is divided into sections:
- Header
Timestamp and GPR2 library version.
- Project tree
Summary of the loaded tree: project count, search paths.
- Per-project blocks
One block per project in scope. Each block reports:
Project name, kind, and file path.
Object, source, library, and ALI directories.
extendsandwithrelationships.Attributes (with
--attributesor--all), grouped by package.Variables and type definitions (with
--variablesor--all).
- Messages
Any errors, warnings, or hints produced during loading.
JSON output wraps the same information under "projects" and
"messages" keys.
Exit Codes
0Success.
1General error (invalid option, project loading failure, etc.).
5Project parsing error.