aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/gcov.texi
AgeCommit message (Collapse)AuthorFilesLines
2025-06-18doc: allow gcov.texi to be processed by makeinfo 4.13Jan Beulich1-1/+1
As per documentation, even 4.7 ought to suffice. At least 4.13 objects to there being a blank between @anchor and the opening curly brace. gcc/ * doc/gcov.texi: Drop blank after @anchor.
2025-03-26Add prime path coverage to gcc/gcovJørgen Kvalsvik1-0/+188
This patch adds prime path coverage to gcc/gcov. First, a quick introduction to path coverage, before I explain a bit on the pieces of the patch. PRIME PATHS Path coverage is recording the paths taken through the program. Here is a simple example: if (cond1) BB 1 then1 () BB 2 else else1 () BB 3 if (cond2) BB 4 then2 () BB 5 else else2 () BB 6 _ BB 7 To cover all paths you must run {then1 then2}, {then1 else2}, {else1 then1}, {else1 else2}. This is in contrast with line/statement coverage where it is sufficient to execute then2, and it does not matter if it was reached through then1 or else1. 1 2 4 5 7 1 2 4 6 7 1 3 4 5 7 1 3 4 6 7 This gets more complicated with loops, because 0, 1, 2, ..., N iterations are all different paths. There are different ways of addressing this, a promising one being prime paths. A prime path is a maximal simple path (a path with no repeated vertices) or simple cycle (no repeated vertices except for the first/last) Prime paths strike a decent balance between number of tests, path growth, and loop coverage, requiring loops to be both taken and skipped. Of course, the number of paths still grows very fast with program complexity - for example, this program has 14 prime paths: while (a) { if (b) return; while (c--) a++; } -- ALGORITHM Since the numbers of paths grows so fast, we need a good algorithm. The naive approach of generating all paths and discarding redundancies (see reference_prime_paths in the diff) simply doesn't complete for even pretty simple functions with a few ten thousand paths (granted, the implementation is also poor, but only serves as a reference). Fazli & Afsharchi in their paper "Time and Space-Efficient Compositional Method for Prime and Test Paths Generation" describe a neat algorithm which drastically improves on for most programs, and brings complexity down to something managable. This patch implements that algorithm with a few minor tweaks. The algorithm first finds the strongly connected components (SCC) of the graph and creates a new graph where the vertices are the SCCs of the CFG. Within these vertices different paths are found - regular prime paths, paths that start in the SCCs entries, and paths that end in the SCCs exits. These per-SCC paths are combined with paths through the CFG which greatly reduces of paths needed to be evaluated just to be thrown away. Using this algorithm we can find the prime paths for somewhat complicated functions in a reasonable time. Please note that some programs don't benefit from this at all. We need to find the prime paths within a SCC, so if a single SCC is very large the function degenerates to the naive implementation. This can probably be much improved on, but is an exercise for later. -- OVERALL ARCHITECTURE Like the other coverages in gcc, this operates on the CFG in the profiling phase, just after branch and condition coverage, in phases: 1. All prime paths are generated, counted, and enumerated from the CFG 2. The paths are evaluted and counter instructions and accumulators are emitted 3. gcov reads the CFG and computes the prime paths (same as step 1) 4. gcov prints a report Simply writing out all the paths in the .gcno file is not really viable, the files would be too big. Additionally, there are limits to the practicality of measuring (and reporting) on millions of paths, so for most programs where coverage is feasible, computing paths should be plenty fast. As a result, path coverage really only adds 1 bit to the counter, rounded up to nearest 64 ("bucket"), so 64 paths takes up 8 bytes, 65 paths take up 16 bytes. Recording paths is really just massaging large bitsets. Per function, ceil(paths/64 or 32) buckets (gcov_type) are allocated. Paths are sorted, so the first path maps to the lowest bit, the second path to the second lowest bit, and so on. On taking an edge and entering a basic block, a few bitmasks are applied to unset the bits corresponding to the paths outside the block and set the bits of the paths that start in that block. Finally, the right buckets are masked and written to the global accumulators for the paths that end in the block. Full coverage is achieved when all bits are set. gcc does not really inform gcov of abnormal paths, so paths with abnormal edges are ignored. This probably possible, but requires some changes to the graph gcc writes to the .gcno file. -- IMPLEMENTATION In order to remove non-prime paths (subpaths) we use a suffix tree. Fazli & Afsharchi do not discuss how duplicates or subpaths are removed, and using the suffix works really well -- insertion time is a function of the length of the (longest) paths, not the number of paths. The paths are usually quite short, but there are many of them. The same prime_paths function is used both in gcc and in gcov. As for speed, I would say that it is acceptable. Path coverage is a problem that is exponential in its very nature, so if you enable this feature you can reasonably expect it to take a while. To combat the effects of path explosion there is a limit at which point gcc will give up and refuse to instrument a function, set with -fpath-coverage-limit. Since estimating the number of prime paths is pretty much is counting them, gcc maintains a pessimistic running count which slightly overestimates the number of paths found so far. When that count exceeds the limit, the function aborts and gcc prints a warning. This is a blunt instrument meant to not get stuck on the occasional large function, not fine-grained control over when to skip instrumentation. My main benchmark has been tree-2.1.3/tree.c which generates approx 2M paths across the 20 functions or so in it. Most functions have less than 1500 paths, and 2 around a million each. Finding the paths takes 3.5-4s, but the instrumentation phase takes approx. 2.5 minutes and generates a 32M binary. Not bad for a 1429 line source file. There are some selftests which deconstruct the algorithm, so it can be easily referenced with the Fazli & Afsharchi. I hope that including them both help to catch regression, clarify the assumptions, and help understanding the algorithm by breaking up the phases. DEMO This is the denser line-aware (grep-friendlier) output. Every missing path is summarized as the lines you need to run in what order, annotated with the true/false/throw decision. $ gcc -fpath-coverage --coverage bs.c -c -o bs $ gcov -e --prime-paths-lines bs.o bs.gcda:cannot open data file, assuming not executed -: 0:Source:bs.c -: 0:Graph:bs.gcno -: 0:Data:- -: 0:Runs:0 paths covered 0 of 17 path 0 not covered: lines 6 6(true) 11(true) 12 path 1 not covered: lines 6 6(true) 11(false) 13(true) 14 path 2 not covered: lines 6 6(true) 11(false) 13(false) 16 path 3 not covered: lines 6 6(false) 18 path 4 not covered: lines 11(true) 12 6(true) 11 path 5 not covered: lines 11(true) 12 6(false) 18 path 6 not covered: lines 11(false) 13(true) 14 6(true) 11 path 7 not covered: lines 11(false) 13(true) 14 6(false) 18 path 8 not covered: lines 12 6(true) 11(true) 12 path 9 not covered: lines 12 6(true) 11(false) 13(true) 14 path 10 not covered: lines 12 6(true) 11(false) 13(false) 16 path 11 not covered: lines 13(true) 14 6(true) 11(true) 12 path 12 not covered: lines 13(true) 14 6(true) 11(false) 13 path 13 not covered: lines 14 6(true) 11(false) 13(true) 14 path 14 not covered: lines 14 6(true) 11(false) 13(false) 16 path 15 not covered: lines 6(true) 11(true) 12 6 path 16 not covered: lines 6(true) 11(false) 13(true) 14 6 #####: 1:int binary_search(int a[], int len, int from, int to, int key) -: 2:{ #####: 3: int low = from; #####: 4: int high = to - 1; -: 5: #####: 6: while (low <= high) -: 7: { #####: 8: int mid = (low + high) >> 1; #####: 9: long midVal = a[mid]; -: 10: #####: 11: if (midVal < key) #####: 12: low = mid + 1; #####: 13: else if (midVal > key) #####: 14: high = mid - 1; -: 15: else #####: 16: return mid; // key found -: 17: } #####: 18: return -1; -: 19:} Then there's the human-oriented source mode. Because it is so verbose I have limited the demo to 2 paths. In this mode gcov will print the sequence of *lines* through the program and in what order to cover the path, including what basic block the line is a part of. Like its denser sibling, this also prints the true/false/throw decision, if there is one. $ gcov -t --prime-paths-source bs.o bs.gcda:cannot open data file, assuming not executed -: 0:Source:bs.c -: 0:Graph:bs.gcno -: 0:Data:- -: 0:Runs:0 paths covered 0 of 17 path 0: BB 2: 1:int binary_search(int a[], int len, int from, int to, int key) BB 2: 3: int low = from; BB 2: 4: int high = to - 1; BB 2: 6: while (low <= high) BB 8: (true) 6: while (low <= high) BB 3: 8: int mid = (low + high) >> 1; BB 3: 9: long midVal = a[mid]; BB 3: (true) 11: if (midVal < key) BB 4: 12: low = mid + 1; path 1: BB 2: 1:int binary_search(int a[], int len, int from, int to, int key) BB 2: 3: int low = from; BB 2: 4: int high = to - 1; BB 2: 6: while (low <= high) BB 8: (true) 6: while (low <= high) BB 3: 8: int mid = (low + high) >> 1; BB 3: 9: long midVal = a[mid]; BB 3: (false) 11: if (midVal < key) BB 5: (true) 13: else if (midVal > key) BB 6: 14: high = mid - 1; The listing is also aware of inlining: hello.c: #include <stdio.h> #include "hello.h" int notmain(const char *entity) { return hello (entity); } #include <stdio.h> inline __attribute__((always_inline)) int hello (const char *s) { if (s) printf ("hello, %s!\n", s); else printf ("hello, world!\n"); return 0; } $ gcov -t --prime-paths-source hello paths covered 0 of 2 path 0: BB 2: (true) 4:int notmain(const char *entity) == inlined from hello.h == BB 2: (true) 6: if (s) BB 3: 7: printf ("hello, %s!\n", s); BB 5: 10: return 0; ------------------------- BB 7: 6: return hello (entity); BB 8: 6: return hello (entity); path 1: BB 2: (false) 4:int notmain(const char *entity) == inlined from hello.h == BB 2: (false) 6: if (s) BB 4: 9: printf ("hello, world!\n"); BB 5: 10: return 0; ------------------------- BB 7: 6: return hello (entity); BB 8: 6: return hello (entity); --prime-paths-{lines,source} take an optional argument type, which can be 'covered', 'uncovered', or 'both', which defaults to 'uncovered'. The flag controls if the covered or uncovered paths are printed, and while uncovered is generally the most useful one, it is sometimes nice to be able to see only the covered paths. And finally, JSON (abbreviated). It is quite sparse and very nested, but is mostly a JSON version of the source listing. It has to be this nested in order to consistently capture multiple locations. It is always includes the file name per location for consistency, even though this is very much redundant in almost all cases. This format is in no way set in stone, and without targeting it with other tooling I am not sure if it does the job well. "gcc_version": "15.0.0 20240704 (experimental)", "current_working_directory": "dir", "data_file": "hello.o", "files": [ { "file": "hello.c", "functions": [ { "name": "notmain", "demangled_name": "notmain", "start_line": 4, "start_column": 5, "end_line": 7, "end_column": 1, "blocks": 7, "blocks_executed": 0, "execution_count": 0, "total_prime_paths": 2, "covered_prime_paths": 0, "prime_path_coverage": [ { "id": 0, "sequence": [ { "block_id": 2, "locations": [ { "file": "hello.c", "line_numbers": [ 4 ] }, { "file": "hello.h", "line_numbers": [ 6 ] } ], "edge_kind": "fallthru" }, ... gcc/ChangeLog: * Makefile.in (OBJS): Add prime-paths.o, path-coverage.o. (GTFILES): Add prime-paths.cc, path-coverage.cc (GCOV_OBJS): Add graphds.o, prime-paths.o, bitmap.o * builtins.cc (expand_builtin_fork_or_exec): Check path_coverage_flag. * collect2.cc (main): Add -fno-path-coverage to OBSTACK. * common.opt: Add new options -fpath-coverage, -fpath-coverage-limit, -Wcoverage-too-many-paths * doc/gcov.texi: Add --prime-paths, --prime-paths-lines, --prime-paths-source documentation. * doc/invoke.texi: Add -fpath-coverage, -fpath-coverage-limit, -Wcoverage-too-many-paths documentation. * gcc.cc: Link gcov on -fpath-coverage. * gcov-counter.def (GCOV_COUNTER_PATHS): New. * gcov-io.h (GCOV_TAG_PATHS): New. (GCOV_TAG_PATHS_LENGTH): New. (GCOV_TAG_PATHS_NUM): New. * gcov.cc (class path_info): New. (struct coverage_info): Add paths, paths_covered. (find_prime_paths): New. (add_path_counts): New. (find_arc): New. (print_usage): Add -e, --prime-paths, --prime-paths-lines, --prime-paths-source. (process_args): Likewise. (json_set_prime_path_coverage): New. (output_json_intermediate_file): Call json_set_prime_path_coverage. (process_all_functions): Call find_prime_paths. (generate_results): Call add_path_counts. (read_graph_file): Read path counters. (read_count_file): Likewise. (function_summary): Print path counts. (file_summary): Likewise. (print_source_line): New. (print_prime_path_lines): New. (print_inlined_separator): New. (print_prime_path_source): New. (output_path_coverage): New. (output_lines): Print path coverage. * ipa-inline.cc (can_early_inline_edge_p): Check path_coverage_flag. * passes.cc (finish_optimization_passes): Likewise. * profile.cc (branch_prob): Likewise. * selftest-run-tests.cc (selftest::run_tests): Run path coverage tests. * selftest.h (path_coverage_cc_tests): New declaration. * tree-profile.cc (tree_profiling): Check path_coverage_flag. (pass_ipa_tree_profile::gate): Likewise. * path-coverage.cc: New file. * prime-paths.cc: New file. gcc/testsuite/ChangeLog: * lib/gcov.exp: Add prime paths test function. * g++.dg/gcov/gcov-22.C: New test. * g++.dg/gcov/gcov-23-1.h: New test. * g++.dg/gcov/gcov-23-2.h: New test. * g++.dg/gcov/gcov-23.C: New test. * gcc.misc-tests/gcov-29.c: New test. * gcc.misc-tests/gcov-30.c: New test. * gcc.misc-tests/gcov-31.c: New test. * gcc.misc-tests/gcov-32.c: New test. * gcc.misc-tests/gcov-33.c: New test. * gcc.misc-tests/gcov-34.c: New test.
2025-01-02Update copyright years.Jakub Jelinek1-1/+1
2025-01-02Update copyright dates.Jakub Jelinek1-1/+1
Manual part of copyright year updates. 2025-01-02 Jakub Jelinek <jakub@redhat.com> gcc/ * gcc.cc (process_command): Update copyright notice dates. * gcov-dump.cc (print_version): Ditto. * gcov.cc (print_version): Ditto. * gcov-tool.cc (print_version): Ditto. * gengtype.cc (create_file): Ditto. * doc/cpp.texi: Bump @copying's copyright year. * doc/cppinternals.texi: Ditto. * doc/gcc.texi: Ditto. * doc/gccint.texi: Ditto. * doc/gcov.texi: Ditto. * doc/install.texi: Ditto. * doc/invoke.texi: Ditto. gcc/ada/ * gnat_ugn.texi: Bump @copying's copyright year. * gnat_rm.texi: Likewise. gcc/d/ * gdc.texi: Bump @copyrights-d year. gcc/fortran/ * gfortranspec.cc (lang_specific_driver): Update copyright notice dates. * gfc-internals.texi: Bump @copying's copyright year. * gfortran.texi: Ditto. * intrinsic.texi: Ditto. * invoke.texi: Ditto. gcc/go/ * gccgo.texi: Bump @copyrights-go year. libgomp/ * libgomp.texi: Bump @copying's copyright year. libitm/ * libitm.texi: Bump @copying's copyright year. libquadmath/ * libquadmath.texi: Bump @copying's copyright year.
2024-07-11Add function filtering to gcovJørgen Kvalsvik1-0/+113
Add the --include and --exclude flags to gcov to control what functions to report on. This is meant to make gcov more practical as an when writing test suites or performing other coverage experiments, which tends to focus on a few functions at the time. This really shines in combination with the -t/--stdout flag. With support for more expansive metrics in gcov like modified condition/decision coverage (MC/DC) and path coverage, output quickly gets overwhelming without filtering. The approach is quite simple: filters are egrep regexes and are evaluated left-to-right, and the last filter "wins", that is, if a function matches an --include and a subsequent --exclude, it should not be included in the output. All of the output machinery works on the function table, so by optionally (not) adding function makes the even the json output work as expected, and only minor changes are needed to suppress the filtered-out functions. Demo: math.c int mul (int a, int b) { return a * b; } int sub (int a, int b) { return a - b; } int sum (int a, int b) { return a + b; } Plain matches: $ gcov -t math --include=sum -: 0:Source:math.c -: 0:Graph:math.gcno -: 0:Data:- -: 0:Runs:0 #####: 9:int sum (int a, int b) { #####: 10: return a + b; -: 11:} $ gcov -t math --include=mul -: 0:Source:math.c -: 0:Graph:math.gcno -: 0:Data:- -: 0:Runs:0 #####: 1:int mul (int a, int b) { #####: 2: return a * b; -: 3:} Regex match: $ gcov -t math --include=su -: 0:Source:math.c -: 0:Graph:math.gcno -: 0:Data:- -: 0:Runs:0 #####: 5:int sub (int a, int b) { #####: 6: return a - b; -: 7:} #####: 9:int sum (int a, int b) { #####: 10: return a + b; -: 11:} And similar for exclude: $ gcov -t math --exclude=sum -: 0:Source:math.c -: 0:Graph:math.gcno -: 0:Data:- -: 0:Runs:0 #####: 1:int mul (int a, int b) { #####: 2: return a * b; -: 3:} #####: 5:int sub (int a, int b) { #####: 6: return a - b; -: 7:} And json, for good measure: $ gcov -t math --include=sum --json | jq ".files[].lines[]" { "line_number": 9, "function_name": "sum", "count": 0, "unexecuted_block": true, "block_ids": [], "branches": [], "calls": [] } { "line_number": 10, "function_name": "sum", "count": 0, "unexecuted_block": true, "block_ids": [ 2 ], "branches": [], "calls": [] } Matching generally work well for mangled names, as the mangled names also have the base symbol name in it. By default, functions are matched by the mangled name, which means matching on base names always work as expected. The -M flag makes the matching work on the demangled name which is quite useful when you only want to report on specific overloads and can use the full type names. Why not just use grep? grep is not really sufficient as grep is very line oriented, and the reports that benefit the most from filtering often unpredictably span multiple lines based on the state of coverage. For example, a condition coverage report for 3 terms/6 outcomes only outputs 1 line when all conditions are covered, and 7 with no lines covered. gcc/ChangeLog: * doc/gcov.texi: Add --include, --exclude, --match-on-demangled documentation. * gcov.cc (struct fnfilter): New. (print_usage): Add --include, --exclude, -M, --match-on-demangled. (process_args): Likewise. (release_structures): Release filters. (read_graph_file): Only add function_infos matching filters. (output_lines): Likewise. gcc/testsuite/ChangeLog: * lib/gcov.exp: Add filtering test function. * g++.dg/gcov/gcov-19.C: New test. * g++.dg/gcov/gcov-20.C: New test. * g++.dg/gcov/gcov-21.C: New test. * gcc.misc-tests/gcov-25.c: New test. * gcc.misc-tests/gcov-26.c: New test. * gcc.misc-tests/gcov-27.c: New test. * gcc.misc-tests/gcov-28.c: New test.
2024-06-26Add section on MC/DC in gcov manualJørgen Kvalsvik1-0/+72
gcc/ChangeLog: * doc/gcov.texi: Add MC/DC section.
2024-04-04Add condition coverage (MC/DC)Jørgen Kvalsvik1-0/+38
This patch adds support in gcc+gcov for modified condition/decision coverage (MC/DC) with the -fcondition-coverage flag. MC/DC is a type of test/code coverage and it is particularly important for safety-critical applicaitons in industries like aviation and automotive. Notably, MC/DC is required or recommended by: * DO-178C for the most critical software (Level A) in avionics. * IEC 61508 for SIL 4. * ISO 26262-6 for ASIL D. From the SQLite webpage: Two methods of measuring test coverage were described above: "statement" and "branch" coverage. There are many other test coverage metrics besides these two. Another popular metric is "Modified Condition/Decision Coverage" or MC/DC. Wikipedia defines MC/DC as follows: * Each decision tries every possible outcome. * Each condition in a decision takes on every possible outcome. * Each entry and exit point is invoked. * Each condition in a decision is shown to independently affect the outcome of the decision. In the C programming language where && and || are "short-circuit" operators, MC/DC and branch coverage are very nearly the same thing. The primary difference is in boolean vector tests. One can test for any of several bits in bit-vector and still obtain 100% branch test coverage even though the second element of MC/DC - the requirement that each condition in a decision take on every possible outcome - might not be satisfied. https://sqlite.org/testing.html#mcdc MC/DC comes in different flavors, the most important being unique cause MC/DC and masking MC/DC. This patch implements masking MC/DC, which is works well with short circuiting semantics, and according to John Chilenski's "An Investigation of Three Forms of the Modified Condition Decision Coverage (MCDC) Criterion" (2001) is as good as unique cause at catching bugs. Whalen, Heimdahl, and De Silva "Efficient Test Coverage Measurement for MC/DC" describes an algorithm for finding the masking table from an AST walk, but my algorithm figures this out by analyzing the control flow graph. The CFG is considered a reduced ordered binary decision diagram and an input vector a path through the BDD, which is recorded. Specific edges will mask ("null out") the contribution from earlier path segments, which can be determined by finding short circuit endpoints. Masking is most easily understood as circuiting of terms in the reverse-ordered Boolean function, and the masked conditions do not affect the decision like short-circuited conditions do not affect the decision. A tag/discriminator mapping from gcond->uid is created during gimplification and made available through the function struct. The values are unimportant as long as basic conditions constructed from a single Boolean expression are given the same identifier. This happens in the breaking down of ANDIF/ORIF trees, so the coverage generally works well for frontends that create such trees. Like Whalen et al this implementation records coverage in fixed-size bitsets which gcov knows how to interpret. Recording conditions only requires a few bitwise operations per condition and is very fast, but comes with a limit on the number of terms in a single boolean expression; the number of bits in a gcov_unsigned_type (which is usually typedef'd to uint64_t). For most practical purposes this is acceptable, and by default a warning will be issued if gcc cannot instrument the expression. This is a practical limitation in the implementation, and not a limitation of the algorithm, so support for more conditions can be supported by introducing arbitrary-sized bitsets. In action it looks pretty similar to the branch coverage. The -g short opt carries no significance, but was chosen because it was an available option with the upper-case free too. gcov --conditions: 3: 17:void fn (int a, int b, int c, int d) { 3: 18: if ((a && (b || c)) && d) conditions covered 3/8 condition 0 not covered (true false) condition 1 not covered (true) condition 2 not covered (true) condition 3 not covered (true) 1: 19: x = 1; -: 20: else 2: 21: x = 2; 3: 22:} gcov --conditions --json-format: "conditions": [ { "not_covered_false": [ 0 ], "count": 8, "covered": 3, "not_covered_true": [ 0, 1, 2, 3 ] } ], Expressions with constants may be heavily rewritten before it reaches the gimplification, so constructs like int x = a ? 0 : 1 becomes _x = (_a == 0). From source you would expect coverage, but it gets neither branch nor condition coverage. The same applies to expressions like int x = 1 || a which are simply replaced by a constant. The test suite contains a lot of small programs and functions. Some of these were designed by hand to test for specific behaviours and graph shapes, and some are previously-failed test cases in other programs adapted into the test suite. gcc/ChangeLog: * builtins.cc (expand_builtin_fork_or_exec): Check condition_coverage_flag. * collect2.cc (main): Add -fno-condition-coverage to OBSTACK. * common.opt: Add new options -fcondition-coverage and -Wcoverage-too-many-conditions. * doc/gcov.texi: Add --conditions documentation. * doc/invoke.texi: Add -fcondition-coverage documentation. * function.cc (free_after_compilation): Free cond_uids. * function.h (struct function): Add cond_uids. * gcc.cc: Link gcov on -fcondition-coverage. * gcov-counter.def (GCOV_COUNTER_CONDS): New. * gcov-dump.cc (tag_conditions): New. * gcov-io.h (GCOV_TAG_CONDS): New. (GCOV_TAG_CONDS_LENGTH): New. (GCOV_TAG_CONDS_NUM): New. * gcov.cc (class condition_info): New. (condition_info::condition_info): New. (condition_info::popcount): New. (struct coverage_info): New. (add_condition_counts): New. (output_conditions): New. (print_usage): Add -g, --conditions. (process_args): Likewise. (output_intermediate_json_line): Output conditions. (read_graph_file): Read condition counters. (read_count_file): Likewise. (file_summary): Print conditions. (accumulate_line_info): Accumulate conditions. (output_line_details): Print conditions. * gimplify.cc (next_cond_uid): New. (reset_cond_uid): New. (shortcut_cond_r): Set condition discriminator. (tag_shortcut_cond): New. (gimple_associate_condition_with_expr): New. (shortcut_cond_expr): Set condition discriminator. (gimplify_cond_expr): Likewise. (gimplify_function_tree): Call reset_cond_uid. * ipa-inline.cc (can_early_inline_edge_p): Check condition_coverage_flag. * ipa-split.cc (pass_split_functions::gate): Likewise. * passes.cc (finish_optimization_passes): Likewise. * profile.cc (struct condcov): New declaration. (cov_length): Likewise. (cov_blocks): Likewise. (cov_masks): Likewise. (cov_maps): Likewise. (cov_free): Likewise. (instrument_decisions): New. (read_thunk_profile): Control output to file. (branch_prob): Call find_conditions, instrument_decisions. (init_branch_prob): Add total_num_conds. (end_branch_prob): Likewise. * tree-core.h (struct tree_exp): Add condition_uid. * tree-profile.cc (struct conds_ctx): New. (CONDITIONS_MAX_TERMS): New. (EDGE_CONDITION): New. (topological_cmp): New. (index_of): New. (single_p): New. (single_edge): New. (contract_edge_up): New. (struct outcomes): New. (conditional_succs): New. (condition_index): New. (condition_uid): New. (masking_vectors): New. (emit_assign): New. (emit_bitwise_op): New. (make_top_index_visit): New. (make_top_index): New. (paths_between): New. (struct condcov): New. (cov_length): New. (cov_blocks): New. (cov_masks): New. (cov_maps): New. (cov_free): New. (find_conditions): New. (struct counters): New. (find_counters): New. (resolve_counter): New. (resolve_counters): New. (instrument_decisions): New. (tree_profiling): Check condition_coverage_flag. (pass_ipa_tree_profile::gate): Likewise. * tree.h (SET_EXPR_UID): New. (EXPR_COND_UID): New. libgcc/ChangeLog: * libgcov-merge.c (__gcov_merge_ior): New. gcc/testsuite/ChangeLog: * lib/gcov.exp: Add condition coverage test function. * g++.dg/gcov/gcov-18.C: New test. * gcc.misc-tests/gcov-19.c: New test. * gcc.misc-tests/gcov-20.c: New test. * gcc.misc-tests/gcov-21.c: New test. * gcc.misc-tests/gcov-22.c: New test. * gcc.misc-tests/gcov-23.c: New test.
2024-01-03Update copyright years.Jakub Jelinek1-1/+1
2024-01-03Update copyright dates.Jakub Jelinek1-1/+1
Manual part of copyright year updates. 2024-01-03 Jakub Jelinek <jakub@redhat.com> gcc/ * gcc.cc (process_command): Update copyright notice dates. * gcov-dump.cc (print_version): Ditto. * gcov.cc (print_version): Ditto. * gcov-tool.cc (print_version): Ditto. * gengtype.cc (create_file): Ditto. * doc/cpp.texi: Bump @copying's copyright year. * doc/cppinternals.texi: Ditto. * doc/gcc.texi: Ditto. * doc/gccint.texi: Ditto. * doc/gcov.texi: Ditto. * doc/install.texi: Ditto. * doc/invoke.texi: Ditto. gcc/ada/ * gnat_ugn.texi: Bump @copying's copyright year. * gnat_rm.texi: Likewise. gcc/d/ * gdc.texi: Bump @copyrights-d year. gcc/fortran/ * gfortranspec.cc (lang_specific_driver): Update copyright notice dates. * gfc-internals.texi: Bump @copying's copyright year. * gfortran.texi: Ditto. * intrinsic.texi: Ditto. * invoke.texi: Ditto. gcc/go/ * gccgo.texi: Bump @copyrights-go year. libgomp/ * libgomp.texi: Bump @copying's copyright year. libitm/ * libitm.texi: Bump @copying's copyright year. libquadmath/ * libquadmath.texi: Bump @copying's copyright year.
2023-04-25gcov: add info about "calls" to JSON output formatMartin Liska1-2/+45
gcc/ChangeLog: * doc/gcov.texi: Document the new "calls" field and document the API bump. Mention also "block_ids" for lines. * gcov.cc (output_intermediate_json_line): Output info about calls and extend branches as well. (generate_results): Bump version to 2. (output_line_details): Use block ID instead of a non-sensual index. gcc/testsuite/ChangeLog: * g++.dg/gcov/gcov-17.C: Add call to a noreturn function. * g++.dg/gcov/test-gcov-17.py: Cover new format. * lib/gcov.exp: Add options for gcov that emit the extra info.
2023-01-16Update copyright years.Jakub Jelinek1-1/+1
2023-01-02Update copyright dates.Jakub Jelinek1-1/+1
Manual part of copyright year updates. 2023-01-02 Jakub Jelinek <jakub@redhat.com> gcc/ * gcc.cc (process_command): Update copyright notice dates. * gcov-dump.cc (print_version): Ditto. * gcov.cc (print_version): Ditto. * gcov-tool.cc (print_version): Ditto. * gengtype.cc (create_file): Ditto. * doc/cpp.texi: Bump @copying's copyright year. * doc/cppinternals.texi: Ditto. * doc/gcc.texi: Ditto. * doc/gccint.texi: Ditto. * doc/gcov.texi: Ditto. * doc/install.texi: Ditto. * doc/invoke.texi: Ditto. gcc/ada/ * gnat_ugn.texi: Bump @copying's copyright year. * gnat_rm.texi: Likewise. gcc/d/ * gdc.texi: Bump @copyrights-d year. gcc/fortran/ * gfortranspec.cc (lang_specific_driver): Update copyright notice dates. * gfc-internals.texi: Bump @copying's copyright year. * gfortran.texi: Ditto. * intrinsic.texi: Ditto. * invoke.texi: Ditto. gcc/go/ * gccgo.texi: Bump @copyrights-go year. libgomp/ * libgomp.texi: Bump @copying's copyright year. libitm/ * libitm.texi: Bump @copying's copyright year. libquadmath/ * libquadmath.texi: Bump @copying's copyright year.
2022-11-14Revert "sphinx: remove texinfo files"Martin Liska1-0/+1362
This reverts commit 54ca4eef58661a7d7a511e2bbbe309bde1732abf.
2022-11-09sphinx: remove texinfo filesMartin Liska1-1362/+0
gcc/d/ChangeLog: * gdc.texi: Removed. gcc/ChangeLog: * doc/analyzer.texi: Removed. * doc/avr-mmcu.texi: Removed. * doc/bugreport.texi: Removed. * doc/cfg.texi: Removed. * doc/collect2.texi: Removed. * doc/compat.texi: Removed. * doc/configfiles.texi: Removed. * doc/configterms.texi: Removed. * doc/contrib.texi: Removed. * doc/contribute.texi: Removed. * doc/cpp.texi: Removed. * doc/cppdiropts.texi: Removed. * doc/cppenv.texi: Removed. * doc/cppinternals.texi: Removed. * doc/cppopts.texi: Removed. * doc/cppwarnopts.texi: Removed. * doc/extend.texi: Removed. * doc/fragments.texi: Removed. * doc/frontends.texi: Removed. * doc/gcc.texi: Removed. * doc/gccint.texi: Removed. * doc/gcov-dump.texi: Removed. * doc/gcov-tool.texi: Removed. * doc/gcov.texi: Removed. * doc/generic.texi: Removed. * doc/gimple.texi: Removed. * doc/gnu.texi: Removed. * doc/gty.texi: Removed. * doc/headerdirs.texi: Removed. * doc/hostconfig.texi: Removed. * doc/implement-c.texi: Removed. * doc/implement-cxx.texi: Removed. * doc/include/fdl.texi: Removed. * doc/include/funding.texi: Removed. * doc/include/gcc-common.texi: Removed. * doc/include/gpl_v3.texi: Removed. * doc/install.texi: Removed. * doc/interface.texi: Removed. * doc/invoke.texi: Removed. * doc/languages.texi: Removed. * doc/libgcc.texi: Removed. * doc/loop.texi: Removed. * doc/lto-dump.texi: Removed. * doc/lto.texi: Removed. * doc/makefile.texi: Removed. * doc/match-and-simplify.texi: Removed. * doc/md.texi: Removed. * doc/objc.texi: Removed. * doc/optinfo.texi: Removed. * doc/options.texi: Removed. * doc/passes.texi: Removed. * doc/plugins.texi: Removed. * doc/poly-int.texi: Removed. * doc/portability.texi: Removed. * doc/rtl.texi: Removed. * doc/service.texi: Removed. * doc/sourcebuild.texi: Removed. * doc/standards.texi: Removed. * doc/tm.texi: Removed. * doc/tree-ssa.texi: Removed. * doc/trouble.texi: Removed. * doc/ux.texi: Removed. * doc/tm.texi.in: Removed. gcc/fortran/ChangeLog: * gfc-internals.texi: Removed. * gfortran.texi: Removed. * intrinsic.texi: Removed. * invoke.texi: Removed. gcc/go/ChangeLog: * gccgo.texi: Removed. libgomp/ChangeLog: * libgomp.texi: Removed. libiberty/ChangeLog: * at-file.texi: Removed. * copying-lib.texi: Removed. * functions.texi: Removed. * libiberty.texi: Removed. * obstacks.texi: Removed. libitm/ChangeLog: * libitm.texi: Removed. libquadmath/ChangeLog: * libquadmath.texi: Removed.
2022-04-28gcov: Add section for freestanding environmentsSebastian Huber1-0/+389
gcc/ * doc/gcov.texi (Profiling and Test Coverage in Freestanding Environments): New section.
2022-01-03Update copyright years.Jakub Jelinek1-1/+1
2022-01-03Update copyright dates.Jakub Jelinek1-1/+1
Manual part of copyright year updates. 2022-01-03 Jakub Jelinek <jakub@redhat.com> gcc/ * gcc.c (process_command): Update copyright notice dates. * gcov-dump.c (print_version): Ditto. * gcov.c (print_version): Ditto. * gcov-tool.c (print_version): Ditto. * gengtype.c (create_file): Ditto. * doc/cpp.texi: Bump @copying's copyright year. * doc/cppinternals.texi: Ditto. * doc/gcc.texi: Ditto. * doc/gccint.texi: Ditto. * doc/gcov.texi: Ditto. * doc/install.texi: Ditto. * doc/invoke.texi: Ditto. gcc/ada/ * gnat_ugn.texi: Bump @copying's copyright year. * gnat_rm.texi: Likewise. gcc/d/ * gdc.texi: Bump @copyrights-d year. gcc/fortran/ * gfortranspec.c (lang_specific_driver): Update copyright notice dates. * gfc-internals.texi: Bump @copying's copyright year. * gfortran.texi: Ditto. * intrinsic.texi: Ditto. * invoke.texi: Ditto. gcc/go/ * gccgo.texi: Bump @copyrights-go year. libgomp/ * libgomp.texi: Bump @copying's copyright year. libitm/ * libitm.texi: Bump @copying's copyright year. libquadmath/ * libquadmath.texi: Bump @copying's copyright year.
2021-06-09Improve JSON examples.Martin Liska1-25/+25
gcc/ChangeLog: * doc/gcov.texi: Create a proper JSON files. * doc/invoke.texi: Remove dots in order to make it a valid JSON object.
2021-05-28DOC: Update __gcov_dump documentation.Martin Liska1-2/+1
PR gcov-profile/100751 gcc/ChangeLog: * doc/gcov.texi: Revert partially a hunk that was wrong.
2021-05-26DOC: update documentation of __gcov_{dump,reset}Martin Liska1-3/+5
gcc/ChangeLog: PR gcov-profile/100751 * doc/gcov.texi: Document that __gcov_dump can be called just once and that __gcov_reset resets run-time counters.
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2021-01-01Update copyright dates.Jakub Jelinek1-1/+1
Manual part of copyright year updates. 2021-01-01 Jakub Jelinek <jakub@redhat.com> gcc/ * gcc.c (process_command): Update copyright notice dates. * gcov-dump.c (print_version): Ditto. * gcov.c (print_version): Ditto. * gcov-tool.c (print_version): Ditto. * gengtype.c (create_file): Ditto. * doc/cpp.texi: Bump @copying's copyright year. * doc/cppinternals.texi: Ditto. * doc/gcc.texi: Ditto. * doc/gccint.texi: Ditto. * doc/gcov.texi: Ditto. * doc/install.texi: Ditto. * doc/invoke.texi: Ditto. gcc/ada/ * gnat_ugn.texi: Bump @copying's copyright year. * gnat_rm.texi: Likewise. gcc/d/ * gdc.texi: Bump @copyrights-d year. gcc/fortran/ * gfortranspec.c (lang_specific_driver): Update copyright notice dates. * gfc-internals.texi: Bump @copying's copyright year. * gfortran.texi: Ditto. * intrinsic.texi: Ditto. * invoke.texi: Ditto. gcc/go/ * gccgo.texi: Bump @copyrights-go year. libgomp/ * libgomp.texi: Bump @copying's copyright year. libitm/ * libitm.texi: Bump @copying's copyright year. libquadmath/ * libquadmath.texi: Bump @copying's copyright year.
2020-07-01gcov: rename 2 options.Martin Liska1-4/+4
gcc/ChangeLog: * doc/gcov.texi: Rename 2 options. * gcov.c (print_usage): Rename -i,--json-format to -j,--json-format and -j,--human-readable to -H,--human-readable. (process_args): Fix up parsing. Document obsolete options and how are they changed. gcc/testsuite/ChangeLog: * g++.dg/gcov/loop.C: Use -H option instead of -j option.
2020-06-09gcov: improve --coverage small exampleMartin Liska1-1/+2
Pushed to master. gcc/ChangeLog: PR gcov-profile/95365 * doc/gcov.texi: Compile and link one example in 2 steps.
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2020-01-01gcc.c (process_command): Update copyright notice dates.Jakub Jelinek1-1/+1
* gcc.c (process_command): Update copyright notice dates. * gcov-dump.c (print_version): Ditto. * gcov.c (print_version): Ditto. * gcov-tool.c (print_version): Ditto. * gengtype.c (create_file): Ditto. * doc/cpp.texi: Bump @copying's copyright year. * doc/cppinternals.texi: Ditto. * doc/gcc.texi: Ditto. * doc/gccint.texi: Ditto. * doc/gcov.texi: Ditto. * doc/install.texi: Ditto. * doc/invoke.texi: Ditto. gcc/fortran/ * gfortranspec.c (lang_specific_driver): Update copyright notice dates. * gfc-internals.texi: Bump @copying's copyright year. * gfortran.texi: Ditto. * intrinsic.texi: Ditto. * invoke.texi: Ditto. gcc/d/ * gdc.texi: Bump @copyrights-d year. gcc/go/ * gccgo.texi: Bump @copyrights-go year. gcc/ada/ * gnat_ugn.texi: Bump @copying's copyright year. * gnat_rm.texi: Likewise. libitm/ * libitm.texi: Bump @copying's copyright year. libgomp/ * libgomp.texi: Bump @copying's copyright year. libquadmath/ * libquadmath.texi: Bump @copying's copyright year. From-SVN: r279811
2019-04-10Make gcov docs more precise (PR gcov-profile/89959).Martin Liska1-2/+4
2019-04-10 Martin Liska <mliska@suse.cz> PR gcov-profile/89959 * doc/gcov.texi: Make documentation of -x option more precise. From-SVN: r270251
2019-04-08Add data_file to GCOV interm. format (PR gcov-profile/89961).Martin Liska1-0/+4
2019-04-08 Martin Liska <mliska@suse.cz> PR gcov-profile/89961 * doc/gcov.texi: Document data_file. * gcov.c (generate_results): Add data_info into JSON output. From-SVN: r270204
2019-03-14GCOV: print {start,end}_column in JSON file and gcov-dump tool.Martin Liska1-1/+14
2019-03-14 Martin Liska <mliska@suse.cz> * coverage.c (coverage_begin_function): Stream also end_column. * doc/gcov.texi: Document 2 new fields in JSON file. Improve documentation about function declaration location. * gcov-dump.c (tag_function): Print whole range of function declaration. * gcov.c (struct function_info): Add end_column field. (function_info::function_info): Initialize it. (output_json_intermediate_file): Output {start,end}_column fields. (read_graph_file): Read end_column. From-SVN: r269678
2019-03-11Improve JSON format: add function names for lines.Martin Liska1-0/+5
2019-03-11 Martin Liska <mliska@suse.cz> * gcov.c (output_intermediate_json_line): Print function name of each line. (output_json_intermediate_file): Add new argument. * doc/gcov.texi: Document the change. From-SVN: r269581
2019-03-06Use --coverage instead of -fprofile-arcs -ftest-coverage in documentation ↵Martin Liska1-5/+5
(PR gcov-profile/89577). 2019-03-06 Martin Liska <mliska@suse.cz> PR gcov-profile/89577 * doc/gcov.texi: Prefer to use --coverage. * doc/sourcebuild.texi: Likewise. From-SVN: r269415
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2019-01-01gcc.c (process_command): Update copyright notice dates.Jakub Jelinek1-1/+1
* gcc.c (process_command): Update copyright notice dates. * gcov-dump.c (print_version): Ditto. * gcov.c (print_version): Ditto. * gcov-tool.c (print_version): Ditto. * gengtype.c (create_file): Ditto. * doc/cpp.texi: Bump @copying's copyright year. * doc/cppinternals.texi: Ditto. * doc/gcc.texi: Ditto. * doc/gccint.texi: Ditto. * doc/gcov.texi: Ditto. * doc/install.texi: Ditto. * doc/invoke.texi: Ditto. gcc/fortran/ * gfortranspec.c (lang_specific_driver): Update copyright notice dates. * gfc-internals.texi: Bump @copying's copyright year. * gfortran.texi: Ditto. * intrinsic.texi: Ditto. * invoke.texi: Ditto. gcc/go/ * gccgo.texi: Bump @copyrights-go year. gcc/ada/ * gnat_ugn.texi: Bump @copying's copyright year. * gnat_rm.texi: Likewise. gcc/d/ * gdc.texi: Bump @copyrights-d year. libitm/ * libitm.texi: Bump @copying's copyright year. libgomp/ * libgomp.texi: Bump @copying's copyright year. libquadmath/ * libquadmath.texi: Bump @copying's copyright year. From-SVN: r267492
2018-10-29GCOV: introduce --json-format.Martin Liska1-65/+128
2018-10-29 Martin Liska <mliska@suse.cz> * Makefile.in: Make dependency to json.o. * doc/gcov.texi: Document new JSON format, remove old intermediate format documentation. * gcov.c (struct function_info): Come up with m_name and m_demangled_name. (function_info::function_info): Initialize it. (function_info::~function_info): Release it. (main): Rename flag_intermediate_format to flag_json_format. (print_usage): Describe --json-format. (process_args): Set flag_json_format. (output_intermediate_line): Remove. (output_intermediate_json_line): Likewise. (get_gcov_intermediate_filename): Return new extension ".gcov.json.gz". (output_intermediate_file): Implement JSON emission. (output_json_intermediate_file): Implement JSON emission. (generate_results): Use ::get_name for function name. Handle JSON output file. (read_graph_file): Use ::get_name instead of cplus_demangle. (read_count_file): Likewise. (solve_flow_graph): Likewise. (add_line_counts): Likewise. (accumulate_line_counts): Use new flag_json_format. (output_function_details): Use ::get_name instead of cplus_demangle. (output_lines): Likewise. * json.cc (test_writing_literals): Add new tests. * json.h (class literal): Add new boolean constructor. 2018-10-29 Martin Liska <mliska@suse.cz> * g++.dg/gcov/gcov-8.C: Do not check intermediate format. * lib/gcov.exp: Remove legacy verify-intermediate. From-SVN: r265587
2018-09-17gcov: emit hotness colors to easily find hot code.Martin Liska1-1/+7
2018-09-17 Martin Liska <mliska@suse.cz> * doc/gcov.texi: Document new option --use-hotness-colors. * gcov.c (struct source_info): Declare new field. (source_info::source_info): Set default for maximum_count. (print_usage): Add new -q option. (process_args): Process it. (accumulate_line_info): Save src->maximum_count. (output_line_beginning): Make color line number if flag_use_hotness_colors is set. (output_line_details): Pass default argument value. (output_lines): Pass src->maximum_count. From-SVN: r264360
2018-09-05GCOV: Print one decimal place in human readable mode.Martin Liska1-1/+1
2018-09-05 Martin Liska <mliska@suse.cz> * doc/gcov.texi: Update documentation of humar readable mode. * gcov.c (format_count): Print one decimal place, it provides more fine number of situations like '1G' vs. '1.4G'. 2018-09-05 Martin Liska <mliska@suse.cz> * g++.dg/gcov/loop.C: Update test to support new format. From-SVN: r264112
2018-08-03docs: fix stray duplicated wordsDavid Malcolm1-1/+1
gcc/ChangeLog: * doc/gcov.texi (-x): Remove duplicate "to". * doc/invoke.texi (-Wnoexcept-type): Remove duplicate "calls". (-Wif-not-aligned): Remove duplicate "is". (-flto): Remove duplicate "the". (MicroBlaze Options): In examples of "-mcpu=cpu-type", remove duplicate "v5.00.b". (MSP430 Options): Remove duplicate "and" from the description of "-mgprel-sec=regexp". (x86 Options): Remove duplicate copies of "vmldLog102" and vmlsLog104 from description of "-mveclibabi=type". From-SVN: r263295
2018-07-22* doc/gcov.texi (Invoking Gcov): Editorial changes.Gerald Pfeifer1-3/+3
From-SVN: r262922
2018-05-29libgcov: report about a different timestamp (PR gcov-profile/85759).Martin Liska1-0/+8
2018-05-29 Martin Liska <mliska@suse.cz> PR gcov-profile/85759 * doc/gcov.texi: Document GCOV_ERROR_FILE and GCOV_EXIT_AT_ERROR env variables. 2018-05-29 Martin Liska <mliska@suse.cz> PR gcov-profile/85759 * libgcov-driver-system.c (gcov_error): Introduce usage of GCOV_EXIT_AT_ERROR env. variable. * libgcov-driver.c (merge_one_data): Print error that we overwrite a gcov file with a different timestamp. From-SVN: r260895
2018-05-18gcov: add new option -t that prints output to stdout (PR gcov-profile/84846).Martin Liska1-0/+5
2018-05-18 Martin Liska <mliska@suse.cz> PR gcov-profile/84846 * gcov.c (print_usage): Add new -t option. (process_args): Handle the option. (generate_results): Use stdout as output when requested by the option. 2018-05-18 Martin Liska <mliska@suse.cz> PR gcov-profile/84846 * doc/gcov.texi: Document -t option of gcov tool. From-SVN: r260361
2018-05-18Print working directory to gcov files (PR gcov-profile/84846).Martin Liska1-0/+5
2018-05-18 Martin Liska <mliska@suse.cz> PR gcov-profile/84846 * coverage.c (coverage_init): Write PWD to .gcno file. * doc/gcov.texi: Document how working directory is printed. * gcov-dump.c (dump_gcov_file): Print PWD. * gcov.c (output_intermediate_file): Likewise. (read_graph_file): Read PWD string. (output_lines): Print PWD. From-SVN: r260359
2018-03-08Document gcov-io (PR gcov-profile/84735).Martin Liska1-3/+3
2018-03-08 Martin Liska <mliska@suse.cz> PR gcov-profile/84735 * doc/gcov.texi: Document usage of profile files. * gcov-io.h: Document changes in the format. From-SVN: r258360
2018-02-05Fix GCOV documentation (PR gcov-profile/84137).Martin Liska1-1/+1
2018-02-05 Martin Liska <mliska@suse.cz> PR gcov-profile/84137 * doc/gcov.texi: Fix typo in documentation. From-SVN: r257384
2018-02-05Document --dynamic-list-data option for --coverage usage.Martin Liska1-0/+2
2018-02-05 Martin Liska <mliska@suse.cz> PR gcov-profile/83879 * doc/gcov.texi: Document necessity of --dynamic-list-data when using dlopen functionality. From-SVN: r257383
2018-01-04Add version to intermediate gcov file (PR gcov-profile/83669).Martin Liska1-4/+6
2018-01-04 Martin Liska <mliska@suse.cz> PR gcov-profile/83669 * gcov.c (output_intermediate_file): Add version to intermediate gcov file. * doc/gcov.texi: Document new field 'version' in intermediate file format. Fix location of '-k' option of gcov command. From-SVN: r256227
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2018-01-03gcc.c (process_command): Update copyright notice dates.Jakub Jelinek1-1/+1
gcc/ * gcc.c (process_command): Update copyright notice dates. * gcov-dump.c (print_version): Ditto. * gcov.c (print_version): Ditto. * gcov-tool.c (print_version): Ditto. * gengtype.c (create_file): Ditto. * doc/cpp.texi: Bump @copying's copyright year. * doc/cppinternals.texi: Ditto. * doc/gcc.texi: Ditto. * doc/gccint.texi: Ditto. * doc/gcov.texi: Ditto. * doc/install.texi: Ditto. * doc/invoke.texi: Ditto. gcc/fortran/ * gfortranspec.c (lang_specific_driver): Update copyright notice dates. * gfc-internals.texi: Bump @copying's copyright year. * gfortran.texi: Ditto. * intrinsic.texi: Ditto. * invoke.texi: Ditto. gcc/ada/ * gnat_ugn.texi: Bump @copying's copyright year. * gnat_rm.texi: Likewise. gcc/go/ * gccgo.texi: Bump @copyrights-go year. libitm/ * libitm.texi: Bump @copying's copyright year. libgomp/ * libgomp.texi: Bump @copying's copyright year. libquadmath/ * libquadmath.texi: Bump @copying's copyright year. From-SVN: r256166
2017-11-10GCOV: do not support unexecuted blocks in AdaMartin Liska1-1/+1
2017-11-10 Martin Liska <mliska@suse.cz> * coverage.c (coverage_init): Stream information about support of has_unexecuted_blocks. * doc/gcov.texi: Document that. * gcov-dump.c (dump_gcov_file): Support it in gcov_dump tool. * gcov.c (read_graph_file): Likewise. (output_line_beginning): Fix a small issue with color output. From-SVN: r254627
2017-11-09GCOV: support multiple functions per a line (PR gcov-profile/48463)Martin Liska1-89/+240
2017-11-09 Martin Liska <mliska@suse.cz> PR gcov-profile/48463 * coverage.c (coverage_begin_function): Output also end locus of a function and information whether the function is artificial. * gcov-dump.c (tag_function): Parse and print the information. * gcov.c (INCLUDE_MAP): Add include. (INCLUDE_SET): Likewise. (struct line_info): Move earlier in the source file because of vector<line_info> in function_info structure. (line_info::line_info): Likewise. (line_info::has_block): Likewise. (struct source_info): Add new member index. (source_info::get_functions_at_location): New function. (function_info::group_line_p): New function. (output_intermediate_line): New function. (output_intermediate_file): Use the mentioned function. (struct function_start): New. (struct function_start_pair_hash): Likewise. (process_file): Add code that identifies group functions. Assign lines either to global or function scope. (generate_results): Skip artificial functions. (find_source): Assign index for each source file. (read_graph_file): Read new flag artificial and end_line. (add_line_counts): Assign it either to global of function scope. (accumulate_line_counts): Isolate core of the function to accumulate_line_info and call it for both function and global scope lines. (accumulate_line_info): New function. (output_line_beginning): Fix GNU coding style. (print_source_line): New function. (output_line_details): Likewise. (output_function_details): Likewise. (output_lines): Iterate both source (global) scope and function scope. (struct function_line_start_cmp): New class. * doc/gcov.texi: Reflect changes in documentation. From-SVN: r254562
2017-10-31GCOV: add -j argument (human readable format).Martin Liska1-0/+5
2017-10-31 Martin Liska <mliska@suse.cz> * doc/gcov.texi: Document new option. * gcov.c (print_usage): Likewise print it. (process_args): Support the argument. (format_count): New function. (format_gcov): Use the function. 2017-10-31 Martin Liska <mliska@suse.cz> * g++.dg/gcov/loop.C: New test. * lib/gcov.exp: Support human readable format for counts. From-SVN: r254269