ERC32 Ada

User's Guide

Chris Nettleton

License

ERC32 Ada is commercial non-proprietary software distributed under the terms of the GNU Public license. Permission is granted to make and distribute verbatim copies of this document provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this document under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this document intoanother language, under the above conditions for modified versions.

Trademarks

Sun and Solaris are registered trademarks of Sun Microsystems, Inc. UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company, Ltd. X/Open is a trademark of X/Open Company Limited. Windows is a registered trademark of Microsoft Corporation.

All other trademarks and registered trademarks are the property of their respective holders.


Table of Contents
About This Guide
Audience
Organization
Related Documents
Reader's Comments
Documentation Conventions
I. Using the Ada 95 Compiler
1. Compiling with gcc
1.1. Compiling Programs
1.2. Switches for gcc
1.3. Search Paths and the Run-Time Library (RTL)
1.4. Order of Compilation Issues
1.5. Examples
2. Binding with gnatbind
2.1. Running gnatbind
2.2. Consistency-Checking Modes
2.3. Binder Error Message Control
2.4. Elaboration Control
2.5. Output Control
2.6. Binding for Non-Ada Main Programs
2.7. Summary of Binder Switches
2.8. Search Paths for gnatbind
2.9. Examples of gnatbind Usage
3. Linking with gnatlink
3.1. Running gnatlink
3.2. Switches for gnatlink
4. Making Programs with gnatmake
4.1. Running gnatmake
4.2. Switches for gnatmake
4.3. Mode switches for gnatmake
4.4. Notes on the Command Line
4.5. How gnatmake Works
4.6. Examples of gnatmake Usage
5. Renaming Files with gnatchop
5.1. Handling Files with Multiple Units
5.2. Command Line for gnatchop
5.3. Switches for gnatchop
5.4. Examples of gnatchop Use
6. The Cross-Reference Utilities
6.1. Command Line of gnatxref
6.2. Switches for gnatxref
6.3. Command Line of gnatfind
6.4. Example of the Use of gnatxref
7. Shortening File Names with gnatkr
7.1. About gnatkr
7.2. Using gnatkr
7.3. Crunching Method
7.4. Examples of gnatkr Usage
8. Preprocessing with gnatprep
8.1. Using gnatprep
8.2. Switches for gnatprep
8.3. Form of definitions file
8.4. Form of input text for gnatprep
9. The library browser gnatls
9.1. Running gnatls
9.2. Switches for gnatls
9.3. Example of the Use of gnatls
10. Other Utility Programs
10.1. Using Other Utility Programs With ERC32 Ada
10.2. The gnatpsys Utility Program
10.3. The gnatpsta Utility Program
10.4. The External Symbol Naming Scheme of ERC32 Ada
II. Running and Debugging Ada 95 Programs
11. Using the Simulator
11.1. The Command Line
11.2. Command Line Switches
11.3. Examples of Simulator Use
12. Summary of the Debugger
13. A Sample Debug Session
14. Getting In and Out of the Debugger
14.1. Invoking the Debugger
14.2. Quitting the Debugger
14.3. Shell Commands
15. Debugger Commands
15.1. Command Syntax
15.2. Command Completion
15.3. Getting Help
16. Running Programs Under the Debugger
16.1. Compiling for Debugging
16.2. Starting your Program
17. Stopping and Continuing
17.1. Breakpoints, Watchpoints, and Exceptions
17.2. Continuing and Stepping
18. Examining the Stack
18.1. Stack Frames
18.2. Backtraces
18.3. Selecting a Frame
18.4. Information about a Frame
19. Examining Source Files
19.1. Printing Source Lines
19.2. Searching Source Files
19.3. Specifying Source Directories
19.4. Source and Machine Code
20. Examining Data
20.1. Expressions
20.2. Program Variables
20.3. Artificial Arrays
20.4. Output Formats
20.5. Examining Memory
20.6. Automatic Display
20.7. Print Settings
20.8. Value History
20.9. Convenience Variables
20.10. Registers
21. Using the Debugger with Different Languages
21.1. Switching Between Source Languages
21.2. Displaying the Language
21.3. Supported Languages
22. Examining the Symbol Table
23. Altering Execution
23.1. Assignment to Variables
23.2. Continuing at a Different Address
23.3. Returning from a Function
23.4. Calling Program Functions
23.5. Patching Programs
24. The Debugger Files
24.1. Commands to Specify Files
24.2. Errors Reading Symbol Files
25. Specifying a Debugging Target
25.1. Active Targets
25.2. Commands for Managing Targets
25.3. Remote Debugging
26. Controlling the Debugger
26.1. Prompt
26.2. Command Editing
26.3. Command History
26.4. Screen Size
26.5. Numbers
26.6. Optional Warnings and Messages
27. Canned Sequences of Commands
27.1. User-Defined Commands
27.2. User-Defined Command Hooks
27.3. Command Files
27.4. Commands for Controlled Output
28. Using History Interactively
28.1. History Interaction
III. Using the Macro Assembler
29. Overview
29.1. The Assembler
29.2. Object File Formats
29.3. Command Line
29.4. Input Files
29.5. Output (Object) File
29.6. Error and Warning Messages
30. Assembler Command-Line Options
30.1. Enable Listings: -a[cdhlns]
30.2. -D
30.3. Work Faster: -f
30.4. .include search path: -I path
30.5. Difference Tables: -K
30.6. Include Local Labels: -L
30.7. Name the Object File: -o
30.8. Join Data and Text Sections: -R
30.9. Display Assembly Statistics: --statistics
30.10. Announce Version: -v
30.11. Suppress Warnings: -W
30.12. Generate Object File in Spite of Errors: -Z
31. Assembler Syntax
31.1. Preprocessing
31.2. White-space
31.3. Comments
31.4. Symbols
31.5. Statements
31.6. Constants
32. Sections and Relocation
32.1. Background
32.2. Linker Sections
32.3. Sub-Sections
32.4. bss Section
33. Assembler Symbols
33.1. Labels
33.2. Giving Symbols Other Values
33.3. Symbol Names
33.4. The Special Dot Replaceable
33.5. Symbol Attributes
34. Assembler Expressions
34.1. Empty Expressions
34.2. Integer Expressions
35. Assembler Directives
35.1. .abort
35.2. .ABORT
35.3. .align abs-expr, abs-expr, abs-expr
35.4. .app-file string
35.5. .ascii "string"...
35.6. .asciz "string"...
35.7. .balign[wl] abs-expr, abs-expr, abs-expr
35.8. .byte expressions
35.9. .comm symbol, length
35.10. .data subsection
35.11. .def name
35.12. .dim
35.13. .double flonums
35.14. .eject
35.15. .else
35.16. .endef
35.17. .endif
35.18. .equ symbol, expression
35.19. .equiv symbol, expression
35.20. .err
35.21. .extern
35.22. .file string
35.23. .fill repeat, size, value
35.24. .float flonums
35.25. .global symbol, .globl symbol
35.26. .hword expressions
35.27. .ident
35.28. .if absolute expression
35.29. .include "file"
35.30. .int expressions
35.31. .irp symbol, values...
35.32. .irpc symbol,values...
35.33. .lcomm symbol, length
35.34. .lflags
35.35. .line line-number
35.36. .linkonce [type]
35.37. .ln line-number
35.38. .list
35.39. .long expressions
35.40. .macro
35.41. .nolist
35.42. .octa bignums
35.43. .org new-lc, fill
35.44. .p2align[wl] abs-expr, abs-expr, abs-expr
35.45. .psize lines, columns
35.46. .quad bignums
35.47. .rept count
35.48. .sbttl "sub heading"
35.49. .scl class
35.50. .section name, subsection
35.51. .set symbol, expression
35.52. .short expressions
35.53. .single flonums
35.54. .size
35.55. .skip size, fill
35.56. .space size, fill
35.57. .stabd, .stabn, .stabs
35.58. .string "str"
35.59. .tag structname
35.60. .text subsection
35.61. .title "heading"
35.62. .type int
35.63. .val addr
35.64. .word expressions
35.65. Deprecated Directives
36. Target Dependent Features
36.1. ERC32 Options
36.2. Enforcing aligned data
36.3. Floating Point
36.4. ERC32 Machine Directives
IV. Using the Linker
37. Linker Overview
38. Linker Invocation
38.1. Command Line Options
38.2. Environment Variables
39. Linker Command Language
39.1. Linker Scripts
39.2. Expressions
39.3. Memory Layout
39.4. Specifying Output Sections
39.5. The Entry Point
39.6. Version Script
39.7. Option Commands
V. Using the Object Code Utilities
40. The Utilities
40.1. ar
40.2. nm
40.3. objcopy
40.4. objdump
40.5. ranlib
40.6. size
40.7. strings
40.8. strip
40.9. c++filt
40.10. addr2line
41. Selecting the target system
41.1. Target Selection
41.2. Architecture selection
41.3. Linker emulation selection
VI. Appendices
A. The Compilation Model
A.1. Source Representation
A.2. Foreign Language Representation
A.3. File Naming Rules
A.4. Using Other File Names
A.5. Naming of ERC32 Ada Source Files
A.6. Generating Object Files
A.7. Source Dependencies
A.8. The Ada Library Information Files
A.9. Representation of Time Stamps
A.10. Binding an Ada Program
A.11. Mixed Language Programming
A.12. Comparison of ERC32 Ada With C/C++ Compilation Model
A.13. Comparison of ERC32 Ada With Ada Library Model
B. Handling of Configuration Pragmas
B.1. The gnat.adc file
C. Handling Elaboration Order
C.1. Elaboration Code in Ada 95
C.2. Checking the Elaboration Order in Ada 95
C.3. Controlling the Elaboration Order in Ada 95
C.4. Controlling Elaboration in ERC32 Ada - Internal Calls
C.5. Controlling Elaboration in ERC32 Ada - External Calls
C.6. Default Behavior in ERC32 Ada - Ensuring Safety
C.7. What to do if the Default Elaboration Behavior Fails
C.8. Elaboration for Access-to-Subprogram Values
C.9. Summary of Procedures for Elaboration Control
D. Performance Considerations
D.1. Controlling Run-time Checks
D.2. Optimization Levels
D.3. Inlining of Subprograms
E. BFD
E.1. How it works: an outline of BFD
Index