Title and Copyright Information |
About This Manual |
Audience |
Organization |
Related Information |
[Linux] Related Linux Alpha Information |
[Tru64] Related Tru64 UNIX Documents |
Conventions |
1 | The Compiler System |
1.1 | Compiler System Components |
1.2 | Data Types on the Alpha System |
1.2.1 | Data Type Sizes |
1.2.2 | Floating-Point Range and Processing |
1.2.3 | Structure Alignment |
1.2.4 | Bit-Field Alignment |
1.2.5 | The _ _align Storage Class Modifier |
1.3 | Using the C Preprocessor |
1.3.1 | Predefined Macros |
1.3.2 | Header Files |
1.3.3 | Setting Up Multilanguage Include Files |
1.3.4 | Implementation-Specific Preprocessor Directives (#pragma) |
1.4 | Compiling Source Programs |
1.4.1 | Default Compilation Behavior |
1.4.2 | Compiling Multilanguage Programs |
1.4.3 | Enabling Run-Time Checking of Array Bounds |
1.5 | Linking Object Files |
1.5.1 | Linking with Compiler Commands |
1.5.2 | Linking with the ld Command |
1.5.3 | Specifying Libraries |
1.6 | Running Programs |
1.7 | [Tru64] Object File Tools |
1.7.1 | Dumping Selected Parts of Files (odump) |
1.7.2 | Listing Symbol Table Information (nm) |
1.7.3 | Determining a File's Type (file) |
1.7.4 | Determining a File's Segment Sizes (size) |
1.7.5 | Disassembling an Object File (dis) |
1.8 | [Tru64] ANSI Name Space Pollution Cleanup in the Standard C Library |
2 | Pragma Preprocessor Directives |
2.1 | The #pragma assert Directive |
2.1.1 | #pragma assert func_attrs |
2.1.2 | #pragma assert global_status_variable |
2.1.3 | #pragma assert non_zero |
2.2 | The #pragma environment Directive |
2.3 | [Tru64] The #pragma extern_model Directive |
2.3.1 | Syntax |
2.3.2 | #pragma extern_model relaxed_refdef |
2.3.3 | #pragma extern_model strict_refdef |
2.3.4 | #pragma extern_model save |
2.3.5 | #pragma extern_model restore |
2.4 | The #pragma extern_prefix Directive |
2.5 | The #pragma inline Directive |
2.6 | The #pragma intrinsic and #pragma function Directives |
2.7 | The #pragma linkage Directive |
2.8 | The #pragma member_alignment Directive |
2.9 | The #pragma message Directive |
2.9.1 | #pragma messsage option1 |
2.9.2 | #pragma message option2 |
2.9.3 | #pragma message ("string") |
2.10 | The #pragma pack Directive |
2.11 | [Tru64] The #pragma pointer_size Directive |
2.12 | The #pragma use_linkage Directive |
2.13 | The #pragma weak Directive |
3 | [Tru64] Shared Libraries |
3.1 | Shared Library Overview |
3.2 | Resolving Symbols |
3.2.1 | Search Path of the Linker |
3.2.2 | Search Path of the Loader |
3.2.3 | Name Resolution |
3.2.4 | Options to Determine Handling of Unresolved External Symbols |
3.3 | Linking with Shared Libraries |
3.4 | Turning Off Shared Libraries |
3.5 | Creating Shared Libraries |
3.5.1 | Creating Shared Libraries from Object Files |
3.5.2 | Creating Shared Libraries from Archive Libraries |
3.6 | Working with Private Shared Libraries |
3.7 | Using Quickstart |
3.7.1 | Verifying that an Object Is Quickstarting |
3.7.2 | Manually Tracking Down Quickstart Problems |
3.7.3 | Tracking Down Quickstart Problems with the fixso Utility |
3.8 | Debugging Programs Linked with Shared Libraries |
3.9 | Loading a Shared Library at Run Time |
3.10 | Protecting Shared Library Files |
3.11 | Shared Library Versioning |
3.11.1 | Binary Incompatible Modifications |
3.11.2 | Shared Library Versions |
3.11.3 | Major and Minor Versions Identifiers |
3.11.4 | Full and Partial Versions of Shared Libraries |
3.11.5 | Linking with Multiple Versions of Shared Libraries |
3.11.6 | Version Checking at Load Time |
3.11.7 | Multiple Version Checking at Load Time |
3.12 | Symbol Binding |
3.13 | Shared Library Restrictions |
4 | [Tru64] Debugging Programs with dbx |
4.1 | General Debugging Considerations |
4.1.1 | Reasons for Using a Source-Level Debugger |
4.1.2 | Explanation of Activation Levels |
4.1.3 | Isolating Program Execution Failures |
4.1.4 | Diagnosing Incorrect Output Results |
4.1.5 | Avoiding Pitfalls |
4.2 | Running dbx |
4.2.1 | Compiling a Program for Debugging |
4.2.2 | Creating a dbx Initialization File |
4.2.3 | Invoking and Terminating dbx |
4.3 | Using dbx Commands |
4.3.1 | Qualifying Variable Names |
4.3.2 | dbx Expressions and Their Precedence |
4.3.3 | dbx Data Types and Constants |
4.4 | Working with the dbx Monitor |
4.4.1 | Repeating dbx Commands |
4.4.2 | Editing the dbx Command Line |
4.4.3 | Entering Multiple Commands |
4.4.4 | Completing Symbol Names |
4.5 | Controlling dbx |
4.5.1 | Setting and Removing Variables |
4.5.2 | Predefined dbx Variables |
4.5.3 | Defining and Removing Aliases |
4.5.4 | Monitoring Debugging Session Status |
4.5.5 | Deleting and Disabling Breakpoints |
4.5.6 | Displaying the Names of Loaded Object Files |
4.5.7 | Invoking a Subshell from Within dbx |
4.6 | Examining Source Programs |
4.6.1 | Specifying the Locations of Source Files |
4.6.2 | Moving Up or Down in the Activation Stack |
4.6.2.1 | Using the where and tstack Commands |
4.6.2.2 | Using the up, down, and func Commands |
4.6.3 | Changing the Current Source File |
4.6.4 | Listing Source Code |
4.6.5 | Searching for Text in Source Files |
4.6.6 | Editing Source Files from Within dbx |
4.6.7 | Identifying Variables that Share the Same Name |
4.6.8 | Examining Variable and Procedure Types |
4.7 | Controlling the Program |
4.7.1 | Running and Rerunning the Program |
4.7.2 | Executing the Program Step by Step |
4.7.3 | Using the return Command |
4.7.4 | Going to a Specific Place in the Code |
4.7.5 | Resuming Execution After a Breakpoint |
4.7.6 | Changing the Values of Program Variables |
4.7.7 | Patching Executable Disk Files |
4.7.8 | Running a Specific Procedure |
4.7.9 | Setting Environment Variables |
4.8 | Setting Breakpoints |
4.8.1 | Overview |
4.8.2 | Setting Breakpoints with stop and stopi |
4.8.3 | Tracing Variables During Execution |
4.8.4 | Writing Conditional Code in dbx |
4.8.5 | Catching and Ignoring Signals |
4.9 | Examining Program State |
4.9.1 | Printing the Values of Variables and Expressions |
4.9.2 | Displaying Activation-Level Information with the dump Command |
4.9.3 | Displaying the Contents of Memory |
4.9.4 | Recording and Playing Back Portions of a dbx Session |
4.9.4.1 | Recording and Playing Back Input |
4.9.4.2 | Recording and Playing Back Output |
4.10 | Enabling Core-Dump-File Naming |
4.10.1 | Enabling Core-File Naming at the System Level |
4.10.2 | Enabling Core-File Naming at the Application Level |
4.11 | Debugging a Running Process |
4.12 | [Tru64 UNIX] Debugging Multithreaded Applications |
4.13 | Debugging Multiple Asynchronous Processes |
4.14 | Sample Program |
5 | [Tru64] Checking C Programs with lint |
5.1 | Syntax of the lint Command |
5.2 | Program Flow Checking |
5.3 | Data Type Checking |
5.3.1 | Binary Operators and Implied Assignments |
5.3.2 | Structures and Unions |
5.3.3 | Function Definition and Uses |
5.3.4 | Enumerators |
5.3.5 | Type Casts |
5.4 | Variable and Function Checking |
5.4.1 | Inconsistent Function Return |
5.4.2 | Function Values that Are Not Used |
5.4.3 | Disabling Function-Related Checking |
5.5 | Checking on the Use of Variables Before They Are Initialized |
5.6 | Migration Checking |
5.7 | Portability Checking |
5.7.1 | Character Uses |
5.7.2 | Bit Field Uses |
5.7.3 | External Name Size |
5.7.4 | Multiple Uses and Side Effects |
5.8 | Checking for Coding Errors and Coding Style Differences |
5.8.1 | Assignments of Long Variables to Integer Variables |
5.8.2 | Operator Precedence |
5.8.3 | Conflicting Declarations |
5.9 | Increasing Table Size |
5.10 | Creating a lint Library |
5.10.1 | Creating the Input File |
5.10.2 | Creating the lint Library File |
5.10.3 | Checking a Program with a New Library |
5.11 | Understanding lint Error Messages |
5.12 | Using Warning Class Options to Suppress lint Messages |
5.13 | Generating Function Prototypes for Compile-Time Detection of Syntax Errors |
6 | [Tru64] Debugging Programs with Third Degree |
6.1 | Running Third Degree on an Application |
6.1.1 | Using Third Degree with Shared Libraries |
6.2 | Debugging Example |
6.2.1 | Customizing Third Degree |
6.2.2 | Modifying the Makefile |
6.2.3 | Examining the Third Degree Log File |
6.2.3.1 | List of Run-Time Memory Access Errors |
6.2.3.2 | Memory Leaks |
6.2.3.3 | Heap History |
6.2.3.4 | Memory Layout |
6.3 | Interpreting Third Degree Error Messages |
6.3.1 | Fixing Errors and Retrying an Application |
6.3.2 | Detecting Uninitialized Values |
6.3.3 | Locating Source Files |
6.4 | Examining an Application's Heap Usage |
6.4.1 | Detecting Memory Leaks |
6.4.2 | Reading Heap and Leak Reports |
6.4.3 | Searching for Leaks |
6.4.4 | Interpreting the Heap History |
6.5 | Using Third Degree on Programs with Insufficient Symbolic Information |
6.6 | Validating Third Degree Error Reports |
6.7 | Undetected Errors |
7 | [Tru64] Profiling Programs to Improve Performance |
7.1 | Overview |
7.2 | Profiling Sample Program |
7.3 | Compilation Options for Profiling |
7.4 | Automatic and Profile-Directed Optimizations |
7.4.1 | Techniques |
7.4.2 | Tools and Examples |
7.4.2.1 | Automatic Optimization |
7.4.2.2 | Profile-Directed Optimization |
7.4.2.3 | Profile-Directed Reordering |
7.5 | Manual Design and Code Optimizations |
7.5.1 | Techniques |
7.5.2 | Tools and Examples |
7.5.2.1 | CPU-Time Profiling with Call Graph |
7.5.2.2 | CPU-Time/Event Profiles for Sourcelines/Instructions |
7.6 | Minimizing System Resource Usage |
7.6.1 | Techniques |
7.6.2 | Tools and Examples |
7.6.2.1 | System Monitors |
7.6.2.2 | Heap Memory Analyzers |
7.7 | Verifying the Significance of Test Cases |
7.7.1 | Techniques |
7.7.2 | Tools and Examples |
7.8 | Selecting Profiling Information to Display |
7.8.1 | Limiting Profiling Display to Specific Procedures |
7.8.2 | Displaying Profiling Information for Each Source Line |
7.8.3 | Limiting Profiling Display by Line |
7.8.4 | Including Shared Libraries in the Profiling Information |
7.8.4.1 | Specifying the Location of Instrumented Shared Libraries |
7.9 | Merging Profile Data Files |
7.9.1 | Data File-Naming Conventions |
7.9.2 | Data File-Merging Techniques |
7.10 | Profiling Multithreaded Applications |
7.11 | Using monitor Routines to Control Profiling |
8 | [Tru64] Using and Developing Atom Tools |
8.1 | Running Atom Tools |
8.1.1 | Using Installed Tools |
8.1.2 | Testing Tools Under Development |
8.1.3 | Atom Options |
8.2 | Developing Atom Tools |
8.2.1 | Atom's View of an Application |
8.2.2 | Atom Instrumentation Routine |
8.2.3 | Atom Instrumentation Interfaces |
8.2.3.1 | Navigating Within a Program |
8.2.3.2 | Building Objects |
8.2.3.3 | Obtaining Information About an Application's Components |
8.2.3.4 | Resolving Procedure Names and Call Targets |
8.2.3.5 | Adding Calls to Analysis Routines to a Program |
8.2.4 | Atom Description File |
8.2.5 | Writing Analysis Procedures |
8.2.5.1 | Input/Output |
8.2.5.2 | Fork and Exec System Calls |
8.2.6 | Determining the Instrumented PC from an Analysis Routine |
8.2.7 | Sample Tools |
8.2.7.1 | Procedure Tracing |
8.2.7.2 | Profile Tool |
8.2.7.3 | Data Cache Simulation Tool |
9 | Optimizing Techniques |
9.1 | Guidelines to Build an Application Program |
9.1.1 | Compilation Considerations |
9.1.2 | Linking and Loading Considerations |
9.1.2.1 | [Tru64] Using the Postlink Optimizer |
9.1.3 | [Tru64] Preprocessing and Postprocessing Considerations |
9.1.4 | Library Routine Selection |
9.2 | Application Coding Guidelines |
9.2.1 | Data Type Considerations |
9.2.2 | Cache Usage and Data Alignment Considerations |
9.2.3 | General Coding Considerations |
10 | [Tru64] Handling Exception Conditions |
10.1 | Exception-Handling Overview |
10.1.1 | C Compiler Syntax |
10.1.2 | libexc Library Routines |
10.1.3 | Header Files that Support Exception Handling |
10.2 | Raising an Exception from a User Program |
10.3 | Writing a Structured Exception Handler |
10.4 | Writing a Termination Handler |
11 | [Tru64] Developing Thread-Safe Libraries |
11.1 | Overview of Thread Support |
11.2 | Run-Time Library Changes for POSIX Conformance |
11.3 | Characteristics of Thread-Safe and Reentrant Routines |
11.3.1 | Examples of Nonthread-Safe Coding Practices |
11.4 | Writing Thread-Safe Code |
11.4.1 | Using TIS for Thread-Specific Data |
11.4.1.1 | Overview of TIS |
11.4.1.2 | Using Thread-Specific Data |
11.4.2 | Using Thread Local Storage |
11.4.2.1 | The _ _thread Attribute |
11.4.2.2 | Guidelines and Restrictions |
11.4.3 | Using Mutex Locks to Share Data Between Threads |
11.5 | Building Multithreaded Applications |
11.5.1 | Compiling Multithreaded C Applications |
11.5.2 | Linking Multithreaded C Applications |
11.5.3 | Building Multithreaded Applications in Other Languages |
12 | [Tru64] OpenMP Parallel Processing |
12.1 | Compilation Options |
12.2 | Environment Variables |
12.3 | Tuning Run-Time Performance |
12.3.1 | Schedule Type and Chunksize Settings |
12.3.2 | Additional Controls |
12.4 | Common Programming Problems |
12.4.1 | Scoping |
12.4.2 | Deadlock |
12.4.3 | Threadprivate Storage |
12.4.4 | Using Locks |
12.5 | Implementation-Specific Behavior |
12.6 | Debugging |
12.6.1 | Background Information Needed for Debugging |
12.6.2 | Debugging and Application-Analysis Tools |
12.6.2.1 | Ladebug |
12.6.2.1.1 | Debugging Considerations Unique to OpenMP |
12.6.2.1.2 | Ladebug Examples |
12.6.2.2 | Visual Threads |
12.6.2.3 | Atom and OpenMP Tools |
12.6.2.4 | Other Debugging Aids |
12.6.2.4.1 | Modifying the Active Thread Count |
A | [Tru64] Using 32-Bit Pointers on Tru64 UNIX Systems |
A.1 | Compiler-System and Language Support for 32-Bit Pointers |
A.2 | Using the -taso Option |
A.2.1 | Use and Effects of the -taso Option |
A.2.2 | Limits on the Effects of the -taso Option |
A.3 | Using the -xtaso or -xtaso_short Option |
A.3.1 | Coding Considerations Associated with Changing Pointer Sizes |
A.3.2 | Restrictions on the Use of 32-Bit Pointers |
A.3.3 | Avoiding Problems with System Header Files |
B | [Tru64] Differences in the System V Habitat |
B.1 | Source Code Compatibility |
B.2 | Summary of System Calls and Library Routines |
C | [Tru64] Creating Dynamically Configurable Kernel Subsystems |
C.1 | Overview of Dynamically Configurable Subsystems |
C.2 | Overview of Attribute Tables |
C.2.1 | Definition Attribute Table |
C.2.2 | Example Definition Attribute Table |
C.2.3 | Communication Attribute Table |
C.2.4 | Example Communication Attribute Table |
C.3 | Creating a Configuration Routine |
C.3.1 | Performing Initial Configuration |
C.3.2 | Responding to Query Requests |
C.3.3 | Responding to Reconfigure Requests |
C.3.4 | Performing Subsystem-Defined Operations |
C.3.5 | Unconfiguring the Subsystem |
C.3.6 | Returning from the Configuration Routine |
C.4 | Allowing for Operating System Revisions in Loadable Subsystems |
C.5 | Building and Loading Loadable Subsystems |
C.6 | Building a Static Configurable Subsystem Into the Kernel |
C.7 | Testing Your Subsystem |
Examples |
4-1 | Sample Program Used in dbx Examples |
7-1 | Profiling Sample Program |
7-2 | Sample Profile-Directed Optimization Output |
7-3 | Sample hiprof Default Profile, Using gprof |
7-4 | Sample hiprof -cycles Profile, Using gprof |
7-5 | Sample cc -pg Profile, Using gprof |
7-6 | Sample uprofile CPU-Time Profile, Using prof |
7-7 | Sample uprofile Data-Cache-Misses Profile, Using prof |
7-8 | Sample hiprof -lines PC-Sampling Profile |
7-9 | Sample cc -p Profile, Using prof |
7-10 | Sample pixie Profile, Using prof |
7-11 | Sample third Log File |
7-12 | Using monstartup() and monitor() |
7-13 | Allocating Profiling Buffers Within a Program |
7-14 | Using monitor_signal() to Profile Nonterminating Programs |
9-1 | Pointers and Optimization |
10-1 | Handling a SIGSEGV Signal as a Structured Exception |
10-2 | Handling an IEEE Floating-Point SIGFPE as a Structured Exception |
10-3 | Multiple Structured Exception Handlers |
10-4 | Abnormal Termination of a Try Block by an Exception |
11-1 | Threads Programming Example |
C-1 | Example Attribute Table |
Figures |
1-1 | Compiling a Program |
1-2 | Default Structure Alignment |
1-3 | Default Bit-Field Alignment |
1-4 | Padding to the Next Pack Boundary |
3-1 | Use of Archive and Shared Libraries |
3-2 | Linking with Multiple Versions of Shared Libraries |
3-3 | Invalid Multiple Version Dependencies Among Shared Objects: Example 1 |
3-4 | Invalid Multiple Version Dependencies Among Shared Objects: Example 2 |
3-5 | Invalid Multiple Version Dependencies Among Shared Objects: Example 3 |
3-6 | Valid Uses of Multiple Versions of Shared Libraries: Example 1 |
3-7 | Valid Uses of Multiple Versions of Shared Libraries: Example 2 |
A-1 | Layout of Memory Under -taso Option |
B-1 | System Call Resolution |
C-1 | System Attribute Value Initialization |
Tables |
1-1 | Compiler System Functions on Linux Alpha |
1-2 | Compiler System Functions on Tru64 UNIX |
1-3 | File Suffixes and Associated Files |
2-1 | Intrinsic Functions |
3-1 | Linker Options that Control Shared Library Versioning |
4-1 | Keywords Used in Command Syntax Descriptions |
4-2 | dbx Command Options |
4-3 | The dbx Number-Sign Expression Operator |
4-4 | Expression Operator Precedence |
4-5 | Built-in Data Types |
4-6 | Input Constants |
4-7 | Command-Line Editing Commands in emacs mode |
4-8 | Predefined dbx Variables |
4-9 | Modes for Displaying Memory Addresses |
5-1 | lint Warning Classes |
8-1 | Example Prepackaged Atom Tools |
8-2 | Atom Object Query Routines |
8-3 | Atom Procedure Query Routines |
8-4 | Atom Basic Block Query Routines |
8-5 | Atom Instruction Query Routines |
10-1 | Header Files that Support Exception Handling |
B-1 | System Call Summary |
B-2 | Library Function Summary |
C-1 | Attribute Data Types |
C-2 | Codes that Determine the Requests Allowed for an Attribute |
C-3 | Attribute Status Codes |
Index |