GCC Middle and Back End API Reference
|
Data Structures | |
struct | arc_info |
struct | block_info |
struct | function_info |
struct | coverage_info |
struct | line_info |
struct | source_info |
struct | name_map |
Typedefs | |
typedef struct arc_info | arc_t |
typedef struct block_info | block_t |
typedef struct function_info | function_t |
typedef struct coverage_info | coverage_t |
typedef struct line_info | line_t |
typedef struct source_info | source_t |
typedef struct name_map | name_map_t |
Functions | |
static int | process_args (int, char **) |
static void | print_usage (static int output_branch_count(FILE int) |
static void | print_usage () |
static void | print_version () |
static int | process_args () |
static char * | get_gcov_intermediate_filename () |
static void | output_intermediate_file () |
static void | process_file () |
static void | output_gcov_file () |
static void | generate_results () |
static void | release_function () |
static void | release_structures () |
static void | create_file_names () |
static int | name_search () |
static int | name_sort () |
static unsigned | find_source () |
static function_t * | read_graph_file () |
static int | read_count_file () |
static void | solve_flow_graph () |
static void | find_exception_blocks () |
static void | add_branch_counts () |
static char const * | format_gcov () |
static void | executed_summary () |
static void | function_summary () |
static char * | canonicalize_name () |
static char * | make_gcov_file_name () |
static char * | mangle_name () |
static void | add_line_counts () |
static void | accumulate_line_counts () |
static int | output_branch_count () |
static const char * | read_line () |
static void | output_lines () |
Variables | |
static function_t * | functions |
static function_t ** | fn_end = &functions |
static source_t * | sources |
static unsigned | n_sources |
static unsigned | a_sources |
static name_map_t * | names |
static unsigned | n_names |
static unsigned | a_names |
static unsigned | object_runs |
static unsigned | program_count |
static unsigned | total_lines |
static unsigned | total_executed |
static time_t | bbg_file_time |
static char * | bbg_file_name |
static unsigned | bbg_stamp |
static char * | da_file_name |
static int | no_data_file |
static int | multiple_files = 0 |
static int | flag_branches = 0 |
static int | flag_unconditional = 0 |
static int | flag_gcov_file = 1 |
static int | flag_display_progress = 0 |
static int | flag_intermediate_format = 0 |
static int | flag_demangled_names = 0 |
static int | flag_long_names = 0 |
static int | flag_all_blocks = 0 |
static int | flag_function_summary = 0 |
static char * | object_directory = 0 |
static char * | source_prefix = 0 |
static size_t | source_length = 0 |
static int | flag_relative_only = 0 |
static int | flag_preserve_paths = 0 |
static int | flag_counts = 0 |
static struct option | options [] |
typedef struct block_info block_t |
Describes a basic block. Contains lists of arcs to successor and predecessor blocks.
typedef struct coverage_info coverage_t |
Describes coverage of a file or function.
typedef struct function_info function_t |
Describes a single function. Contains an array of basic blocks.
Describes a single line of source. Contains a chain of basic blocks with code on it.
typedef struct name_map name_map_t |
typedef struct source_info source_t |
Describes a file mentioned in the block graph. Contains an array of line info.
|
static |
Accumulate the line counts of a file.
References add_branch_counts(), line_info::blocks, line_info::branches, block_info::chain, count, arc_info::count, line_info::count, source_info::coverage, arc_info::cs_count, arc_info::cycle, block_info::cycle, arc_info::dst, line_info::exists, flag_all_blocks, flag_branches, source_info::functions, arc_info::line_next, function_info::line_next, coverage_info::lines, source_info::lines, coverage_info::lines_executed, source_info::num_lines, block_info::pred, arc_info::pred_next, arc_info::src, block_info::succ, arc_info::succ_next, block_info::u, and line_info::u.
Referenced by generate_results().
|
static |
Increment totals in COVERAGE according to arc ARC.
References coverage_info::branches, coverage_info::branches_executed, coverage_info::branches_taken, coverage_info::calls, coverage_info::calls_executed, arc_info::count, block_info::count, arc_info::is_call_non_return, arc_info::is_unconditional, and arc_info::src.
Referenced by accumulate_line_counts(), and add_line_counts().
|
static |
Scan through the bb_data for each line in the block, increment the line number execution count indicated by the execution count of the appropriate basic block.
References add_branch_counts(), bbg_file_name, function_info::blocks, line_info::blocks, function_info::blocks_executed, line_info::branches, block_info::chain, block_info::count, line_info::count, block_info::cycle, block_info::exceptional, line_info::exists, flag_all_blocks, flag_branches, fnotice(), free(), arc_info::is_unconditional, block_info::line, function_info::line, arc_info::line_next, coverage_info::lines, source_info::lines, coverage_info::lines_executed, function_info::name, function_info::num_blocks, function_info::src, block_info::succ, arc_info::succ_next, block_info::u, line_info::u, and line_info::unexceptional.
Referenced by generate_results().
|
static |
Canonicalize the filename NAME by canonicalizing directory separators, eliding . components and resolving .. components appropriately. Always returns a unique string.
References len, memcpy(), function_info::name, and strlen().
Referenced by find_source(), and generate_results().
|
static |
Generate the names of the graph and data files. If OBJECT_DIRECTORY is not specified, these are named from FILE_NAME sans extension. If OBJECT_DIRECTORY is specified and is a directory, the files are in that directory, but named from the basename of the FILE_NAME, sans extension. Otherwise OBJECT_DIRECTORY is taken to be the name of the object *file* and the data files are named from that.
References bbg_file_name, bbg_file_time, bbg_stamp, da_file_name, free(), object_directory, and strlen().
Referenced by process_file().
|
static |
Summary of execution
References fnotice(), and format_gcov().
Referenced by function_summary(), and generate_results().
|
static |
Mark all the blocks only reachable via an incoming catch.
References function_info::blocks, arc_info::dst, block_info::exceptional, arc_info::fake, arc_info::is_throw, function_info::num_blocks, queue, block_info::succ, and arc_info::succ_next.
Referenced by process_file().
|
static |
Find or create a source file structure for FILE_NAME. Copies FILE_NAME on creation
References a_names, a_sources, bbg_file_name, bbg_file_time, canonicalize_name(), source_info::coverage, source_info::file_time, fnotice(), free(), memcpy(), memset(), n_names, n_sources, coverage_info::name, source_info::name, name_map::name, name_search(), name_sort(), source_length, source_prefix, and name_map::src.
Referenced by read_graph_file().
|
static |
Format a GCOV_TYPE integer as either a percent ratio, or absolute count. If dp >= 0, format TOP/BOTTOM * 100 to DP decimal places. If DP is zero, no decimal point is printed. Only print 100% when TOP==BOTTOM and only print 0% when TOP=0. If dp < 0, then simply format TOP. Return pointer to a static string.
References buffer, HOST_WIDEST_INT, HOST_WIDEST_INT_PRINT_DEC, and limit.
Referenced by executed_summary(), function_summary(), output_branch_count(), output_intermediate_file(), and output_lines().
|
static |
Output summary info for a function or file.
References coverage_info::branches, coverage_info::branches_executed, coverage_info::branches_taken, coverage_info::calls, coverage_info::calls_executed, executed_summary(), flag_branches, fnotice(), format_gcov(), coverage_info::lines, coverage_info::lines_executed, and coverage_info::name.
Referenced by generate_results().
|
static |
References accumulate_line_counts(), add_line_counts(), canonicalize_name(), source_info::coverage, function_info::demangled_name, executed_summary(), first, flag_demangled_names, flag_function_summary, flag_gcov_file, flag_intermediate_format, flag_relative_only, fnotice(), function_summary(), get_gcov_intermediate_filename(), coverage_info::lines, source_info::lines, coverage_info::lines_executed, memset(), n_names, n_sources, function_info::name, coverage_info::name, name_search(), function_info::next, source_info::num_lines, output_gcov_file(), output_intermediate_file(), name_map::src, total_executed, and total_lines.
Referenced by print_usage().
|
static |
Get the name of the gcov file. The return value must be free'd. It appends the '.gcov' extension to the *basename* of the file. The resulting file name will be in PWD. e.g., input: foo.da, output: foo.da.gcov input: a/b/foo.cc, output: foo.cc.gcov
References strlen().
Referenced by generate_results().
|
static |
Generate an output file name. INPUT_NAME is the canonicalized main input file and SRC_NAME is the canonicalized file name. LONG_OUTPUT_NAMES and PRESERVE_PATHS affect name generation. With long_output_names we prepend the processed name of the input file to each output name (except when the current source file is the input file, so you don't get a double concatenation). The two components are separated by '##'. With preserve_paths we create a filename from all path components of the source file, replacing '/' with '#', and .. with '^', without it we simply take the basename component. (Remember, the canonicalized name will already have elided '.' components and converted \\ separators.)
References flag_long_names, mangle_name(), and strlen().
Referenced by output_gcov_file().
|
static |
References flag_preserve_paths, len, memcpy(), and strlen().
Referenced by make_gcov_file_name().
|
static |
A is a string and B is a pointer to name_map_t. Compare for file name orderability.
References name_map::name.
Referenced by find_source(), generate_results(), and name_sort().
|
static |
A and B are a pointer to name_map_t. Compare for file name orderability.
References name_map::name, and name_search().
Referenced by find_source().
|
static |
Output information about ARC number IX. Returns nonzero if anything is output.
References arc_info::count, block_info::count, arc_info::dst, arc_info::fall_through, flag_counts, flag_unconditional, fnotice(), format_gcov(), arc_info::is_call_non_return, block_info::is_call_return, arc_info::is_throw, arc_info::is_unconditional, and arc_info::src.
Referenced by output_lines().
|
static |
References source_info::coverage, fnotice(), free(), coverage_info::lines, make_gcov_file_name(), coverage_info::name, and output_lines().
Referenced by generate_results().
|
static |
@verbatim Output the result in intermediate format used by 'lcov'.
The intermediate format contains a single file named 'foo.cc.gcov', with no source code included. A sample output is
file:foo.cc function:5,1,Z3foov function:13,1,main function:19,1,_GLOBAL__sub_I__Z3foov function:19,1,_Z41__static_initialization_and_destruction_0ii lcount:5,1 lcount:7,9 lcount:9,8 lcount:11,1 file:/.../iostream lcount:74,1 file:/.../basic_ios.h file:/.../ostream file:/.../ios_base.h function:157,0,_ZStorSt12_Ios_IostateS lcount:157,0 file:/.../char_traits.h function:258,0,_ZNSt11char_traitsIcE6lengthEPKc lcount:258,0 ...
The default gcov outputs multiple files: 'foo.cc.gcov', 'iostream.gcov', 'ios_base.h.gcov', etc. with source code included. Instead the intermediate format here outputs only a single file 'foo.cc.gcov' similar to the above example.
References function_info::blocks, line_info::branches, arc_info::count, block_info::count, line_info::count, function_info::demangled_name, line_info::exists, flag_branches, flag_demangled_names, format_gcov(), source_info::functions, arc_info::is_call_non_return, arc_info::is_unconditional, function_info::line, arc_info::line_next, function_info::line_next, source_info::lines, function_info::name, source_info::name, arc_info::src, and line_info::u.
Referenced by generate_results().
|
static |
Read in the source file one line at a time, and output that line to the gcov file preceded by its execution count and other information.
References bbg_file_name, function_info::blocks, line_info::blocks, function_info::blocks_executed, line_info::branches, block_info::chain, arc_info::count, block_info::count, line_info::count, source_info::coverage, da_file_name, function_info::demangled_name, block_info::exceptional, line_info::exists, arc_info::fake, source_info::file_time, flag_all_blocks, flag_branches, flag_demangled_names, fnotice(), format_gcov(), source_info::functions, block_info::is_call_return, function_info::line, arc_info::line_next, function_info::line_next, source_info::lines, multiple_files, function_info::name, coverage_info::name, source_info::name, no_data_file, function_info::num_blocks, object_runs, output_branch_count(), block_info::pred, arc_info::pred_next, program_count, read_line(), block_info::succ, arc_info::succ_next, line_info::u, and line_info::unexceptional.
Referenced by output_gcov_file().
|
static |
|
static |
Print a usage message and exit. If ERROR_P is nonzero, this is an error, otherwise the output of --help.
References bug_report_url, and fnotice().
|
static |
Print version information and exit.
References fnotice(), pkgversion_string, and version_string.
|
static |
Forward declarations.
|
static |
Process args, return index to first non-arg.
References flag_all_blocks, flag_branches, flag_counts, flag_demangled_names, flag_display_progress, flag_function_summary, flag_gcov_file, flag_intermediate_format, flag_long_names, flag_preserve_paths, flag_relative_only, flag_unconditional, object_directory, print_usage(), print_version, source_length, source_prefix, and strlen().
|
static |
Process a single input file.
References function_info::blocks, function_info::counts, create_file_names(), find_exception_blocks(), function_info::has_catch, block_info::line, function_info::line, function_info::line_next, function_info::next, function_info::num_blocks, source_info::num_lines, read_count_file(), read_graph_file(), release_function(), solve_flow_graph(), function_info::src, and block_info::u.
Referenced by print_usage().
|
static |
Reads profiles from the count file and attach to each function. Return nonzero if fatal error.
References bbg_stamp, function_info::cfg_checksum, function_info::counts, gcov_summary::ctrs, da_file_name, error(), fnotice(), gcov_close(), gcov_is_error(), gcov_magic(), gcov_open(), gcov_position(), gcov_read_counter(), gcov_read_summary(), gcov_read_unsigned(), gcov_sync(), function_info::ident, function_info::lineno_checksum, function_info::name, function_info::next, no_data_file, function_info::num_counts, object_runs, program_count, and gcov_ctr_summary::runs.
Referenced by process_file().
|
static |
Read the notes file. Return list of functions read -- in reverse order.
References bbg_file_name, bbg_file_time, bbg_stamp, function_info::blocks, function_info::cfg_checksum, arc_info::count, arc_info::count_valid, function_info::demangled_name, arc_info::dst, arc_info::fake, arc_info::fall_through, find_source(), flag_demangled_names, block_info::flags, fnotice(), function_name(), gcov_close(), gcov_is_error(), gcov_magic(), gcov_open(), gcov_position(), gcov_read_string(), gcov_read_unsigned(), gcov_sync(), gcov_time(), function_info::has_catch, function_info::ident, arc_info::is_call_non_return, block_info::is_call_site, arc_info::is_nonlocal_return, block_info::is_nonlocal_return, arc_info::is_throw, block_info::line, function_info::line, function_info::line_next, function_info::lineno_checksum, function_info::name, function_info::next, function_info::num_blocks, function_info::num_counts, block_info::num_pred, block_info::num_succ, arc_info::on_tree, block_info::pred, arc_info::pred_next, arc_info::src, function_info::src, block_info::succ, arc_info::succ_next, and block_info::u.
Referenced by process_file().
|
static |
Referenced by output_lines().
|
static |
Release a function structure
References function_info::blocks, function_info::counts, function_info::demangled_name, flag_demangled_names, free(), function_info::name, function_info::num_blocks, block_info::succ, and arc_info::succ_next.
Referenced by process_file(), and release_structures().
|
static |
Release all memory used.
References free(), n_names, n_sources, function_info::next, and release_function().
Referenced by print_usage().
|
static |
Solve the flow graph. Propagate counts from the instrumented arcs to the blocks and the uninstrumented arcs.
References bbg_file_name, function_info::blocks, block_info::chain, changes, arc_info::count, block_info::count, arc_info::count_valid, block_info::count_valid, function_info::counts, arc_info::dst, arc_info::fake, arc_info::fall_through, fnotice(), block_info::invalid_chain, block_info::is_call_return, block_info::is_call_site, arc_info::is_unconditional, function_info::name, function_info::num_blocks, block_info::num_pred, block_info::num_succ, arc_info::on_tree, block_info::pred, arc_info::pred_next, arc_info::src, function_info::src, block_info::succ, arc_info::succ_next, and block_info::valid_chain.
Referenced by process_file().
|
static |
Referenced by find_source(), and print_usage().
|
static |
Referenced by find_source(), and print_usage().
|
static |
Name of the notes (gcno) output file. The "bbg" prefix is for historical reasons, when the notes file contained only the basic block graph notes.
Referenced by add_line_counts(), create_file_names(), find_source(), output_lines(), read_graph_file(), and solve_flow_graph().
|
static |
Modification time of graph file.
Referenced by create_file_names(), find_source(), and read_graph_file().
|
static |
Stamp of the bbg file
Referenced by create_file_names(), read_count_file(), and read_graph_file().
|
static |
Name and file pointer of the input file for the count data (gcda).
Referenced by create_file_names(), output_lines(), and read_count_file().
|
static |
Output count information for every basic block, not merely those that contain line number information.
Referenced by accumulate_line_counts(), add_line_counts(), output_lines(), and process_args().
|
static |
Output branch probabilities.
Referenced by accumulate_line_counts(), add_line_counts(), function_summary(), output_intermediate_file(), output_lines(), and process_args().
|
static |
Output the number of times a branch was taken as opposed to the percentage of times it was taken.
Referenced by output_branch_count(), and process_args().
|
static |
Output demangled function names.
Referenced by generate_results(), output_intermediate_file(), output_lines(), process_args(), read_graph_file(), and release_function().
|
static |
Output progress indication if this is true. This is off by default and can be turned on by the -d option.
Referenced by print_usage(), and process_args().
|
static |
Output summary info for each function.
Referenced by generate_results(), and process_args().
|
static |
Output a gcov file if this is true. This is on by default, and can be turned off by the -n option.
Referenced by generate_results(), and process_args().
|
static |
Output *.gcov file in intermediate format used by 'lcov'.
Referenced by generate_results(), and process_args().
|
static |
For included files, make the gcov output file name include the name of the input source file. For example, if x.h is included in a.c, then the output file name is a.c##x.h.gcov instead of x.h.gcov.
Referenced by make_gcov_file_name(), and process_args().
|
static |
Preserve all pathname components. Needed when object files and source files are in subdirectories. '/' is mangled as '#', '.' is elided and '..' mangled to '^'.
Referenced by mangle_name(), and process_args().
|
static |
Only show data for sources with relative pathnames. Absolute ones usually indicate a system header file, which although it may contain inline functions, is usually uninteresting.
Referenced by generate_results(), and process_args().
|
static |
Show unconditional branches too.
Referenced by output_branch_count(), and process_args().
|
static |
|
static |
Holds a list of function basic block graphs.
|
static |
If there is several input files, compute and display results after reading all data files. This way if two or more gcda file refer to the same source file (eg inline subprograms in a .h file), the counts are added.
Referenced by output_lines(), and print_usage().
|
static |
Referenced by find_source(), generate_results(), and release_structures().
|
static |
Referenced by find_source(), generate_results(), and release_structures().
|
static |
Referenced by is_ctor_dtor(), process_decls(), and register_edge_assert_for_2().
|
static |
Data file is missing.
Referenced by output_lines(), and read_count_file().
|
static |
Object directory file prefix. This is the directory/file where the graph and data files are looked for, if nonzero.
Referenced by create_file_names(), and process_args().
|
static |
This holds data summary information.
Referenced by output_lines(), and read_count_file().
|
static |
Referenced by output_lines(), and read_count_file().
|
static |
Referenced by find_source(), and process_args().
|
static |
Source directory prefix. This is removed from source pathnames that match, when generating the output file name.
Referenced by find_source(), and process_args().
|
static |
|
static |
Referenced by generate_results().
|
static |
Referenced by generate_results().