patch 8.2.0739: incomplete profiling when exiting because of a dealy signal
Problem: Incomplete profiling when exiting because of a dealy signal.
Solution: Call __gcov_flush() if available.
diff --git a/src/Makefile b/src/Makefile
index 6c7ef85..7c2934a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -686,8 +686,10 @@
# 7. Open the objects/index.html file in a web browser to view the coverage
# information.
#
-# PROFILE_CFLAGS=-g -O0 -fprofile-arcs -ftest-coverage
# LDFLAGS=--coverage
+# PROFILE_CFLAGS=-g -O0 -fprofile-arcs -ftest-coverage -DWE_ARE_PROFILING -DUSE_GCOV_FLUSH
+# Alternate flags
+# PROFILE_CFLAGS=-g -O0 --coverage -DWE_ARE_PROFILING -DUSE_GCOV_FLUSH
# Uncomment one of the next two lines to compile Vim with the
diff --git a/src/os_unix.c b/src/os_unix.c
index b5ae9f8..aea3d5a 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -3312,6 +3312,10 @@
}
}
+#ifdef USE_GCOV_FLUSH
+extern void __gcov_flush();
+#endif
+
void
mch_exit(int r)
{
@@ -3358,6 +3362,12 @@
}
out_flush();
ml_close_all(TRUE); // remove all memfiles
+
+#ifdef USE_GCOV_FLUSH
+ // Flush coverage info before possibly being killed by a deadly signal.
+ __gcov_flush();
+#endif
+
may_core_dump();
#ifdef FEAT_GUI
if (gui.in_use)
diff --git a/src/version.c b/src/version.c
index 317b344..799e846 100644
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 739,
+/**/
738,
/**/
737,