This chapter highlights the major features provided by the development environment for Tru64 UNIX. The following topics are discussed:
The Compaq C compiler for Tru64 UNIX, which is standards compliant and fully optimized that produces extremely efficient code to fully exploit the 64-bit address space of the Alpha architecture (Section 6.1)
Debuggers that support C, Assembler, Fortran (f77 and f90), C++, Pascal, and Ada (Section 6.2)
The ATOM,
gprof
,
prof
,
and
uprofile
profiling tools (Section 6.3)
Shared libraries (Section 6.4)
Run-time libraries (Section 6.5)
The Java development kit (JDK) (Section 6.6)
Development commands (Section 6.7)
Support for POSIX Threads, Visual Threads, and Thread-Independent Services (Section 6.8)
The Berkeley Memory-Mapped File Support (mmap) function (Section 6.9)
The real-time user and programming environment (Section 6.10)
The network programming environment (Section 6.11)
In addition, Tru64 UNIX supports internationalization, standard
UNIX development tools (for example,
awk
,
lint
,
make
, and
prof
), and run-time
libraries for Ada, C++, Cobol, Fortran, and Pascal programs.
For more more information, see the
Programmer's Guide, the
Programming Support Tools
manual, the
Assembly Language Programmer's Guide, and
Writing Software for the International Market.
6.1 Compaq C Compiler
The Compaq C compiler for Tru64 UNIX is a standards-compliant, full-featured, highly-optimizing compiler that was specifically developed to exploit the Alpha architecture. In particular, the Compaq C compiler for Tru64 UNIX recognizes these popular C dialects:
ANSI and ISO C with extensions (-std, the default)
Strict ANSI and ISO C (-std1, -isoc94)
Traditional K&R C (-std0)
Microsoft C (-ms)
VAX C (-vaxc)
The Compaq C compiler for Tru64 UNIX complies with the following standards:
ANSI and ISO C (cc
-std1)
XPG4-UNIX (c89
-D_XOPEN_SOURCE_EXTENDED)
For more information on standards compliance, see the
standards
(5)
The Compaq C compiler for Tru64 UNIX supports language extensions including:
OpenMP parallel decomposition directives (-omp, -check_omp, -mp)
Microsoft C structured exception handling (try-except
and
try-finally
) and thread-local storage
32-bit pointers (64-bit pointers are the default) to reduce
memory consumption and facilitate porting (-taso,
-xtaso,
-xtaso_short.
(See the
protect_headers_setup
(8)
User-defined assembly language sequences using
#pragma
s and intrinsic functions that expand and optimize these instruction
sequences in line
#pragmas
and command line options for controlling
data alignment (-assume,
-misalign,
-Zp,
-member_alignment)
The Compaq C compiler supports enhancements for mathematical computing such as:
IEEE floating point (including proper handling for exceptional conditions like NaN, INF, and so forth)
Fast math mode (INF, NaN, and so forth, translated to avoid exception handling)
Quad-precision (128-bit) floating point representation for
long double
For more information on the Compaq C compiler for Tru64 UNIX,
see the
cc
(1)6.2 Debuggers
Tru64 UNIX supports the following source code debuggers:
dbx
ladebug
The
dbx
debugger is used to debug programs at the
source-code level or the machine-code level.
The interface to
dbx
is a command line interface.
The tasks you can perform with
dbx
include the following:
Debug programs written in C, Fortran (f77 and f90), assembly language, or Pascal.
Debug active kernels, core dumps, and programs that use multiple
threads (by using
/proc
to attach to running processes),
and shared libraries.
Analyze kernel core dumps.
Patch the on-disk copy of either user programs or the kernel.
Perform multiprocess debugging and debugging across
fork
and
exec
calls.
The
ladebug
debugger is a source-level symbolic debugger
that has both a graphical user interface (GUI) and a command line interface
similar to the
dbx
command line interface.
The tasks you
can perform with
ladebug
include the following:
Attach to and detaching from running processes.
Detect problems and debug across
fork
and
exec
calls.
Debug multiple processes.
Debug multithreaded programs, either POSIX Threads (formerly called DECthreads) applications or kernel modules that make use of kernel threads.
Debug programs written in C++, C, Fortran 77, Fortran 90, Ada, Cobol, and Assembler.
The
ladebug
debugger is a full C++ debugger, which
demangles C++ names, understands C++ expressions, provides support for inline
functions, templates, and C++ exceptions.
Its support for f77 and f90 includes
case insensitivity, common blocks, alternate entry points, language-dependent
type printing, and assume shape arrays.
Debug machine level code.
Debug running programs or core dumps.
Debug shared objects.
Catch unaligned access problems.
Debug active kernels, either locally or remotely, and analyzing kernel crash dumps.
Evaluate expressions using the syntax of the source programming language.
Remotely debug programs running on different target machines by way of the remote debugging server.
The
ladebug
remote debugging protocol is also available
along with the C source code for a sample remote debugging server that adheres
to the protocol.
Internationalization support is available in a separate kit.
The internationalized
ladebug
debugger accepts multibyte characters as input, and outputs
local language characters according to the current global locale set in the
debugger.
It also supports the
wchar_t
datatype in C and
C++.
6.3 Profiling Tools
Tru64 UNIX provides the following profiling toolkit:
ATOM
Provides a flexible code instrumentation interface that is capable of building a wide variety of user-defined program analysis tools. The toolkit comprises an instrumentation control utility and a library whose procedural interface helps you to easily develop special-purpose instrumentation and analysis tools.
Tru64 UNIX provides the following ATOM-based instrumentation and analysis tools:
hiprof
A call-graph profiling tool with output that can be postprocessed by
gprof
.
third
(Third degree)
A tool to find memory leaks and check for incorrect memory accesses.
pixie
A superset of the existing
pixie
basic block profiler,
which can profile a program's executable files and its shared libraries.
The
output of
pixie
can be analyzed by
prof
.
Tru64 UNIX also supports the following profiling tools:
gprof
For programs compiled with the
-pg
option,
gprof
displays the number of calls that named procedures have made
to each other and how much CPU time each procedure consumed.
It does this
by using PC sampling statistics.
It also analyzes the output of programs instrumented
with
hiprof
.
prof
For programs compiled with the
-p
option,
prof
displays how much CPU time was consumed by each procedure in
a program and its shared libraries.
It does this using PC-sampling statistics.
It also analyzes the output of programs instrumented with
pixie
or monitored with
uprofile
and
kprofile
.
uprofile
and
kprofile
These use the Alpha chip's built-in performance counters to sample
a variety of events in the CPU during the execution of the kernel or an application
program.
These tools report on CPU cycles, memory and cache effects, and so
forth, which
prof
can then analyze.
For more information on profiling tools, see the
Programmer's Guide
and
the appropriate reference pages.
6.4 Shared Libraries
Tru64 UNIX provides a full complement of dynamic shared libraries,
compatible with System V semantics for shared library loading and symbol resolution,
and the System V API for dynamic loading (dlopen
,
dlclose
,
dlsym
, and
dlerror
).
Because they allow programs to include only information about how to load and access routines rather than the routines themselves, shared libraries increase system performance, reduce disk and memory requirements, and simplify system management.
The shared libraries are located in the
/usr/shlib
directory.
The Tru64 UNIX
implementation of X11R6.3 and Motif also makes use of both static and shared
libraries.
The X11 shared libraries are located in the
/usr/shlib/X11
directory.
6.4.1 Quickstart
Quickstart allows shared libraries with unique addresses to start faster
than if their addresses were in conflict.
Each shared library must have a
unique address placed in the
/usr/shlib/so_locations
file,
which allows applications that link against these shared libraries to start
execution faster.
This happens because the shared objects do not have to be
relocated at run time.
The
ld
utility can read and write
an
so_locations
file when it creates a shared library.
6.4.2 Dynamic Loader
Tru64 UNIX uses a System V Release 4.0 compatible loader to load shared libraries dynamically. This loader provides the following features:
The ability to call into dynamically loaded shared libraries
System V Release 4.0 symbol resolution semantics, including symbol preemption
The ability to prelink libraries for fast program loading
Tru64 UNIX supports full and partial duplication of shared libraries. The loader looks for backward-compatible versions of shared libraries using a path constructed by appending the version string as a subdirectory of the normal search path. As a result, any changes to kernel interfaces or to global data definitions that would ordinarily break binary compatibility will not affect your applications, because you can maintain multiple versions of any shared library and link your application against the appropriate version of that shared library.
In Motif Version 1.2, for example, the OSF changed several of the interfaces,
thereby breaking binary compatibility with applications built against Motif
1.1.3 libraries.
To preserve binary compatibility, Tru64 UNIX supports both
Motif 1.1.3 and Motif 1.2 shared libraries, so that applications can access
the Motif 1.1.3 shared libraries.
For more information on versioning, see
the
Programmer's Guide.
6.5 Run-Time Libraries
Tru64 UNIX supports the following run-time libraries. With these libraries, you can run previously compiled programs without having to install the corresponding language programs on your system.
Compaq C++ run-time-libraries (libcxx
,
libcomplex
, and
libtask
)
These libraries support such Compaq C++ run-time functions as I/O handling, complex arithmetic, and multitasking.
Compaq COBOL run-time libraries (libcob
,
libots2
, and
libisamstub
)
These libraries support such COBOL run-time functions as I/O handling, decimal arithmetic, COBOL ACCEPT and DISPLAY statements, STRING and UNSTRING operations, and CALL and CANCEL statements.
Compaq Fortran run-time libraries (libfor
,
libfutil
, and
libUfor
)
These libraries support such Fortran run-time functions as I/O handling, intrinsic functions, data formatting, data conversion, math functions, and Fortran bindings to common operating system services.
Compaq Pascal run-time library (libpas
)
This library supports such Pascal run-time functions as I/O handling, math functions, time and date services, and file services.
The Java Development Kit (JDK) is a component of Tru64 UNIX. You can use this kit to develop and run Java applets and programs.
The JDK for Tru64 UNIX contains a just-in-time compiler (JIT), which
provides on-the-fly compilation of your application's Java byte-code and run-time
calls into native Alpha machine code.
This results in significantly faster
execution of your Java application compared with running it using the Java
interpreter.
The JIT runs by default when you enter the
java
command.
The JDK implements Java threads on top of native (POSIX) threads. This allows different Java threads in your application to run on different processors, provided that you have a multiprocessor machine. It also means that your Java application will run properly when linked with native methods or native APIs (such as DCE) that are also implemented using POSIX Threads.
For more information, see the Java documentation in the following directory
on your Tru64 UNIX system where the JDK is installed:
/usr/share/doclib/java/index.html
6.7 Development Commands
Tru64 UNIX supports the full array of development tools, including
ar
,
as
,
btou
,
cb
,
cc
,
cflow
,
cpp
,
ctags
,
cxref
,
c89
,
dbx
,
dis, error
,
file
,
indent
,
ld
,
lex
,
lint
,
loader
,
m4
,
make
,
mig
,
mkstr
,
nm
,
odump
,
pixie
,
ppu
,
prof
,
ranlib
,
size
,
stdump
,
strings
,
strip
,
tsort
,
xstr
, and
yacc
, as well as the source code control
systems
rcs
and
sccs
.
Many of the development commands are specified by the System V, POSIX,
XPG4, and XPG4-UNIX standards to which Tru64 UNIX is fully compliant.
6.8 Thread Support
Tru64 UNIX offers the POSIX Threads Library (formerly DECthreads),
Visual Threads, and Thread-Independent Services.
6.8.1 POSIX Threads Library
The POSIX Threads Library is an implementation of the POSIX 1003.1c-1995
standard multithreading API.
POSIX Threads provides efficient two-level scheduling
(POSIX
"process contention scope") that is tightly integrated
with the kernel to automatically maintain the maximum level of computational
and I/O concurrency at all times.
For applications that require real-time
scheduling with respect to hardware events or threads in other processes or
in the kernel, POSIX Threads also provides
"system contention scope"
and scheduling.
6.8.2 Visual Threads
Visual Threads is a diagnostic tool for analyzing and debugging multithreaded applications. You can Visual Threads to automatically diagnose common problems associated with multithreading; these problems include deadlock, protection of shared data, and thread-usage errors.
You can also use this tool to monitor the thread-related performance of the application; it will help you identify bottlenecks or locking granularity problems. It is a unique debugging tool because it can be used to identify problem areas even if an application does not show any specific problem symptoms.
Visual Threads can be used with any Tru64 UNIX application that uses POSIX Threads (DECthreads) or is written in Java. It is designed for multithreaded applications of all sizes; it can handle applications with from two threads to hundreds of threads.
Visual Threads is licensed as part of the Developers' Toolkit.
6.8.3 Thread-Independent Services
Tru64 UNIX supports Thread-Independent Services (TIS) routines, which
are provided to enable application writers to write thread-safe code for nonthreaded
libraries and applications.
In the presence of threads, these routines provide
thread-safe functionality.
In the absence of threads, these routines impose
the minimum possible overhead on their caller.
Note that the TIS routines
are used by the C run-time library to provide support for both single and
multithreaded applications.
6.9 Memory-Mapped File Support
Tru64 UNIX supports the Berkeley Memory-Mapped File Support (mmap)
function, which allows an application to access data files with memory operations
rather than file I/O operations.
6.10 Real-Time User and Programming Environment
Tru64 UNIX supports a real-time user and programming environment;
it is shipped as an optional subset.
The Tru64 UNIX real-time programming
environment conforms to the POSIX 1003.1b-1993 standard for real time, which
allows you to develop and run portable real-time applications in a POSIX environment.
The POSIX 1003.1b interfaces are collected in the real-time and asynchronous
I/O libraries
librt
and
libaio
, respectively.
If you enable kernel preemption, a higher priority process can preempt a lower-priority process regardless of whether it is running in kernel mode or user mode. With this fully preemptive kernel, the Process Preemption Latency (the amount of time it takes to preempt a lower-priority process) is minimized.
In addition to a preemptive kernel, the Tru64 UNIX real-time programming environment supports the following POSIX 1003.1b features:
Real-time clocks and timers
Real-time queued signals
Fixed priority scheduling policies
Real-time scheduler priority levels
Counting semaphores
Shared memory
Process memory locking
Asynchronous I/O
Synchronized I/O
Message-passing interfaces
Thread-safe implementation of real-time libraries
For more information on the real-time programming environment, see the
Guide to Realtime Programming.
For information on configuring the real-time kernel, see the
System Administration
manual.
6.11 Network Programming Interfaces
The network programming environment includes the programming interfaces for application, kernel, and driver developers writing network applications and implementing network protocols. Additionally, it includes the kernel-level resources that an application requires to process and transmit data, some of which include libraries, data structures, header files, and transport protocols.
The following programming interfaces are supported by the operating system:
X/Open Transport Interface (XTI/TLI)
BSD Sockets
System V Release 4.0 STREAMS
Data Link Interface (DLI)
Data Link Provider Interface (DLPI)
Extensible SNMP (eSNMP)
For more detailed information on the network programming environment, see the Network Programmer's Guide.