From a82502ddf807cdd25fe04879390310727156ab42 Mon Sep 17 00:00:00 2001 From: marxin Date: Thu, 9 Nov 2017 09:11:17 +0000 Subject: GCOV: support multiple functions per a line (PR gcov-profile/48463) 2017-11-09 Martin Liska 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 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254562 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/coverage.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/coverage.c') diff --git a/gcc/coverage.c b/gcc/coverage.c index 8a56a677f15..f57897b8314 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -663,8 +663,15 @@ coverage_begin_function (unsigned lineno_checksum, unsigned cfg_checksum) gcov_write_unsigned (cfg_checksum); gcov_write_string (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl))); + gcov_write_unsigned (DECL_ARTIFICIAL (current_function_decl)); gcov_write_filename (xloc.file); gcov_write_unsigned (xloc.line); + gcov_write_unsigned (xloc.column); + + expanded_location endloc = expand_location (cfun->function_end_locus); + + /* Function can start in a single file and end in another one. */ + gcov_write_unsigned (endloc.file == xloc.file ? endloc.line : xloc.line); gcov_write_length (offset); return !gcov_is_error (); -- cgit v1.2.1 From fa6f8ae7f11890248625f0274948e583fde457f2 Mon Sep 17 00:00:00 2001 From: marxin Date: Fri, 10 Nov 2017 14:40:17 +0000 Subject: GCOV: do not support unexecuted blocks in Ada 2017-11-10 Martin Liska * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254627 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/coverage.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/coverage.c') diff --git a/gcc/coverage.c b/gcc/coverage.c index f57897b8314..ea05d94f441 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -1269,6 +1269,9 @@ coverage_init (const char *filename) gcov_write_unsigned (GCOV_NOTE_MAGIC); gcov_write_unsigned (GCOV_VERSION); gcov_write_unsigned (bbg_file_stamp); + + /* Do not support has_unexecuted_blocks for Ada. */ + gcov_write_unsigned (strcmp (lang_hooks.name, "GNU Ada") != 0); } } -- cgit v1.2.1