GNAT User’s Guide for Native Platforms¶
GNAT, The GNU Ada Development Environment
GNAT Pro Edition
Version 22.0w
Date: Apr 11, 2021
AdaCore
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being “GNAT User’s Guide for Native Platforms”, and with no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
- 1. About This Guide
- 2. Getting Started with GNAT
- 3. The GNAT Compilation Model
- 3.1. Source Representation
- 3.2. Foreign Language Representation
- 3.3. File Naming Topics and Utilities
- 3.4. Configuration Pragmas
- 3.5. Generating Object Files
- 3.6. Source Dependencies
- 3.7. The Ada Library Information Files
- 3.8. Binding an Ada Program
- 3.9. GNAT and Libraries
- 3.10. Conditional Compilation
- 3.11. Mixed Language Programming
- 3.12. GNAT and Other Compilation Models
- 3.13. Using GNAT Files with External Tools
- 4. Building Executable Programs with GNAT
- 4.1. Building with
gnatmake
- 4.2. Compiling with
gcc
- 4.3. Compiler Switches
- 4.3.1. Alphabetical List of All Switches
- 4.3.2. Output and Error Message Control
- 4.3.3. Warning Message Control
- 4.3.4. Debugging and Assertion Control
- 4.3.5. Validity Checking
- 4.3.6. Style Checking
- 4.3.7. Run-Time Checks
- 4.3.8. Using
gcc
for Syntax Checking - 4.3.9. Using
gcc
for Semantic Checking - 4.3.10. Compiling Different Versions of Ada
- 4.3.11. Character Set Control
- 4.3.12. File Naming Control
- 4.3.13. Subprogram Inlining Control
- 4.3.14. Auxiliary Output Control
- 4.3.15. Debugging Control
- 4.3.16. Exception Handling Control
- 4.3.17. Units to Sources Mapping Files
- 4.3.18. Code Generation Control
- 4.4. Linker Switches
- 4.5. Binding with
gnatbind
- 4.6. Linking with
gnatlink
- 4.7. Using the GNU
make
Utility
- 4.1. Building with
- 5. GNAT Utility Programs
- 5.1. The File Cleanup Utility
gnatclean
- 5.2. The GNAT Library Browser
gnatls
- 5.3. The Coding Standard Verifier
gnatcheck
- 5.4. The GNAT Metrics Tool
gnatmetric
- 5.5. The GNAT Pretty Printer
gnatpp
- 5.6. The Body Stub Generator gnatstub
- 5.7. The Unit Test Generator
gnattest
- 5.7.1. Running
gnattest
- 5.7.2. Switches for
gnattest
in framework generation mode - 5.7.3. Switches for
gnattest
in test execution mode - 5.7.4. Project Attributes for
gnattest
- 5.7.5. Simple Example
- 5.7.6. Setting Up and Tearing Down the Testing Environment
- 5.7.7. Regenerating Tests
- 5.7.8. Default Test Behavior
- 5.7.9. Testing Primitive Operations of Tagged Types
- 5.7.10. Testing Inheritance
- 5.7.11. Tagged Type Substitutability Testing
- 5.7.12. Testing with Contracts
- 5.7.13. Additional Tests
- 5.7.14. Individual Test Drivers
- 5.7.15. Stubbing
- 5.7.16. Integration with GNATcoverage
- 5.7.17. Putting Tests under Version Control
- 5.7.18. Current Limitations
- 5.7.1. Running
- 5.8. Translating Code Addresses into Source Locations with
gnatsymbolize
- 5.9. Using Project Files with GNAT Tools
- 5.1. The File Cleanup Utility
- 6. GNAT and Program Execution
- 6.1. Running and Debugging Ada Programs
- 6.1.1. The GNAT Debugger GDB
- 6.1.2. Running GDB
- 6.1.3. Introduction to GDB Commands
- 6.1.4. Using Ada Expressions
- 6.1.5. Calling User-Defined Subprograms
- 6.1.6. Using the next Command in a Function
- 6.1.7. Stopping When Ada Exceptions Are Raised
- 6.1.8. Ada Tasks
- 6.1.9. Debugging Generic Units
- 6.1.10. Remote Debugging with gdbserver
- 6.1.11. GNAT Abnormal Termination or Failure to Terminate
- 6.1.12. Naming Conventions for GNAT Source Files
- 6.1.13. Getting Internal Debugging Information
- 6.1.14. Stack Traceback
- 6.1.15. Pretty-Printers for the GNAT runtime
- 6.2. Profiling
- 6.3. Improving Performance
- 6.4. Overflow Check Handling in GNAT
- 6.5. Performing Dimensionality Analysis in GNAT
- 6.6. Stack Related Facilities
- 6.7. Memory Management Issues
- 6.1. Running and Debugging Ada Programs
- A. Platform-Specific Information
- B. Example of Binder Output
- C. Elaboration Order Handling in GNAT
- Elaboration Code
- Elaboration Order
- Checking the Elaboration Order
- Controlling the Elaboration Order in Ada
- Controlling the Elaboration Order in GNAT
- Mixing Elaboration Models
- ABE Diagnostics
- SPARK Diagnostics
- Elaboration Circularities
- Resolving Elaboration Circularities
- Elaboration-related Compiler Switches
- Summary of Procedures for Elaboration Control
- Inspecting the Chosen Elaboration Order
- D. Inline Assembler
- E. GNU Free Documentation License