#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include "devel_doc.h"
#include "defines.h"
#include "exclude.h"
#include "merge.h"
#include "obfuscate.h"
#include "profiler.h"
#include "rank.h"
#include "report.h"
#include "score.h"
#include "util.h"
Functions | |
| void | usage () |
| int | main (int argc, const char **argv) |
Variables | |
| exception_context | the_exception_context [1] |
| char | user_msg [USER_MSG_LENGTH] |
| char * | ppfilename |
| int64 | curr_malloc_size |
| bool | test_mode |
|
||||||||||||
|
00113 {
00114
00115 int retval = EXIT_SUCCESS; /* Return value of this utility */
00116 int curr_arg = 1; /* Current position in argument list */
00117 bool cmd_found = FALSE; /* Set to TRUE when command found in arg list */
00118
00119 /* Initialize the exception context */
00120 init_exception_context( the_exception_context );
00121
00122 /* Initialize error suppression value */
00123 set_output_suppression( FALSE );
00124 set_debug( FALSE );
00125 #ifdef TESTMODE
00126 set_testmode();
00127 #endif
00128 obfuscate_set_mode( FALSE );
00129 profiler_set_mode( FALSE );
00130
00131 Try {
00132
00133 if( argc == 1 ) {
00134
00135 print_output( "Must specify a command (score, merge, report, rank, -v, or -h)", FATAL, __FILE__, __LINE__ );
00136 retval = -1;
00137
00138 } else {
00139
00140 if( strncmp( "-v", argv[1], 2 ) == 0 ) {
00141
00142 /* Display version of Covered */
00143 print_output( COVERED_VERSION, NORMAL, __FILE__, __LINE__ );
00144
00145 } else if( strncmp( "-h", argv[1], 2 ) == 0 ) {
00146
00147 usage();
00148
00149 } else {
00150
00151 do {
00152
00153 if( strncmp( "-Q", argv[curr_arg], 2 ) == 0 ) {
00154
00155 set_output_suppression( TRUE );
00156
00157 } else if( strncmp( "-D", argv[curr_arg], 2 ) == 0 ) {
00158
00159 #ifdef DEBUG_MODE
00160 set_debug( TRUE );
00161 #else
00162 print_output( "Global command -D can only be used when Covered is configured with the --enable-debug flag when being built", WARNING, __FILE__, __LINE__ );
00163 #endif
00164
00165 } else if( strncmp( "-P", argv[curr_arg], 2 ) == 0 ) {
00166
00167 #ifdef PROFILER
00168 profiler_set_mode( TRUE );
00169 curr_arg++;
00170 if( (curr_arg < argc) && (argv[curr_arg][0] != '-') &&
00171 (strncmp( "score", argv[curr_arg], 5 ) != 0) &&
00172 (strncmp( "merge", argv[curr_arg], 5 ) != 0) &&
00173 (strncmp( "report", argv[curr_arg], 6 ) != 0)) {
00174 profiler_set_filename( argv[curr_arg] );
00175 } else {
00176 curr_arg--;
00177 profiler_set_filename( PROFILING_OUTPUT_NAME );
00178 }
00179 #else
00180 print_output( "Global command -P can only be used when Covered is configured with the --enable-profiling flag when being built", WARNING, __FILE__, __LINE__ );
00181 #endif
00182
00183 } else if( strncmp( "-B", argv[curr_arg], 2 ) == 0 ) {
00184
00185 obfuscate_set_mode( TRUE );
00186
00187 } else if( strncmp( "score", argv[curr_arg], 5 ) == 0 ) {
00188
00189 command_score( argc, curr_arg, argv );
00190 cmd_found = TRUE;
00191
00192 } else if( strncmp( "merge", argv[curr_arg], 5 ) == 0 ) {
00193
00194 command_merge( argc, curr_arg, argv );
00195 cmd_found = TRUE;
00196
00197 } else if( strncmp( "report", argv[curr_arg], 6 ) == 0 ) {
00198
00199 command_report( argc, curr_arg, argv );
00200 cmd_found = TRUE;
00201
00202 } else if( strncmp( "rank", argv[curr_arg], 4 ) == 0 ) {
00203
00204 command_rank( argc, curr_arg, argv );
00205 cmd_found = TRUE;
00206
00207 } else if( strncmp( "exclude", argv[curr_arg], 7 ) == 0 ) {
00208
00209 command_exclude( argc, curr_arg, argv );
00210 cmd_found = TRUE;
00211
00212 } else {
00213
00214 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Unknown command/global option \"%s\". Please see \"covered -h\" for usage.", argv[curr_arg] );
00215 assert( rv < USER_MSG_LENGTH );
00216 print_output( user_msg, FATAL, __FILE__, __LINE__ );
00217 Throw 0;
00218
00219 }
00220
00221 curr_arg++;
00222
00223 } while( (curr_arg < argc) && !cmd_found );
00224
00225 if( !cmd_found ) {
00226
00227 print_output( "Must specify a command (score, merge, report, rank, exclude, -v, or -h)", FATAL, __FILE__, __LINE__ );
00228 Throw 0;
00229
00230 }
00231
00232 }
00233
00234 }
00235
00236 } Catch_anonymous {
00237 retval = EXIT_FAILURE;
00238 }
00239
00240 /* Deallocate obfuscation tree */
00241 obfuscate_dealloc();
00242
00243 /* Output profiling information, if necessary */
00244 profiler_report();
00245
00246 #ifdef TESTMODE
00247 /* Make sure that all of our allocate memory has been deallocated */
00248 if( test_mode ) {
00249 printf( "curr_malloc_size: %lld\n", curr_malloc_size );
00250 assert( curr_malloc_size == 0 );
00251 }
00252 #endif
00253
00254 return( retval );
00255
00256 }
|
|
|
Displays usage information about this utility.
00061 {
00062
00063 printf( "\n" );
00064 #ifdef DEBUG_MODE
00065 #ifdef PROFILER
00066 printf( "Usage: covered (-h | -v | (-D | -Q) (-P [<file>]) (-B) <command> <command_options>))\n" );
00067 #else
00068 printf( "Usage: covered (-h | -v | (-D | -Q) (-B) <command> <command_options>))\n" );
00069 #endif
00070 #else
00071 #ifdef PROFILER
00072 printf( "Usage: covered (-h | -v | (-Q) (-P [<file>]) (-B) <command> <command_options>))\n" );
00073 #else
00074 printf( "Usage: covered (-h | -v | (-Q) (-B) <command> <command_options>))\n" );
00075 #endif
00076 #endif
00077 printf( "\n" );
00078 printf( " Options:\n" );
00079 #ifdef DEBUG_MODE
00080 printf( " -D Debug. Display information helpful for debugging tool problems\n" );
00081 #endif
00082 #ifdef PROFILER
00083 printf( " -P [<file>] Profile. Generate profiling information file from command. Default output file is covered.prof\n" );
00084 #endif
00085 printf( " -Q Quiet mode. Causes all output to be suppressed\n" );
00086 printf( " -B Obfuscate. Obfuscates design-sensitive names in all user-readable output\n" );
00087 printf( " -v Version. Display current Covered version\n" );
00088 printf( " -h Help. Display this usage information\n" );
00089 printf( "\n" );
00090 printf( " Commands:\n" );
00091 printf( " score Parses Verilog files and VCD dumpfiles to create database file used\n" );
00092 printf( " for merging and reporting.\n" );
00093 printf( " merge Merges two database files into one.\n" );
00094 printf( " report Generates human-readable coverage reports from database file.\n" );
00095 printf( " rank Generates ranked list of CDD files to run for optimal coverage in a regression run.\n" );
00096 printf( " exclude Excludes coverage points from a given CDD and saves the modified CDD for further commands.\n" );
00097 printf( "\n" );
00098 printf( " For individual help information for each of the above commands, enter:\n" );
00099 printf( " covered <command> -h\n" );
00100 printf( "\n" );
00101
00102 }
|
|
|
Contains the total number of bytes malloc'ed during the simulation run. This information is output to the user after simulation as a performance indicator. |
|
|
Name of preprocessor filename to use |
|
|
If set to TRUE, outputs memory information to standard output for processing. |
|
|
Exception context structure used by cexcept.h for throwing and catching exceptions. |
|
|
Holds some output that will be displayed via the print_output command. This is created globally so that memory does not need to be reallocated for each function that wishes to use it. |
1.3.4