TCAT C/C++, Ver. 3.1
RELEASE NOTES © Copyright 1999-2006 by Software Research, Inc. |
These Release Notes describe changes and additions to TCAT C/C++ made in Ver. 3.1 for Windows 98/NT/2000.
You can download either of two versions of TCAT for C/C++: (1) a DEMO version, which does not require a license key; and (2) the FULL version, which requires a license key.
The current releases of TCAT C/C++ Ver. 3.1 and TCAT/Java Ver. 3.1 include the All Paths Generator (APG). APG's aim is to give C-C++ and Java programmers instant information about the relative structural complexity of individual functions and modules/objects.
The new APG feature is accessed from buttons on the TCAT C/C++ or TCAT/Java Digraph toolbar. The data generated always relates to the current function or module and gives the following information:
In addition, the APG outputs include a complete enumeration of all of the equivalence classes of program flow, up to a repetition count within the looping structure. Studies have shown a high correlation between the APG-generated total path count and the discovery rate of errors for that particular module.
Click here for more information on APG.
The DEMO version does not require a separate license key; it has a key that is valid for a period up to 10 days [it is refreshed regularly]. The DEMO version has these restrictions:
One complete example, Fib.cpp, is included to illustrate product operation.
We supply versions of runtmdll_?.dll that are buffered with various buffer lengths. You have to copy the correct file into your copy of runtmdll.dll to get the right buffering effect. The default version is runtmdll_inf.dll.
The supplied versions buffer at the level of 1, 10, 100, 1000, 10,000, 100,000 and infinite buffering. Buffering is accomplished based on the total number of hits made of segments and/or call-pairs.
The various versions of runtime that are available are named as follows:
Hits per Buffer | Class Name |
1 | runtmdll_1.dll |
10 | runtmdll_10.dll |
100 | runtmdll_100.dll |
1000 | runtmdll_1000.dll |
10,000 | runtmdll_10000.dll |
100,000 | runtmdll_100000.dll |
Infinite | runtmdll_inf.dll |
These runtime modules are installed into the $SR/program directory, where $SR is your TCAT C/C++ installation directory.
TCAT C/C++ should process virtually any compilable C or C++ program without difficulty. However, there are some restrictions that users should be aware of.
Here is the consolidated list of instrumenter command line switches available to the TCAT C/C++ instrumenter. The instrumenter command instruments submitted C or C++ language file(s). The switches shown in the following table may be used to vary the processing and reports generated by the instrumenter.
Note that most of the commands are prefixed with -TCAT. This is done because all other switches are passed in their entirety to the underlying C or C++ compiler. The -TCAT prefix indicates that these switches are for TCAT C/C++ processing.
The command is issued as follows:
ic9 [-TCAT-switches] [other-switches] [file]
where,
[file] specifies the file to be instrumented. There must be exactly one file.[-TCAT-switches] are switches that are sensed by the instrumenter.
-D and -I switches, which are processed by the instrumenter and then passed to the compiler.
[other-switches] switches are passed to the CL command verbatim.
Note that some of the possible switches, which are not preceded with -TCAT, are allowed to be added as often as needed by most C or C++ compilers.
TCAT C/C++ Complete Instrumenter Command Line Switch Options |
|||
Switch Syntax | Switch Name | Explanation | Default |
file.ext | Instrumented File Specification(s). | File(s) to be instrumented. The extension can be c or i or cc (for C++).
If there are multiple files each one is processed in the order presented and they are treated as if they have been concatenated together. | OFF |
@options | Options File Processing.
"Read the options for instrumentation from the named file." | To prevent problems in case many TCAT options are specified it may be desirable to specify all TCAT options in a local file and point at that file with this switch in the actual instrumentation call. | Normal Operation from the Command Line. |
-TCAT-A | ANSI Recognition Switch. | If present, the instrumenter recognizes only the ANSI version of C. | If set, ANSI C, or else C++. |
-TCAT-Cmd driver | Compiler Driver Command Switch. | Specifies the compiler to call after doing TCAT's work. | Default driver is CL. |
-TCAT-C1 | C1 Instrumentation Switch. | If this switch is present, then the instrumenter inserts a function call in each segment or logical branch. | ON |
-TCAT-DI | Selective De-Instrumentation
"Instrument everything EXCEPT what is named in this list." | The specified file contains a list of names, one name per line,
which, if encountered, are NOT instrumented. If file is
empty then everything presented to the instrumenter is instrumented.
TCAT assumes that the Selective De-Instrumentation data is found in the the file: .\projectdir\tcat_db\projectname\projectname.di. Note that specifying objects in this file without using this switch will not turn off instrumentation. | C1 instrumentation is ON. |
-TCAT-G | Instrumented File Disposition Switch. | Normally the instrumenter does not keep the instrumented file, it already having been used to produce the instrumented output. When this switch is present the instrumented files are retained. | OFF |
-TCAT-Help | Help Message Switch. | Prints out the set of currently valid switches. | N/A |
-TCAT-K | K&R C Recognition Switch. | If present, the instrumenter recognizes K&R C. | OFF |
-TCAT-O file | Output File Specification. | The output of the instrumentation process is directed to the named file. | file.i |
-TCAT-pd directory | Project Directory Specification | Normally TCAT places all database information in a set of directories under tcat_db directory located at the current working directory. In case the instrumenter will be called from a variety of directories, this switch forces the instrumentation process to use ONLY the specified working directory. | Current working directory. |
-TCAT-purge | Purge Database Option.
"Start a new tcat_db database with each instrumentation run." | Normally as instrumentation proceeds the information in the tcat_db files is updated so that it includes the aggregate of all data the instrumenter has ever seen. If you wish to focus ONLY on the source programs that are the current subject of analysis, this switch will cause the instrumenter to delete the prior database first. | Normal Operation in with Data is Aggregated. |
-TCAT-S0 | S0 Instrumentation Switch. | If this switch is present, then the instrumenter inserts a function call in each module. This will tell you which functions are actually called during the invocation of the program, but it does not indicate the called functions. To do this, you need to use the -S1 switch. | OFF |
-TCAT-S1 | S1 Instrumentation Switch. | If this switch is present, then the instrumenter inserts a function call in each call pair. | OFF |
-TCAT-SI | Selective Instrumentation Switch.
"Instrument nothing EXCEPT what is named in this list." | The specified file contains a list of names, one name per line,
which, when encountered, are instrumented. If the file is empty and/or
if no names match, then NO instrumentation is performed.
TCAT assumes that the Selective Instrumentation data is found in the the file: .\projectdir\tcat_db\projectname\projectname.si. (See below for a description of the order of searching.) | Normal Operation. |
-TCAT-T | Template Instrumentation
Turn on Template Instrumentation | Normally defaulted to OFF to conserve space and to avoid instrumenting code that is of little interest to the current test project, this switch turns ON fully automatic processing of templates. Users should understand that instrumenting templates, particularly if the MFCs are used, may result in very large tcat_db areas that contain data about templates that may never or only very seldom be executed. | Template instrumentation is OFF. |
-Ddefs[=val] | Establish Definition Switch. | Establishes a definition that is being passed on to the compiler.
Note that there can be any number of instances of this switch. | OFF |
-Ipath | Include File Search Path Specification. | Specifies the path on which to resolve the search for #include files.
Note that there can be any number of instances of this switch. | N/A |
-Uunefs[=val] | De-Establish (Undefine) Definition Switch. | Removes a definition that is being passed on to the compiler.
Note that there can be any number of instances of this switch. | N/A |
You use the -TCAT-SI switch to select the objects you want to instrument. The file contains a list of names, left adjusted, one name per line, of compilable objects that should be instrumented in the current execution of the TCAT instrumenter.
Typically you would use the Selective Instrumentation option when you want to focus attention on only a small number of functions. Objects named in the list are instrumented. All other code is processed normally but is NOT instrumented.
NOTE: If the -TCAT-DI switch and the -TCAT-SI are both present, and if a object name appears in both files, then the name is not instrumented. In other words, de-instrumentation takes precedence.
The names found in the Selective Instrumentation file are processed and matched in the current run of the instrumenter in the following order:
You use the -TCAT-DI switch to select the objects you do NOT want to instrument. The file contains a list of names, left adjusted, one name per line, of compilable objects that should NOT be instrumented in the current execution of the TCAT instrumenter.
Typically you would use the Selective De-Instrumentation option when you want to avoid instrumentation of selected objects, probably because they have already been thoroughly tested, or possibly because instrumentation of these objects would increase the test coverage data collection overhead.
All objects seen by the instrumenter and NOT named in the list are instrumented.
NOTE: If the -TCAT-DI switch and the -TCAT-SI are both present, and if a object name appears in both files, then the name is not instrumented. In other words, de-instrumentation takes precedence.
The names found in the Selective De-Instrumentation file are processed and matched in the current run of the instrumenter in the following order:
The TCAT instrumenter invokes the native compiler after completing its processing steps. To instrument a program correctly the compiler options need to be set correctly.
The compiler options vary with your application and they can be copied directly from Visual C++ settings. To find the compiler options you need select Settings for the project. Then select the appropriate Project Settings. Select C/C++. The options that are needed can be found in the field Project Options.
Two example compiler options settings are listed below.
/nologo /MDd /W3 /Gm /GX /Zi /Od /DWIN32 /D_DEBUG /D_WINDOWS /D_AFXDLL /D_MBCS /Fo".\Debug/" /Fd".\Debug/" /FD /c
Scribble Release Version compiler options
/nologo /MD /W3 /GX /O2 /DWIN32 /DNDEBUG /D_WINDOWS /D_AFXDLL /D_MBCS /Fo".\Release/" /Fd".\Release/" /FD /c
The compiler options can also be read from a file using the @OPTIONS <filename> switch described elsewhere in this Release Note.
@SRop.txt /Fo".\Debug/" /Fd".\Debug/" /FD /c
This will also read options from a file named "SRop.txt" in the directory when the files are instrumented (e.g. the source dir of scribble.)
The file "SRop.txt" contains:
/nologo /MDd /W3 /Gm /GX /Zi /Od /DWIN32 /D_DEBUG /D_WINDOWS /D_AFXDLL /D_MBCS
The TCAT C/C++ instrumenter has been changed to preserve any #pragma directives found during the preprocessing and instrumentation step. Such directives will be sent on to the compiler.
In addition, because Visual C++ Studio uses /M flags to define additional macros which will affect decisions taken regarding library linkage, we have modified TCAT C/C++ to be able to pass all /M flags through without modification. (Examples of /M flags include /ML, /MT, /MD, /MLd, /MTd and /MDd).
This version of TCAT C/C++ fixes problems that used to occur when backslashes (\'s) were encountered. In some cases these characters were incorrectly processed and instrumentation errors could result.
This version of TCAT C/C++ adds the capability to process compiler flags starting with /. In earlier versions instrumentation options had to start with -. This is done because Microsoft compilers commonly accept either form.
Certain constraints apply to this version of TCAT C/C++ for Windows.
if ( obj_a . mf1 ( ) && obj_a . mf2 ( ) ) i = obj_a . mf1 ( ) + obj_a . mf2 ( ) ; j = f () * obj_a . mf1 ( ) ; ==> if ( ExpHit(1, 4, (CprHit(1, 1), obj_a . mf1 ( ) ) && (CprHit(1, 2), obj_a . mf2 ( ) ) ) ) i = (CprHit(1, 3), obj_a . mf1 ( ) ) + (CprHit(1, 4), obj_a . mf2 ( ) ); i = (CprHit(1, 5), f ( ) ) * (CprHit(1, 4), obj_a . mf1 ( ) );However, the ic9 instrumenter can only instrument one single function call if the calls are nested or chained, as illustrated in this example passage:
f(f1(),f2()); f(i, f2()); f3(obj_a.mf2()); obj_a.mf1().mf2(); obj_b.mf3()->mf4(); ==> (CprHit(1, 19), f ( f1 (), f2 ( ) ) ) ; (CprHit(1, 20), f ( i, f2 ( ) ) ) ; (CprHit(1, 21), f3 ( obj_a.mf2 ( ) ) ) ; (CprHit(1, 22), obj_a . mf1 ( ) . mf2 ( ) ) ; (CprHit(1, 23), obj_b . mf3 ( ) -> mf4 ( ) );Note: In the above obj_a, obj_b are objects, mf?() are methods, and f?() are functions.
int f(int a) { while (1) { if (cond1) { .... return a; } else if (cond2) return b else { .... } } }This problem is specific to Microsoft Visual C++ only.