Content-type: text/html
atom - Builds an instrumented version of an application program
atom appl_prog instrum_file [analysis_file] [options...]
atom appl_prog -tool tool_name [-env environ] [options...]
The first format of the atom command is used to create a tool that instruments an application program. This format requires the instrum_file parameter. The analysis_file parameter is optional, because Atom can be used just to examine a program statically, in which case no run-time analysis routines are needed.
The second format of the atom command is more convenient for regular use, because it locates the tool's instrumentation and analysis files by a simple tool_name. This format requires the -tool option and accepts the -env option. It allows neither the instrum_file nor the analysis_file parameter.
The following list describes those options used to invoke Atom with a tool_name. Identifies the tool to be used by naming the tool's description file (by default, tool_name.desc). This text file names the instrumentation and analysis files for the tool, as well as options that the tool needs. By default, atom searches for the description file in the /usr/lib/cmplrs/atom/tools and /usr/lib/cmplrs/atom/examples directories. You can add directories to the search path by supplying a colon-separated list of additional directories to the ATOMTOOLPATH environment variable. You can prevent Atom from searching the default directories for the tool by including the keyword NODEFAULT anywhere in the directory list specified by the ATOMTOOLPATH environment variable. Identifies any special environment (for example, threads) in which the tool is to operate, by naming an alternative description file (tool_name.environ.desc). Atom displays an error if you specify an environment for which no description file is found in Atom's search path.
Both formats of the atom command accept the following options. Note that the listed default values apply only to the first format. When the -tool option is specified, required atom options and default atom, compiler, and linker options may be defined by the specified tool's description file. See the atom_description_file(5) reference page for the syntax of the file. Indicates that calls to analysis routines are not to be optimized. This is the default. Optimizes the calls to analysis routines by reducing the number of registers that need to be restored. Specifying this switch causes Atom to generate slightly larger, but faster code. Instruments all statically loaded shared libraries in the shared executable. Allows debugging of instrumentation routines. Atom puts the control in dbx with a stop at the instrumentation routine. See the Programmer's Guide for a discussion on how to use dbx with Atom. Allows debugging of instrumentation routines with the optional ladebug debugger, if installed on your system. Atom puts the control in ladebug with a stop at the instrumentation routine. Use ladebug if the instrumentation routines contain C++ code. See the Ladebug Debugger Manual for more information. Specifies that objname is a dynamic shared library (that is, one loaded by a call to dlopen(3)). You must specify each of the application's dynamic shared libraries in either a -dynobj option or an -incobj option. Those libraries specified to the -dynobj option are not instrumented; those specified to the -incobj option are. Excludes the named shared library from instrumentation. You can use the -excobj option more than once to specify several shared libraries. Note that when -pthread is specified (typically in a tool's description file for the ``threads'' environment), Atom automatically instruments parts of libpthread.so even if it is specified in the -excobj option. Produces the instrumented program with debugging information. This enables debugging of analysis routines. The default -A0 option (not -A1) is recommended when -ga (or -g) is used. Produces the instrumented program with debugging information. This enables debugging of application routines. Changes the base of the analysis heap. This option has three forms: Sets the base to the given hex address. Sets the base to a default 31-bit address that is safe for applications that expect analysis addresses to fit in 31 bits. Sets the base to the first page after the end of the application's bss segment. This puts the heap base in about the same place as the application's heap. You should only specify this for tools that intercept every heap allocation in the application program.
-toolargs='-exc "operator -" -exc "ostream::operator <<" \
-exc main -exc "operator new(unsigned long)"'
Displays each step Atom takes to create the instrumented program.
Displays Atom's version number.
Controls display of warning messages. The value of
n
can be one of the following values:
Display all warning messages, including those that are normally
suppressed.
Suppress warning messages that can be safely ignored. This
is the default.
Suppress warning messages emitted when processing the analysis
routines.
Passes the specified options to the analysis file's link phase.
Passes the specified options to the instrumentation file's
link phase.
Passes the specified options to the analysis file's compilation
phase.
Passes the specified options to the instrumentation file's
compilation phase.
File name of a fully linked shared or nonshared executable. For multi-threaded programs, run ld(1) and atom(1) on the same version of Tru64 UNIX. Multi-threaded programs linked on DIGITAL UNIX V3.2 are not supported, because the thread support libraries are not compatible with atom. Name of a C source file or an object module that contains the Atom tool's instrumentation procedures. By convention, most instrumentation files have the suffix inst.c or inst.o, respectively. If the instrumentation procedures are in more than one file, the .o of each file may be linked together into one file using the ld command with a -r option.
Atom is a programmable
instrumentation toolkit. You program it by writing a tool with a routine called
Instrument
or
InstrumentAll
that calls Atom's
API, as described in the related reference pages. The API helps this routine
to discover the shared libraries, procedures, basic blocks, and instructions
that make up an application. Then the API helps the routine insert calls to
the tool's own run-time analysis routines, so that they will be invoked before
or after the application (or any of its libraries, procedures, blocks, or
instructions) are executed. The application code's behavior is unchanged in
the instrumented program, but the tools's analysis routines execute too, producing
tool-specific analysis data, such as an event trace or a profile.
Atom does not work on programs built with the -pg or -p option.
Instrumented code can be substantially larger than the original code. In rare cases, conditional branches that fit in the 21-bit branch displacement field may not do so in the instrumented version of the code, thus generating an error.
The following is a list of library routines that can and cannot be called: Standard C Library (libc.a) routines (including system calls) can be called except for: unwind(3) routines and other exception-handling routines pthread_atfork tis(3) routines
The standard I/O library provided to analysis routines does not automatically flush and close streams when the instrumented program terminates, so the analysis code must flush or close them explicitly, when all output has been completed.
Also the stdout and stderr streams that are provided to analysis routines will be closed when the application calls exit(), so analysis code may need to duplicate one or both of these streams if they need to be used after application exit (for example, in a ProgramAfter or ObjAfter analysis routine -- see AddCallProto(5)).
For output to stderr (or a duplicate of stderr) to appear immediately, analysis code should call setbuf(stream,NULL) to make the stream unbuffered or call fflush after each set of fprintf calls. Similarly, analysis routines using C++ streams can call cerr.flush().
Thread Local Storage (TLS) is not supported in analysis routines.
If you specify either the -all or -incobj switch, Atom instruments an application and the application's shared libraries. The instrumented shared libraries are written to the current directory with the .atom suffix. For example, libc.so is written as libc.so.atom.
By default, Atom searches for shared libraries in the same locations as the linker: /usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib
If you specify the -Ldir option, Atom searches the given directory before searching the default locations. You can specify multiple -Ldir options. You can also supply the -L option without a directory name. This causes Atom to avoid searching the default directories. Only those directories specified by -Ldir options are searched.
After you have instrumented an application that uses shared libraries, set the LD_LIBRARY_PATH environment variable to point to the directory containing the instrumented shared libraries. Typically, this would be the current directory or the directory specified by the -shlibdir option. You may leave LD_LIBRARY_PATH pointing to this directory while running other, uninstrumented applications.
The loader uses only the instrumented shared libraries for those applications
that have been instrumented. As long you choose a unique suffix name (using
the
-suffix
option) for the instrumented files, you can even
run an application instrumented with two different Atom tools. The loader
picks up the correctly instrumented shared library for each version of the
instrumented application.
The following prepackaged tools can be named with the -tool option:
Tool | Description |
third |
Performs memory access checks and detects
memory leaks in an application. See
third(5).
|
hiprof |
Produces a flat profile of an application
that shows the execution time spent in a given procedure, and a hierarchical
profile that shows the execution time spent in a given procedure and all its
descendents. See
hiprof(5).
|
pixie |
Produces a profile of an application -
by procedure, source line, or instruction - by partitioning it into
basic blocks and counting the number of times each basic block is executed.
See
pixie(5).
|
The following example tools can also be named with the -tool option. These tools are intended to show how new tools can be written. They may not work well on all applications:
Tool | Description |
branch |
Instruments all conditional branches to determine
how many are predicted correctly.
|
cache |
Determines cache miss rate. Simulates execution
of the application in 8KB direct-mapped cache.
|
dtb |
Determines the number of dtb (data translation
buffer) misses. Simulates execution of the application in 8KB pages and with
a fully associative translation buffer.
|
dyninst |
Provides fundamental dynamic counts of instructions,
loads, stores, blocks, and procedures.
|
inline | Identifies potential candidates for inlining. |
iprof |
Prints the number of times each procedure
is called as well as the number (dynamic count) of instructions executed by
each procedure.
|
malloc |
Records each call to the
malloc
function and prints a summary of the application's allocated memory.
|
prof |
Prints the number (dynamic count) of instructions
executed by each procedure, in a thread-safe manner.
|
ptrace | Prints the name of each procedure as it is called. |
trace |
Generates an address trace, logs the effective
address of every load and store operation, and logs the address of the start
of every basic block as it is executed.
|
This example invokes Atom's Third Degree tool to instrument program, producing the executable output file program.third. atom -tool third program This example instruments program using the instrumentation file my.inst.c and analysis file my.anal.c, producing the executable output file program.atom. atom program my.inst.c my.anal.c
Atom tools: third(5), hiprof(5), pixie(5)
Functions: atom_application_instrumentation(5), atom_application_navigation(5), atom_application_query(5), atom_application_resolvers(5), atom_description_file(5), atom_object_management(5), atom_instrumentation_routines(5), AnalHeapBase(5), Xlate(5)
Programmer's Guide