@(#)r3ctsrs.htm 1.4 - 02/12/04
This document gives the requirements for the C/C++ language
versions of the Recon3 Trace Manager (r3ctm) which includes
the Trace Manager Interface (r3ctmi), Trace Manager Client (r3ctmc),
and Trace Manager Server (r3ctms). It also
provides a sketch of a Conversion Utility (r3uanc)
used for backwards compatibility with the Recon2 analysis program.
The document is intended as a guide for developers, testers and maintainers
of these components.
1.2 Scope
The C/C++ Trace Manager (r3ctm) is part of the Recon3 tool set for the dynamic analysis of software. The reader of this SRS should first read [AR3] for many of the general concepts and terminology of Recon3.
[Note that only the basic architecture and extended architecture versions of the Trace Manager are specified at this time. Functionalities and components appearing only in the distributed architecture are mentioned only as placeholders for future development.]
The components described here are:
|
Block, Decision, Subroutine Entry and Subroutine Return |
See [AR3 section "Trace Events"] for definitions of these different kinds of trace event. |
|
Instrumentation Statements, Instrumented Target Program, Target Program, Trace Event |
See [AR3 section "Definitions, Acronyms and Abbreviations"] |
|
Trace Mode: immediate, subroutine, order, count |
See [AR3 section "Trace Modes"] |
|
Basic Architecture, Extended Architecture, Distributed Architecture |
See [AR3 section "Definitions, Acronyms and Abbreviations"] |
|
Trace Record |
See [AR3 section "Definitions, Acronyms and Abbreviations"] |
|
Trace Collection Process |
A trace manager client process initiated with
the |
|
Trace Control Process |
A trace manager client process initiated with
one of the trace control commands other
than |
|
[AR3] |
"The Architecture of Recon3" Norman Wilde, Laura White, Aaron Tarnosky |
This SRS follows roughly the ANSI/830 standard. Section 2 gives an overview of each of the components and its functional and other requirements. Section 3 gives the requirements more specifically.
Terms defined in section 1.3 will appear in emphasis, like this.
Where appropriate, program names, file names, and C/C++ language
constructs will appear in CODE format like
this.
[Brief explanations for certain requirements are given in block quotes like this one.]
The C/C++ Trace Manager (r3ctm) and the Conversion Utility (r3uanc) are components of Recon3 [AR3]. Recon3 is a collection of tools to facilitate dynamic software analysis though instrumentation. Instrumentation statements may be introduced into the target program by the programmer manually or by using Recon3's instrumentors for C/C++. (FORTRAN, Ada, and Java instrumentors will also be available.) The programmer compiles the instrumented target program and runs it. The instrumentation produces traces of execution which are then analyzed using Software Reconnaissance or other techniques. (See Figure 1 of [AR3] for a block diagram showing the general flow of Recon3.)
Figure 1 is a Data Flow Diagram overview of r3ctm and r3uanc. Figures 2 through 4 are Data Flow Diagrams showing the relationships of the components of r3ctm for the basic, extended, and distributed architectures.
Here is a typical scenario for using r3ctm in the basic architecture under Win32. (See also Figure 2).
r3.h to uncomment
#define statements that select
the platform and architecture, and then compile.)
r3ctminf.h.
The user may have modified them before compiling the instrumented
target program by editing this file.
r3ctminf.c, r3ctminf.h, and r3.h
and links to create the instrumented target executable.
R3TmiClose() is encountered
or until the instrumented target executable exits normally,
(in which case the operating system closes the trace file.)
r3uanc conversion utility to convert
them to Recon2 format, and then runs the Recon2 r2analyz
analysis program to locate a functionality.
Here is a typical scenario for using r3ctm in the extended architecture using count mode under Win32. (See also Figure 3).
r3.h to uncomment
#define statements that select
the platform and architecture, and then compile.)
r3ctminf.h.
The user may have modified them before compiling the instrumented
target program by editing this file.
In this particular scenario, he has
edited the file to select count mode.
r3ctminf.c and r3ulbsys.c
and links to create the instrumented target executable.
r3ctmc start config.txtR3ctmc immediately reads the trace configuration file
config.txt named on the command line,
to modify the initial trace configuration parameters.
It creates the shared memory and opens a trace file.
r3uanc conversion utility to convert
them to Recon2 format, and then runs the Recon2 r2analyz
analysis program to locate a functionality.
[Distributed architecture functions are not specified at this time.]
[Distributed architecture functions are not specified at this time.]
[Distributed architecture functions are not specified at this time.]
The user is expected to be an experienced programmer.
He will be familiar particularly with how to compile
and run the target program.
2.4 General Constraints
It is important that the Recon3 C/C++ Trace Manager should
be usable on as wide a variety of platforms as possible.
The three architectures basic, extended,
and distributed are intended to provide wide
flexibility. See [AR3] for a description of these
architectures and the platforms each must support.
While it is not possible to provide a quantifiable performance requirement, efficiency is very important for the Recon3 C/C++ Trace Manager because inefficiency may limit its potential applications. If the instrumented target program executes too slowly, users will not be able to use Recon3 except in very limited ways. Trace control functions are provided to let the user suspend and resume tracing and control the events and files to be traced (See 3.1.1.2 and 3.1.3.3). When tracing is disabled, it is especially important that little trace overhead is introduced.
In general developers are urged to take efficiency into
account at all points.
2.5 Assumptions and Dependencies
None.
3.0 Specific Requirements
3.1 Functional Requirements
3.1.1 Trace Manager Interface Functions - Basic Architecture
r3ctminf.h when the instrumented target program
was compiled. In all cases a record of the appropriate type
is written to the trace file.
| Trace Event | Function Prototype |
| Comment | void R3TmiComment(char *text);
text - User specified comment text. |
| Block | void R3TmiBlock(char *filename, int start_line, int end_line);
filename - Name of the source file in which the trace event occurred. start_line - Source file line number at the beginning of the block. end_line - Source file line number at the end of the block. |
| Decision (True) | int R3TmiTrue(char *filename, int line); return(1);
filename - Name of the source file in which the trace event occurred. line - Source file line number at which the trace event occurred. |
| Decision (False) | int R3TmiFalse(char *filename, int line); return(0);
filename - Name of the source file in which the trace event occurred. line - Source file line number at which the trace event occurred. |
| Decision (Switch) | int R3TmiSwitch(char *filename, int line, int value); return(value);
filename - Name of the source file in which the trace event occurred. line - Source file line number at which the trace event occurred. value - Value of the switch decision. |
| Subroutine (Entry) | void R3TmiEntry(char *filename, int line, char *function);
filename - Name of the source file in which the trace event occurred. line - Source file line number of the function entry point. function - Name of the function in which the trace event occurred. |
| Subroutine (Return) | void R3TmiReturn(char *filename, int line, char *function);
filename - Name of the source file in which the trace event occurred. line - Source file line number of the return statement. function - Name of the function in which the trace event occurred. |
| Task (Start) | void R3TmiStart(char *filename, int line, char *text);
filename - Name of the source file in which the trace event occurred. line - Source file line number at which the trace event occurred. text - User specified text. |
| Task (Rendevous) | void R3TmiRendevous(char *filename, int line, char *text);
filename - Name of the source file in which the trace event occurred. line - Source file line number at which the trace event occurred. text - User specified text. |
| Task (Stop) | void R3TmiStop(char *filename, int line, char *text);
filename - Name of the source file in which the trace event occurred. line - Source file line number at which the trace event occurred. text - User specified text. |
| User | void R3TmiUser(char *filename, int line, char *text);
filename - Name of the source file in which the trace event occurred. line - Source file line number at which the trace event occurred. text - User specified text. |
| Exit | int R3TmiExit(char *filename, int line, int value); return(value);
filename - Name of the source file in which the trace event occurred. line - Source file line number at which the trace event occurred. value - Value of the exit code. |
| Trace Command | Function Prototype | Action Taken |
| Suspend | void R3TmiSuspend(void); | Writing of trace records is suspended until R3TmiResume() is called. |
| Resume | void R3TmiResume(void); | Tracing is resumed. |
r3ctmc start command
described in Table 3.
r3ctminf.h when r3ctmc was compiled.
The user shall be able to override the default paramaters in
a configuration file read at startup.
The name of the configuration file will either be set in r3ctminf.h
or else will be specified as part of the r3ctmc start command.
frame_delay timer controls writing to the
trace file. Each time the timer expires, the internal
data structrues are traversed and the corresponding records
are written to the trace file.
r3ctmc stop
trace control command is given (see 3.1.3.2).
Note that either the instrumented target program or the r3tmc trace collection process may start first.
See [AR3] for the trace file format (trace records).
config
section of shared memory immediately. Others,
are written to the records section and are
picked up and handled by the trace collection process
on its next cycle. (See Figure 3).
[The echoed trace command is provided to facilitate debugging and to help the user interpret the trace of execution]
The trace manager client program command line usage will be similar to the one shown below:
r3ctmc <command> [parameter]
command - trace command
parameter - additional command information
Trace commands are shown in Table 3 and diagnostic commands
in Table 4.
| Command | Parameter | Description |
| comment | <text> | Generates a comment trace event. |
| delay | <seconds> | Sets the length of the trace frame in seconds. If the specified value is zero, the frame time will be infinite and the trace file will be written only when tracing terminates or when a newtrace or newframe command is given. |
| eventoff | <a|bcdstux> | Disables tracing for a particular type of trace event: a = all events, b = block, c = comment, d = decision, s = subroutine, t = task, u = user, x = exit. |
| eventon | <a|bcdstux> | Enables tracing for a particular type of trace event: a = all events, b = block, c = comment, d = decision, s = subroutine, t = task, u = user, x = exit. |
| filelist | N/A | Lists the name of each source file encountered so far and indicates whether tracing is enabled for the file. The list is written to the trace file as a series of comment records. |
| fileoff | <file> | Disables tracing for a particular source file. The file name must be exactly the same as that used in the instrumentation. |
| fileon | <file> | Enables tracing for a particular source file. The file name must be exactly the same as that used in the instrumentation. |
| itemoff | <a|hpt> | Disables logging of optional trace data items: a = all items, h = thread id, p = process id, t = time. |
| itemon | <a|hpt> | Enables logging of optional trace data items: a = all items, h = thread id, p = process id, t = time. |
| mode | <c|i|o|s> | Sets the trace mode. Exactly one character must be specified to indicate the mode type: c = count, i = immediate, o = order, s = subroutine. |
| newconfig | <file> | Loads a new trace configuration file. Default values will be used for configuration parameters not present in the file. If a file is not specified or cannot be opened, default values will be used for all configuration parameters. |
| newframe | N/A | Flushes the trace records from shared memory to internal data structures, writes the internal data structures to the trace output file, and initializes a new trace frame. |
| newtrace | <file> | Flushes the trace records from shared memory to internal data structures, writes the internal data structures to the current trace file, closes the current trace file, and creates a new trace file. |
| resume | N/A | Instructs the trace manager interface to examine all trace events and process those that are set to the enabled state. |
| start | [file] | Starts the trace manager and loads a configuration file. Default values will be used for configuration parameters not present in the file. If a file is not specified or cannot be opened, default values will be used for all configuration parameters. |
| stop | N/A | Stops the trace manager. All instrumented executables currently connected to the trace manager will detect this condition and automatically disconnect. |
| suspend | N/A | Instructs the trace manager interface to ignore all trace events until a resume command is given. |
| Command | Parameter | Description |
| buffersize | N/A | Writes to standard error the maximum number of records that can be stored in the trace record buffer in shared memory, and the size of the buffer in megabytes |
| configlist | [totrace] | Lists the names and values of several trace configuration parameters. If no parameter is specified, the information will be written to standard output. If the totrace parameter is specified, the information will be written to the trace file as a series of comment records. |
| countoff | N/A | Disables display of record counts. |
| counton | N/A | Turns on display of record counts. |
| help | <command> | Writes usage information on a command to standard error |
| rmipc | N/A | Destroys all semaphores and shared memory associated with the trace manager. |
[Distributed architecture functions are not specified at this time.]
[Distributed architecture functions are not specified at this time.]
r3uanc <source> <destination>
source - input trace file in Recon 3 format
destination - output trace file in Recon 2 format
NOTES: If a hyphen (-) is specified for the source file
name, input will be read from the standard input device.
If a hyphen (-) is specified for the destination file
name, output will be written to the standard output device.
r3.h.
For further information consult the comments in r3.h.
3.2.2 Compilation of the Trace Manager Interface
The trace manager interface must be compiled and linked with
the user's instrumented target program.
The files needed for compilation are given in Table 5.
| Architecture | Needed Files |
| Basic | r3.h, r3ctminf.h, r3ctminf.c |
| Extended | r3.h, r3ctminf.h, r3ctminf.c, r3ulbsys.h, r3ulbsys.c |
| Distributed | [Distributed architecture functions are not specified at this time.] |
During this process, initial trace configuration parameters
may be set by modifying the file r3ctminf.h.
[This means of controlling the trace
is provided as an alternative to the configuration
file loaded when the r3ctmc start command is
given and to the other r3ctmc trace control
commands mentioned earlier
since for some environments and
target programs r3ctmc may not be useable.]
See section (2.4).
3.4 Design Constraints
See section (2.4).
3.5 Attributes
For maximum portability and to facilitate maintenance,
the C/C++ Trace Manager components shall be implemented
using ANSI standard C, and using non-ANSI operating system
functions only where essential, for example to implement shared
memory.
3.6 Other Requirements
None
Appendixes
None