From 720919bc144e1b51f0a912aed1f9a766c39d6c92 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Mon, 25 Mar 2019 19:15:37 +0100 Subject: [PATCH] gcov: update to version 8.3.0 Issue #3307 --- repos/libports/lib/mk/gcov-libcommon.mk | 1 + repos/libports/lib/mk/gcov-libiberty.mk | 5 + repos/libports/ports/gcov.hash | 2 +- repos/libports/ports/gcov.port | 30 ++++-- .../src/app/gcov/patches/backtrace.patch | 20 ++-- .../libports/src/app/gcov/patches/gcov.patch | 97 ++++++++++--------- .../src/lib/gcov/patches/libgcov.patch | 2 +- .../src/lib/gcov/patches/setbuf.patch | 8 +- 8 files changed, 96 insertions(+), 69 deletions(-) diff --git a/repos/libports/lib/mk/gcov-libcommon.mk b/repos/libports/lib/mk/gcov-libcommon.mk index 33471ecc6..e8e9d98f2 100644 --- a/repos/libports/lib/mk/gcov-libcommon.mk +++ b/repos/libports/lib/mk/gcov-libcommon.mk @@ -5,6 +5,7 @@ GCOV_DIR := $(GCOV_PORT_DIR)/src/gcov SRC_CC = diagnostic.cc \ diagnostic-color.cc \ diagnostic-show-locus.cc \ + edit-context.cc \ ggc-none.cc \ hash-table.cc \ input.cc \ diff --git a/repos/libports/lib/mk/gcov-libiberty.mk b/repos/libports/lib/mk/gcov-libiberty.mk index 667ce54d9..a8b700b98 100644 --- a/repos/libports/lib/mk/gcov-libiberty.mk +++ b/repos/libports/lib/mk/gcov-libiberty.mk @@ -11,13 +11,18 @@ SRC_C = argv.c \ fopen_unlocked.c \ hashtab.c \ lbasename.c \ + md5.c \ obstack.c \ + rust-demangle.c \ safe-ctype.c \ + splay-tree.c \ vprintf-support.c \ xexit.c \ xmalloc.c \ + xmemdup.c \ xstrdup.c \ xstrerror.c \ + xstrndup.c \ xvasprintf.c CC_OPT += -DHAVE_CONFIG_H diff --git a/repos/libports/ports/gcov.hash b/repos/libports/ports/gcov.hash index 6455230e4..d79377f72 100644 --- a/repos/libports/ports/gcov.hash +++ b/repos/libports/ports/gcov.hash @@ -1 +1 @@ -d990698e760e811ad4ac174d07c0bde6de48db77 +67d83ba99db93c0e67eda26b33e167aecf48d60d diff --git a/repos/libports/ports/gcov.port b/repos/libports/ports/gcov.port index 585a77da4..37dc11cf0 100644 --- a/repos/libports/ports/gcov.port +++ b/repos/libports/ports/gcov.port @@ -1,18 +1,19 @@ LICENSE := GPLv2 -VERSION := 6.3.0 +VERSION := 8.3.0 DOWNLOADS := gcov.archive generated.git -URL(gcov) := ftp://ftp.fu-berlin.de/gnu/gcc/gcc-$(VERSION)/gcc-$(VERSION).tar.bz2 -SHA(gcov) := f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f +URL(gcov) := ftp://ftp.fu-berlin.de/gnu/gcc/gcc-$(VERSION)/gcc-$(VERSION).tar.xz +SHA(gcov) := 64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c DIR(gcov) := src/gcov SIG(gcov) := ${URL(gcov)} KEY(gcov) := GNU URL(generated) := https://github.com/cproc/genode-generated.git -REV(generated) := c0b4333a7df8de45036506b9542b57349796775d +REV(generated) := 21d621a326ac3f074647c0555144d1638ee495a8 DIR(generated) := include -TAR_OPT(gcov) := gcc-$(VERSION)/gcc/coretypes.h \ +TAR_OPT(gcov) := gcc-$(VERSION)/gcc/color-macros.h \ + gcc-$(VERSION)/gcc/coretypes.h \ gcc-$(VERSION)/gcc/defaults.h \ gcc-$(VERSION)/gcc/diagnostic.c \ gcc-$(VERSION)/gcc/diagnostic-color.c \ @@ -22,8 +23,12 @@ TAR_OPT(gcov) := gcc-$(VERSION)/gcc/coretypes.h \ gcc-$(VERSION)/gcc/diagnostic.h \ gcc-$(VERSION)/gcc/diagnostic-show-locus.c \ gcc-$(VERSION)/gcc/double-int.h \ + gcc-$(VERSION)/gcc/dumpfile.h \ + gcc-$(VERSION)/gcc/edit-context.h \ + gcc-$(VERSION)/gcc/edit-context.c \ gcc-$(VERSION)/gcc/fixed-value.h \ gcc-$(VERSION)/gcc/flag-types.h \ + gcc-$(VERSION)/gcc/gcc-rich-location.h \ gcc-$(VERSION)/gcc/gcov.c \ gcc-$(VERSION)/gcc/gcov-counter.def \ gcc-$(VERSION)/gcc/gcov-io.c \ @@ -49,13 +54,18 @@ TAR_OPT(gcov) := gcc-$(VERSION)/gcc/coretypes.h \ gcc-$(VERSION)/gcc/mem-stats.h \ gcc-$(VERSION)/gcc/mem-stats-traits.h \ gcc-$(VERSION)/gcc/mode-classes.def \ + gcc-$(VERSION)/gcc/poly-int.h \ + gcc-$(VERSION)/gcc/poly-int-types.h \ gcc-$(VERSION)/gcc/pretty-print.c \ gcc-$(VERSION)/gcc/pretty-print.h \ gcc-$(VERSION)/gcc/real.h \ + gcc-$(VERSION)/gcc/selftest.h \ + gcc-$(VERSION)/gcc/selftest-diagnostic.h \ gcc-$(VERSION)/gcc/signop.h \ gcc-$(VERSION)/gcc/statistics.h \ gcc-$(VERSION)/gcc/system.h \ gcc-$(VERSION)/gcc/tsystem.h \ + gcc-$(VERSION)/gcc/typed-splay-tree.h \ gcc-$(VERSION)/gcc/vec.c \ gcc-$(VERSION)/gcc/vec.h \ gcc-$(VERSION)/gcc/version.c \ @@ -68,8 +78,8 @@ TAR_OPT(gcov) := gcc-$(VERSION)/gcc/coretypes.h \ gcc-$(VERSION)/gcc/config/newlib-stdint.h \ gcc-$(VERSION)/gcc/config/vxworks-dummy.h \ gcc-$(VERSION)/gcc/config/arm/aout.h \ - gcc-$(VERSION)/gcc/config/arm/arm-cores.def \ gcc-$(VERSION)/gcc/config/arm/arm.h \ + gcc-$(VERSION)/gcc/config/arm/arm-flags.h \ gcc-$(VERSION)/gcc/config/arm/arm-opts.h \ gcc-$(VERSION)/gcc/config/arm/bpabi.h \ gcc-$(VERSION)/gcc/config/arm/elf.h \ @@ -89,8 +99,10 @@ TAR_OPT(gcov) := gcc-$(VERSION)/gcc/coretypes.h \ gcc-$(VERSION)/include/filenames.h \ gcc-$(VERSION)/include/hashtab.h \ gcc-$(VERSION)/include/libiberty.h \ + gcc-$(VERSION)/include/md5.h \ gcc-$(VERSION)/include/obstack.h \ gcc-$(VERSION)/include/safe-ctype.h \ + gcc-$(VERSION)/include/splay-tree.h \ gcc-$(VERSION)/libcpp/internal.h \ gcc-$(VERSION)/libcpp/line-map.c \ gcc-$(VERSION)/libcpp/system.h \ @@ -115,14 +127,19 @@ TAR_OPT(gcov) := gcc-$(VERSION)/gcc/coretypes.h \ gcc-$(VERSION)/libiberty/fopen_unlocked.c \ gcc-$(VERSION)/libiberty/hashtab.c \ gcc-$(VERSION)/libiberty/lbasename.c \ + gcc-$(VERSION)/libiberty/md5.c \ gcc-$(VERSION)/libiberty/obstack.c \ + gcc-$(VERSION)/libiberty/rust-demangle.c \ gcc-$(VERSION)/libiberty/safe-ctype.c \ + gcc-$(VERSION)/libiberty/splay-tree.c \ gcc-$(VERSION)/libiberty/vprintf-support.c \ gcc-$(VERSION)/libiberty/vprintf-support.h \ gcc-$(VERSION)/libiberty/xexit.c \ gcc-$(VERSION)/libiberty/xmalloc.c \ + gcc-$(VERSION)/libiberty/xmemdup.c \ gcc-$(VERSION)/libiberty/xstrdup.c \ gcc-$(VERSION)/libiberty/xstrerror.c \ + gcc-$(VERSION)/libiberty/xstrndup.c \ gcc-$(VERSION)/libiberty/xvasprintf.c \ gcc-$(VERSION)/COPYING \ --strip-components=1 @@ -140,6 +157,7 @@ symlinks: $(DOWNLOADS) $(VERBOSE)ln -s diagnostic-color.c ${DIR(gcov)}/gcc/diagnostic-color.cc $(VERBOSE)ln -s diagnostic-show-locus.c ${DIR(gcov)}/gcc/diagnostic-show-locus.cc $(VERBOSE)ln -s diagnostic.c ${DIR(gcov)}/gcc/diagnostic.cc + $(VERBOSE)ln -s edit-context.c ${DIR(gcov)}/gcc/edit-context.cc $(VERBOSE)ln -s gcov.c ${DIR(gcov)}/gcc/gcov.cc $(VERBOSE)ln -s ggc-none.c ${DIR(gcov)}/gcc/ggc-none.cc $(VERBOSE)ln -s hash-table.c ${DIR(gcov)}/gcc/hash-table.cc diff --git a/repos/libports/src/app/gcov/patches/backtrace.patch b/repos/libports/src/app/gcov/patches/backtrace.patch index c1fbce354..3565cdb37 100644 --- a/repos/libports/src/app/gcov/patches/backtrace.patch +++ b/repos/libports/src/app/gcov/patches/backtrace.patch @@ -9,7 +9,7 @@ From: Christian Prochaska 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c -index bf95666..b68b700 100644 +index 9c567bd..c307120 100644 --- a/gcc/diagnostic-show-locus.c +++ b/gcc/diagnostic-show-locus.c @@ -24,7 +24,9 @@ along with GCC; see the file COPYING3. If not see @@ -21,9 +21,9 @@ index bf95666..b68b700 100644 +#endif #include "diagnostic.h" #include "diagnostic-color.h" - + #include "gcc-rich-location.h" diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c -index 8106172..85d5eb0 100644 +index c61e0c4..fea960f 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -28,7 +28,9 @@ along with GCC; see the file COPYING3. If not see @@ -35,8 +35,8 @@ index 8106172..85d5eb0 100644 +#endif #include "diagnostic.h" #include "diagnostic-color.h" - -@@ -345,7 +347,7 @@ static const char * const bt_stop[] = + #include "edit-context.h" +@@ -376,7 +378,7 @@ static const char * const bt_stop[] = }; /* A callback function passed to the backtrace_full function. */ @@ -45,16 +45,16 @@ index 8106172..85d5eb0 100644 static int bt_callback (void *data, uintptr_t pc, const char *filename, int lineno, const char *function) -@@ -425,7 +427,7 @@ bt_err_callback (void *data ATTRIBUTE_UNUSED, const char *msg, int errnum) +@@ -456,7 +458,7 @@ bt_err_callback (void *data ATTRIBUTE_UNUSED, const char *msg, int errnum) fprintf (stderr, "%s%s%s\n", msg, errnum == 0 ? "" : ": ", errnum == 0 ? "" : xstrerror (errnum)); } - +#endif - /* Take any action which is expected to happen after the diagnostic - is written out. This function does not always return. */ - void -@@ -467,14 +469,17 @@ diagnostic_action_after_output (diagnostic_context *context, + /* Check if we've met the maximum error limit, and if so fatally exit + with a message. CONTEXT is the context to check, and FLUSH + indicates whether a diagnostic_finish call is needed. */ +@@ -511,14 +513,17 @@ diagnostic_action_after_output (diagnostic_context *context, case DK_ICE: case DK_ICE_NOBT: { diff --git a/repos/libports/src/app/gcov/patches/gcov.patch b/repos/libports/src/app/gcov/patches/gcov.patch index 8b2518b87..d6c973ca5 100644 --- a/repos/libports/src/app/gcov/patches/gcov.patch +++ b/repos/libports/src/app/gcov/patches/gcov.patch @@ -8,16 +8,19 @@ From: Christian Prochaska 1 file changed, 132 insertions(+), 7 deletions(-) diff --git a/gcc/gcov.c b/gcc/gcov.c -index 50061c7..06d3c97 100644 +index c7c52ce..e039ef0 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c -@@ -41,10 +41,13 @@ along with Gcov; see the file COPYING3. If not see +@@ -47,6 +47,8 @@ along with Gcov; see the file COPYING3. If not see #include +#include + - #define IN_GCOV 1 + #include "md5.h" + + using namespace std; +@@ -55,6 +57,7 @@ using namespace std; #include "gcov-io.h" #include "gcov-io.c" @@ -25,7 +28,7 @@ index 50061c7..06d3c97 100644 /* The gcno file is generated by -ftest-coverage option. The gcda file is generated by a program compiled with -fprofile-arcs. Their formats are documented in gcov-io.h. */ -@@ -299,6 +302,11 @@ static unsigned bbg_stamp; +@@ -436,6 +439,11 @@ static unsigned bbg_supports_has_unexecuted_blocks; static char *da_file_name; @@ -37,7 +40,7 @@ index 50061c7..06d3c97 100644 /* Data file is missing. */ static int no_data_file; -@@ -350,6 +358,16 @@ static int flag_all_blocks = 0; +@@ -504,6 +512,16 @@ static int flag_human_readable_numbers = 0; static int flag_function_summary = 0; @@ -54,9 +57,9 @@ index 50061c7..06d3c97 100644 /* Object directory file prefix. This is the directory/file where the graph and data files are looked for, if nonzero. */ -@@ -407,6 +425,43 @@ static void release_structures (void); - static void release_function (function_t *); - extern int main (int, char **); +@@ -750,6 +768,43 @@ get_cycles_count (line_info &linfo, bool handle_negative_cycles = true) + return count; + } +void process_files(const char *dir_path) +{ @@ -98,62 +101,61 @@ index 50061c7..06d3c97 100644 int main (int argc, char **argv) { -@@ -437,7 +492,7 @@ main (int argc, char **argv) - sources = XNEWVEC (source_t, a_sources); - +@@ -775,13 +830,25 @@ main (int argc, char **argv) + expandargv (&argc, &argv); + argno = process_args (argc, argv); - if (optind == argc) + if ((optind == argc) && !flag_genode_autopilot) print_usage (true); if (argc - argno > 1) -@@ -445,6 +500,18 @@ main (int argc, char **argv) + multiple_files = 1; first_arg = argno; - ++ + if (flag_genode_autopilot) { + + /* search .gcda files and process each one */ + process_files("/"); + ++ process_all_functions(); + generate_results(NULL); -+ + release_structures(); + + return 0; + } -+ + for (; argno != argc; argno++) { - if (flag_display_progress) -@@ -488,7 +555,8 @@ print_usage (int error_p) - fnotice (file, " -r, --relative-only Only show data for relative sources\n"); - fnotice (file, " -s, --source-prefix DIR Source prefix to elide\n"); +@@ -833,7 +900,8 @@ print_usage (int error_p) fnotice (file, " -u, --unconditional-branches Show unconditional branch counts too\n"); -- fnotice (file, " -v, --version Print version number, then exit\n"); -+ fnotice (file, " -v, --version Print version number, then exit\n\n"); + fnotice (file, " -v, --version Print version number, then exit\n"); + fnotice (file, " -w, --verbose Print verbose informations\n"); +- fnotice (file, " -x, --hash-filenames Hash long pathnames\n"); ++ fnotice (file, " -x, --hash-filenames Hash long pathnames\n\n"); + fnotice (file, " -g, --genode-autopilot Genode autopilot mode\n"); fnotice (file, "\nFor bug reporting instructions, please see:\n%s.\n", bug_report_url); exit (status); -@@ -528,6 +596,7 @@ static const struct option options[] = - { "source-prefix", required_argument, NULL, 's' }, - { "unconditional-branches", no_argument, NULL, 'u' }, +@@ -877,6 +945,7 @@ static const struct option options[] = { "display-progress", no_argument, NULL, 'd' }, + { "hash-filenames", no_argument, NULL, 'x' }, + { "use-colors", no_argument, NULL, 'k' }, + { "genode-autopilot", no_argument, NULL, 'g' }, { 0, 0, 0, 0 } }; -@@ -538,7 +607,7 @@ process_args (int argc, char **argv) +@@ -887,7 +956,7 @@ process_args (int argc, char **argv) { int opt; -- while ((opt = getopt_long (argc, argv, "abcdfhilmno:s:pruv", options, NULL)) != -+ while ((opt = getopt_long (argc, argv, "abcdfghilmno:s:pruv", options, NULL)) != - -1) +- const char *opts = "abcdfhijklmno:prs:uvwx"; ++ const char *opts = "abcdfghijklmno:prs:uvwx"; + while ((opt = getopt_long (argc, argv, opts, options, NULL)) != -1) { switch (opt) -@@ -555,6 +624,9 @@ process_args (int argc, char **argv) +@@ -904,6 +973,9 @@ process_args (int argc, char **argv) case 'f': flag_function_summary = 1; break; @@ -163,9 +165,9 @@ index 50061c7..06d3c97 100644 case 'h': print_usage (false); /* print_usage will exit. */ -@@ -784,18 +856,51 @@ process_file (const char *file_name) +@@ -1234,11 +1306,43 @@ process_all_functions (void) static void - output_gcov_file (const char *file_name, source_t *src) + output_gcov_file (const char *file_name, source_info *src) { + if (flag_genode_autopilot) { + @@ -206,18 +208,19 @@ index 50061c7..06d3c97 100644 + stdout : + fopen (gcov_file_name, "w"); if (gcov_file) - { - fnotice (stdout, "Creating '%s'\n", gcov_file_name); - output_lines (gcov_file, src); - if (ferror (gcov_file)) - fnotice (stderr, "Error writing output file '%s'\n", gcov_file_name); -- fclose (gcov_file); -+ if (!flag_genode_autopilot) -+ fclose (gcov_file); - } + { + fnotice (stdout, "Creating '%s'\n", gcov_file_name); +@@ -1246,7 +1350,8 @@ output_gcov_file (const char *file_name, source_info *src) + if (ferror (gcov_file)) + fnotice (stderr, "Error writing output file '%s'\n", + gcov_file_name); +- fclose (gcov_file); ++ if (!flag_genode_autopilot) ++ fclose (gcov_file); + } else - fnotice (stderr, "Could not open output file '%s'\n", gcov_file_name); -@@ -879,7 +984,10 @@ generate_results (const char *file_name) + fnotice (stderr, "Could not open output file '%s'\n", gcov_file_name); +@@ -1329,7 +1434,10 @@ generate_results (const char *file_name) function_summary (&src->coverage, "File"); total_lines += src->coverage.lines; total_executed += src->coverage.lines_executed; @@ -227,9 +230,9 @@ index 50061c7..06d3c97 100644 + !(flag_genode_autopilot && + (src->coverage.lines_executed == src->coverage.lines))) { - if (flag_intermediate_format) - /* Output the intermediate format without requiring source -@@ -968,7 +1076,8 @@ create_file_names (const char *file_name) + if (flag_intermediate_format) + /* Output the intermediate format without requiring source +@@ -1384,7 +1492,8 @@ create_file_names (const char *file_name) /* Free previous file names. */ free (bbg_file_name); free (da_file_name); @@ -239,7 +242,7 @@ index 50061c7..06d3c97 100644 bbg_file_time = 0; bbg_stamp = 0; -@@ -1014,6 +1123,10 @@ create_file_names (const char *file_name) +@@ -1430,6 +1539,10 @@ create_file_names (const char *file_name) strcpy (da_file_name, name); strcpy (da_file_name + length, GCOV_DATA_SUFFIX); @@ -250,7 +253,7 @@ index 50061c7..06d3c97 100644 free (name); return; } -@@ -1114,6 +1227,18 @@ find_source (const char *file_name) +@@ -1486,6 +1599,18 @@ find_source (const char *file_name) #endif && IS_DIR_SEPARATOR (src->coverage.name[source_length])) src->coverage.name += source_length + 1; diff --git a/repos/libports/src/lib/gcov/patches/libgcov.patch b/repos/libports/src/lib/gcov/patches/libgcov.patch index 8cd67deff..28409a85b 100644 --- a/repos/libports/src/lib/gcov/patches/libgcov.patch +++ b/repos/libports/src/lib/gcov/patches/libgcov.patch @@ -8,7 +8,7 @@ From: Christian Prochaska 1 file changed, 6 insertions(+) diff --git a/gcc/tsystem.h b/gcc/tsystem.h -index 7dc4b54..c7a09df 100644 +index 969b105..529dfe3 100644 --- a/gcc/tsystem.h +++ b/gcc/tsystem.h @@ -90,7 +90,9 @@ extern void *memset (void *, int, size_t); diff --git a/repos/libports/src/lib/gcov/patches/setbuf.patch b/repos/libports/src/lib/gcov/patches/setbuf.patch index c572f813b..cb495a555 100644 --- a/repos/libports/src/lib/gcov/patches/setbuf.patch +++ b/repos/libports/src/lib/gcov/patches/setbuf.patch @@ -8,12 +8,12 @@ From: Christian Prochaska 1 file changed, 2 insertions(+) diff --git a/gcc/gcov-io.c b/gcc/gcov-io.c -index 17fcae0..269196a 100644 +index 3fe1e61..c4cc246 100644 --- a/gcc/gcov-io.c +++ b/gcc/gcov-io.c -@@ -217,7 +217,9 @@ gcov_open (const char *name, int mode) - return 0; - #endif +@@ -192,7 +192,9 @@ gcov_open (const char *name, int mode) + + gcov_var.mode = mode ? mode : 1; +#if 0 setbuf (gcov_var.file, (char *)0);