Title and Copyright Information |
About This Manual |
Audience |
New and Changed Features |
Organization |
Related Documents |
Reader's Comments |
Conventions |
1 | Overview |
1.1 | Application Development Phases |
1.2 | Specification and Design Considerations |
1.2.1 | Standards |
1.2.2 | Internationalization |
1.2.3 | Window-Oriented Applications |
1.2.4 | Secure Applications |
1.3 | Major Software Development Tools |
1.3.1 | Languages Supported by the Tru64 UNIX Environment |
1.3.2 | Linking Object Files |
1.3.3 | Debugging and Program Analysis Tools |
1.4 | Source File Control |
1.5 | Program Installation Tools |
1.6 | Overview of Interprocess Communication Facilities |
2 | The Compiler System |
2.1 | Compiler System Components |
2.2 | Data Types in the Tru64 UNIX Environment |
2.2.1 | Data Type Sizes |
2.2.2 | Floating-Point Range and Processing |
2.2.3 | Structure Alignment |
2.2.4 | Bit-Field Alignment |
2.2.5 | The _ _align Storage Class Modifier |
2.3 | Using the C Preprocessor |
2.3.1 | Predefined Macros |
2.3.2 | Header Files |
2.3.3 | Setting Up Multilanguage Include Files |
2.3.4 | Implementation-Specific Preprocessor Directives (#pragma) |
2.4 | Compiling Source Programs |
2.4.1 | Default Compilation Behavior |
2.4.2 | Compiling Multilanguage Programs |
2.4.3 | Enabling Run-Time Checking of Array Bounds |
2.5 | Linking Object Files |
2.5.1 | Linking with Compiler Commands |
2.5.2 | Linking with the ld Command |
2.5.3 | Specifying Libraries |
2.6 | Running Programs |
2.7 | Object File Tools |
2.7.1 | Dumping Selected Parts of Files (odump) |
2.7.2 | Listing Symbol Table Information (nm) |
2.7.3 | Determining a File's Type (file) |
2.7.4 | Determining a File's Segment Sizes (size) |
2.7.5 | Disassembling an Object File (dis) |
2.8 | ANSI Name Space Pollution Cleanup in the Standard C Library |
3 | Pragma Preprocessor Directives |
3.1 | The #pragma environment Directive |
3.2 | The #pragma extern_prefix Directive |
3.3 | The #pragma inline Directive |
3.4 | The #pragma intrinsic and #pragma function Directives |
3.5 | The #pragma linkage Directive |
3.6 | The #pragma member_alignment Directive |
3.7 | The #pragma message Directive |
3.7.1 | #pragma messsage option1 |
3.7.2 | #pragma message option2 |
3.7.3 | #pragma message ("string") |
3.8 | The #pragma pack Directive |
3.9 | The #pragma pointer_size Directive |
3.10 | The #pragma use_linkage Directive |
3.11 | The #pragma weak Directive |
4 | Shared Libraries |
4.1 | Shared Library Overview |
4.2 | Resolving Symbols |
4.2.1 | Search Path of the Linker |
4.2.2 | Search Path of the Run-time Loader |
4.2.3 | Name Resolution |
4.2.4 | Options to Determine Handling of Unresolved External Symbols |
4.3 | Linking with Shared Libraries |
4.4 | Turning Off Shared Libraries |
4.5 | Creating Shared Libraries |
4.5.1 | Creating Shared Libraries from Object Files |
4.5.2 | Creating Shared Libraries from Archive Libraries |
4.6 | Working with Private Shared Libraries |
4.7 | Using Quickstart |
4.7.1 | Verifying that an Object Is Quickstarting |
4.7.2 | Manually Tracking Down Quickstart Problems |
4.7.3 | Tracking Down Quickstart Problems with the fixso Utility |
4.8 | Debugging Programs Linked with Shared Libraries |
4.9 | Loading a Shared Library at Run Time |
4.10 | Protecting Shared Library Files |
4.11 | Shared Library Versioning |
4.11.1 | Binary Incompatible Modifications |
4.11.2 | Shared Library Versions |
4.11.3 | Major and Minor Versions Identifiers |
4.11.4 | Full and Partial Versions of Shared Libraries |
4.11.5 | Linking with Multiple Versions of Shared Libraries |
4.11.6 | Version Checking at Load Time |
4.11.7 | Multiple Version Checking at Load Time |
4.12 | Symbol Binding |
4.13 | Shared Library Restrictions |
5 | Debugging Programs with dbx |
5.1 | General Debugging Considerations |
5.1.1 | Reasons for Using a Source-Level Debugger |
5.1.2 | Explanation of Activation Levels |
5.1.3 | Isolating Program Execution Failures |
5.1.4 | Diagnosing Incorrect Output Results |
5.1.5 | Avoiding Pitfalls |
5.2 | Running dbx |
5.2.1 | Compiling a Program for Debugging |
5.2.2 | Creating a dbx Initialization File |
5.2.3 | Invoking and Terminating dbx |
5.3 | Using dbx Commands |
5.3.1 | Qualifying Variable Names |
5.3.2 | dbx Expressions and Their Precedence |
5.3.3 | dbx Data Types and Constants |
5.4 | Working with the dbx Monitor |
5.4.1 | Repeating dbx Commands |
5.4.2 | Editing the dbx Command Line |
5.4.3 | Entering Multiple Commands |
5.4.4 | Completing Symbol Names |
5.5 | Controlling dbx |
5.5.1 | Setting and Removing Variables |
5.5.2 | Predefined dbx Variables |
5.5.3 | Defining and Removing Aliases |
5.5.4 | Monitoring Debugging Session Status |
5.5.5 | Deleting and Disabling Breakpoints |
5.5.6 | Displaying the Names of Loaded Object Files |
5.5.7 | Specifying the Location of Shared Libraries for Core Dumps |
5.5.8 | Invoking a Subshell from Within dbx |
5.6 | Examining Source Programs |
5.6.1 | Specifying the Locations of Source Files |
5.6.2 | Moving Up or Down in the Activation Stack |
5.6.2.1 | Using the where and tstack Commands |
5.6.2.2 | Using the up, down, and func Commands |
5.6.3 | Changing the Current Source File |
5.6.4 | Listing Source Code |
5.6.5 | Searching for Text in Source Files |
5.6.6 | Editing Source Files from Within dbx |
5.6.7 | Identifying Variables that Share the Same Name |
5.6.8 | Examining Variable and Procedure Types |
5.7 | Controlling the Program |
5.7.1 | Running and Rerunning the Program |
5.7.2 | Executing the Program Step by Step |
5.7.3 | Using the return Command |
5.7.4 | Going to a Specific Place in the Code |
5.7.5 | Resuming Execution After a Breakpoint |
5.7.6 | Changing the Values of Program Variables |
5.7.7 | Patching Executable Disk Files |
5.7.8 | Running a Specific Procedure |
5.7.9 | Setting Environment Variables |
5.8 | Setting Breakpoints |
5.8.1 | Overview |
5.8.2 | Setting Breakpoints with stop and stopi |
5.8.3 | Tracing Variables During Execution |
5.8.4 | Writing Conditional Code in dbx |
5.8.5 | Catching and Ignoring Signals |
5.9 | Examining Program State |
5.9.1 | Printing the Values of Variables and Expressions |
5.9.2 | Displaying Activation-Level Information with the dump Command |
5.9.3 | Displaying the Contents of Memory |
5.9.4 | Recording and Playing Back Portions of a dbx Session |
5.9.4.1 | Recording and Playing Back Input |
5.9.4.2 | Recording and Playing Back Output |
5.10 | Enabling Core-Dump File Naming |
5.10.1 | Enabling Core-File Naming at the System Level |
5.10.2 | Enabling Core-File Naming at the Application Level |
5.11 | Debugging a Running Process |
5.12 | Debugging Multithreaded Applications |
5.13 | Debugging Multiple Asynchronous Processes |
5.14 | Sample Program |
6 | Checking C Programs with lint |
6.1 | Syntax of the lint Command |
6.2 | Program Flow Checking |
6.3 | Data Type Checking |
6.3.1 | Binary Operators and Implied Assignments |
6.3.2 | Structures and Unions |
6.3.3 | Function Definition and Uses |
6.3.4 | Enumerators |
6.3.5 | Type Casts |
6.4 | Variable and Function Checking |
6.4.1 | Inconsistent Function Return |
6.4.2 | Function Values that Are Not Used |
6.4.3 | Disabling Function-Related Checking |
6.5 | Checking on the Use of Variables Before They Are Initialized |
6.6 | Migration Checking |
6.7 | Portability Checking |
6.7.1 | Character Uses |
6.7.2 | Bit Field Uses |
6.7.3 | External Name Size |
6.7.4 | Multiple Uses and Side Effects |
6.8 | Checking for Coding Errors and Coding Style Differences |
6.8.1 | Assignments of Long Variables to Integer Variables |
6.8.2 | Operator Precedence |
6.8.3 | Conflicting Declarations |
6.9 | Increasing Table Size |
6.10 | Creating a lint Library |
6.10.1 | Creating the Input File |
6.10.2 | Creating the lint Library File |
6.10.3 | Checking a Program with a New Library |
6.11 | Understanding lint Error Messages |
6.12 | Using Warning Class Options to Suppress lint Messages |
6.13 | Generating Function Prototypes for Compile-Time Detection of Syntax Errors |
7 | Debugging Programs with Third Degree |
7.1 | Running Third Degree on an Application |
7.1.1 | Using Third Degree with Shared Libraries |
7.2 | Debugging Example |
7.2.1 | Customizing Third Degree |
7.2.2 | Modifying the Makefile |
7.2.3 | Examining the Third Degree Log File |
7.2.3.1 | List of Run-Time Memory Access Errors |
7.2.3.2 | Memory Leaks |
7.2.3.3 | Heap History |
7.2.3.4 | Memory Layout |
7.3 | Interpreting Third Degree Error Messages |
7.3.1 | Fixing Errors and Retrying an Application |
7.3.2 | Detecting Uninitialized Values |
7.3.3 | Locating Source Files |
7.4 | Examining an Application's Heap Usage |
7.4.1 | Detecting Memory Leaks |
7.4.2 | Reading Heap and Leak Reports |
7.4.3 | Searching for Leaks |
7.4.4 | Interpreting the Heap History |
7.5 | Using Third Degree on Programs with Insufficient Symbolic Information |
7.6 | Validating Third Degree Error Reports |
7.7 | Undetected Errors |
8 | Profiling Programs to Improve Performance |
8.1 | Overview |
8.2 | Profiling Sample Program |
8.3 | Compilation Options for Profiling |
8.4 | Automatic and Profile-Directed Optimizations |
8.4.1 | Techniques |
8.4.2 | Tools and Examples |
8.4.2.1 | Automatic Optimization |
8.4.2.2 | Profile-Directed Optimization |
8.4.2.3 | Profile-Directed Reordering |
8.5 | Manual Design and Code Optimizations |
8.5.1 | Techniques |
8.5.2 | Tools and Examples |
8.5.2.1 | CPU-Time Profiling with Call Graph |
8.5.2.2 | CPU-Time/Event Profiles for Sourcelines/Instructions |
8.6 | Minimizing System Resource Usage |
8.6.1 | Techniques |
8.6.2 | Tools and Examples |
8.6.2.1 | System Monitors |
8.6.2.2 | Heap Memory Analyzers |
8.7 | Verifying the Significance of Test Cases |
8.7.1 | Techniques |
8.7.2 | Tools and Examples |
8.8 | Selecting Profiling Information to Display |
8.8.1 | Limiting Profiling Display to Specific Procedures |
8.8.2 | Displaying Profiling Information for Each Source Line |
8.8.3 | Limiting Profiling Display by Line |
8.8.4 | Including Shared Libraries in the Profiling Information |
8.8.4.1 | Specifying the Location of Instrumented Shared Libraries |
8.9 | Merging Profile Data Files |
8.9.1 | Data File-Naming Conventions |
8.9.2 | Data File-Merging Techniques |
8.10 | Profiling Multithreaded Applications |
8.11 | Using monitor Routines to Control Profiling |
9 | Using and Developing Atom Tools |
9.1 | Running Atom Tools |
9.1.1 | Using Installed Tools |
9.1.2 | Testing Tools Under Development |
9.1.3 | Atom Options |
9.2 | Developing Atom Tools |
9.2.1 | Atom's View of an Application |
9.2.2 | Atom Instrumentation Routine |
9.2.3 | Atom Instrumentation Interfaces |
9.2.3.1 | Navigating Within a Program |
9.2.3.2 | Building Objects |
9.2.3.3 | Obtaining Information About an Application's Components |
9.2.3.4 | Resolving Procedure Names and Call Targets |
9.2.3.5 | Adding Calls to Analysis Routines to a Program |
9.2.4 | Atom Description File |
9.2.5 | Writing Analysis Procedures |
9.2.5.1 | Input/Output |
9.2.5.2 | fork and exec System Calls |
9.2.6 | Determining the Instrumented PC from an Analysis Routine |
9.2.7 | Sample Tools |
9.2.7.1 | Procedure Tracing |
9.2.7.2 | Profile Tool |
9.2.7.3 | Data Cache Simulation Tool |
10 | Optimizing Techniques |
10.1 | Guidelines to Build an Application Program |
10.1.1 | Compilation Considerations |
10.1.2 | Linking and Loading Considerations |
10.1.3 | Using the Postlink Optimizer |
10.1.4 | Preprocessing and Postprocessing Considerations |
10.1.5 | Library Routine Selection |
10.2 | Application Coding Guidelines |
10.2.1 | Data-Type Considerations |
10.2.2 | Using Direct I/O on AdvFS Files |
10.2.3 | Cache Usage and Data Alignment Considerations |
10.2.4 | General Coding Considerations |
11 | Handling Exception Conditions |
11.1 | Exception-Handling Overview |
11.1.1 | C Compiler Syntax |
11.1.2 | libexc Library Routines |
11.1.3 | Header Files that Support Exception Handling |
11.2 | Raising an Exception from a User Program |
11.3 | Writing a Structured Exception Handler |
11.4 | Writing a Termination Handler |
12 | Developing Thread-Safe Libraries |
12.1 | Overview of Thread Support |
12.2 | Run-Time Library Changes for POSIX Conformance |
12.3 | Characteristics of Thread-Safe and Reentrant Routines |
12.3.1 | Examples of Nonthread-Safe Coding Practices |
12.4 | Writing Thread-Safe Code |
12.4.1 | Using TIS for Thread-Specific Data |
12.4.1.1 | Overview of TIS |
12.4.1.2 | Using Thread-Specific Data |
12.4.2 | Using Thread Local Storage |
12.4.2.1 | The _ _thread Attribute |
12.4.2.2 | Guidelines and Restrictions |
12.4.3 | Using Mutex Locks to Share Data Between Threads |
12.5 | Building Multithreaded Applications |
12.5.1 | Compiling Multithreaded C Applications |
12.5.2 | Linking Multithreaded C Applications |
12.5.3 | Building Multithreaded Applications in Other Languages |
13 | OpenMP Parallel Processing |
13.1 | Compilation Options |
13.2 | Environment Variables |
13.3 | Run-Time Performance Tuning |
13.3.1 | Schedule Type and Chunksize Settings |
13.3.2 | Additional Controls |
13.4 | Common Programming Problems |
13.4.1 | Scoping |
13.4.2 | Deadlock |
13.4.3 | Threadprivate Storage |
13.4.4 | Using Locks |
13.5 | Implementation-Specific Behavior |
13.6 | Debugging |
13.6.1 | Background Information Needed for Debugging |
13.6.2 | Debugging and Application-Analysis Tools |
13.6.2.1 | Ladebug |
13.6.2.2 | Visual Threads |
13.6.2.3 | Atom and OpenMP Tools |
13.6.2.4 | Other Debugging Aids |
14 | Posting and Receiving EVM Events |
14.1 | Events and Event Management |
14.2 | Overview of How EVM Events Are Handled |
14.3 | Starting and Stopping EVM |
14.4 | Authorization to Post and Receive Events |
14.5 | Contents of an EVM Event |
14.5.1 | Standard Data Items |
14.5.1.1 | Event Name Data Item |
14.5.1.1.1 | Reserved Component Names |
14.5.1.1.2 | Comparing Event Names |
14.5.1.2 | Event Format Data Item |
14.5.1.3 | Event Priority Data Item |
14.5.1.4 | I18N Catalog Name, Message Set ID, and Message ID Data Items |
14.5.1.5 | Reference Data Item |
14.5.2 | Variable Data Items |
14.6 | Designing a Set of Events |
14.6.1 | Deciding Which Status Changes Are Eventworthy |
14.6.2 | Writing Event Explanation Text |
14.6.3 | Designing Event Templates |
14.6.3.1 | Deciding what to Put in an Event Template |
14.6.3.2 | Matching the Names of Posted Events with Event Template Names |
14.6.3.3 | Merging Data Items from Templates and Posted Events |
14.6.3.4 | Installing Template Files -- Location, Naming, Ownership, and Permission Requirements |
14.6.3.5 | Checking Event Template Registration |
14.6.4 | Establishing Translations for Event Text (I18N) |
14.7 | The EVM Programming Interface |
14.7.1 | The EVM Header File |
14.7.2 | The EVM API Library |
14.7.3 | Return Status Codes |
14.7.4 | Signal Handling |
14.7.5 | EVM In Multithreaded Programs |
14.7.6 | Reassigning and Replicating EVM Events |
14.7.7 | Callback Functions |
14.7.8 | Handling Disconnections |
14.7.9 | Using Event Filters |
14.7.10 | Sample EVM Programming Operations |
14.7.10.1 | Performing Simple Event Manipulations |
14.7.10.2 | Using Variable-Length Argument Lists |
14.7.10.3 | Adding and Retrieving Variables |
14.7.10.4 | Posting Events |
14.7.10.5 | Reading and Writing Events |
14.7.10.6 | Subscribing for Event Notification |
14.7.10.7 | Handling Multiple I/O Sources |
14.7.10.8 | Using Filter Evaluators |
14.7.10.9 | Matching Event Names |
14.7.10.10 | Dealing with Missed Events |
14.8 | Adding an Event Channel to EVM |
14.8.1 | The Get Function |
14.8.2 | The Details Function |
14.8.3 | The Explain Function |
14.8.4 | The Monitor Function |
14.8.5 | The Cleanup Function |
14.8.6 | Channel Security |
A | 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 | Differences in the System V Habitat |
B.1 | Source Code Compatibility |
B.2 | Summary of System Calls and Library Routines |
C | 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 |
D | Parallel Processing -- Old Style |
D.1 | Use of Parallel-Processing Pragmas |
D.1.1 | General Coding Rules |
D.1.2 | General Use |
D.1.3 | Nesting Parallel Directives |
D.2 | Parallel-Processing Pragma Syntax |
D.2.1 | #pragma parallel |
D.2.2 | #pragma pfor |
D.2.3 | #pragma psection and #pragma section |
D.2.4 | #pragma critical |
D.2.5 | #pragma one processor |
D.2.6 | #pragma synchronize |
D.2.7 | #pragma enter gate and #pragma exit gate |
D.3 | Environment Variables |
E | Handling Names of Device Special Files |
Examples |
5-1 | Sample Program Used in dbx Examples |
8-1 | Profiling Sample Program |
8-2 | Sample Profile-Directed Optimization Output |
8-3 | Sample hiprof Default Profile Using gprof |
8-4 | Sample hiprof -cycles Profile Using gprof |
8-5 | Sample cc -pg Profile Using gprof |
8-6 | Sample uprofile CPU-Time Profile Using prof |
8-7 | Sample uprofile Data-Cache-Misses Profile Using prof |
8-8 | Sample hiprof -lines PC-Sampling Profile |
8-9 | Sample cc -p Profile Using prof |
8-10 | Sample pixie Profile Using prof |
8-11 | Sample third Log File |
8-12 | Using monstartup() and monitor() |
8-13 | Allocating Profiling Buffers Within a Program |
8-14 | Using monitor_signal() to Profile Nonterminating Programs |
10-1 | Pointers and Optimization |
11-1 | Handling a SIGSEGV Signal as a Structured Exception |
11-2 | Handling an IEEE Floating-Point SIGFPE as a Structured Exception |
11-3 | Multiple Structured Exception Handlers |
11-4 | Abnormal Termination of a Try Block by an Exception |
12-1 | Threads Programming Example |
14-1 | Sample Event Explanation Text |
14-2 | Performing Simple Event Manipulations |
14-3 | Using Variable-Length Argument Lists |
14-4 | Adding and Retrieving Variables |
14-5 | Posting Events |
14-6 | Reading and Writing Events |
14-7 | Subscribing for Event Notification |
14-8 | Handling Multiple I/O Sources |
14-9 | Using Filter Evaluators |
14-10 | Matching Event Names |
14-11 | Dealing with Missed Events |
C-1 | Example Attribute Table |
Figures |
2-1 | Compiling a Program |
2-2 | Default Structure Alignment |
2-3 | Default Bit-Field Alignment |
2-4 | Padding to the Next Pack Boundary |
4-1 | Use of Archive and Shared Libraries |
4-2 | Linking with Multiple Versions of Shared Libraries |
4-3 | Invalid Multiple Version Dependencies Among Shared Objects: Example 1 |
4-4 | Invalid Multiple Version Dependencies Among Shared Objects: Example 2 |
4-5 | Invalid Multiple Version Dependencies Among Shared Objects: Example 3 |
4-6 | Valid Uses of Multiple Versions of Shared Libraries: Example 1 |
4-7 | Valid Uses of Multiple Versions of Shared Libraries: Example 2 |
14-1 | EVM Overview |
14-2 | Posted Event and Template Merging |
A-1 | Layout of Memory Under -taso Option |
B-1 | System Call Resolution |
C-1 | System Attribute Value Initialization |
Tables |
1-1 | Programming Phases and Tru64 UNIX |
2-1 | Compiler System Functions |
2-2 | File Suffixes and Associated Files |
3-1 | Intrinsic Functions |
4-1 | Linker Options that Control Shared Library Versioning |
5-1 | Keywords Used in Command Syntax Descriptions |
5-2 | dbx Command Options |
5-3 | The dbx Number-Sign Expression Operator |
5-4 | Expression Operator Precedence |
5-5 | Built-in Data Types |
5-6 | Input Constants |
5-7 | Command-Line Editing Commands in emacs mode |
5-8 | Predefined dbx Variables |
5-9 | Modes for Displaying Memory Addresses |
6-1 | lint Warning Classes |
9-1 | Example Prepackaged Atom Tools |
9-2 | Atom Object Query Routines |
9-3 | Atom Procedure Query Routines |
9-4 | Atom Basic Block Query Routines |
9-5 | Atom Instruction Query Routines |
11-1 | Header Files that Support Exception Handling |
14-1 | Standard Data Items |
14-2 | Substituting Variables into Event Text |
14-3 | EVM's Variable Data Types |
14-4 | Name Matching Examples |
14-5 | Example Data Item Values for an Internationalized Event |
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 |