summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard Samuels <richard.l.samuels@gmail.com>2022-02-14 15:54:50 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-14 16:39:56 +0000
commitc7bfbfeefcce9c73997e61d19c5efd7d57cf8971 (patch)
treeedb4bd431a089d1db31dc1c1556bb27a7dc8b5cc /src
parentbabeb73f150a771624480aaae40e2f1fbaba66ae (diff)
downloadmongo-c7bfbfeefcce9c73997e61d19c5efd7d57cf8971.tar.gz
SERVER-60832 Readd and fix gcov code coverage variant
Diffstat (limited to 'src')
-rw-r--r--src/mongo/SConscript2
-rw-r--r--src/mongo/util/quick_exit.cpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 4e4ec6aad5f..82e6e06b67c 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -106,7 +106,7 @@ if has_option('gcov'):
'MONGO_GCOV',
],
)
-quick_exit_obj = baseEnv.LibraryObject(
+quick_exit_obj = quick_exit_env.LibraryObject(
target='quick_exit',
source=[
'util/quick_exit.cpp',
diff --git a/src/mongo/util/quick_exit.cpp b/src/mongo/util/quick_exit.cpp
index caf113da50a..b934067fd8c 100644
--- a/src/mongo/util/quick_exit.cpp
+++ b/src/mongo/util/quick_exit.cpp
@@ -65,6 +65,8 @@
#ifdef MONGO_GCOV
extern "C" void __gcov_flush();
+extern "C" void __gcov_dump();
+extern "C" void __gcov_reset();
#endif
namespace mongo {
@@ -80,8 +82,13 @@ void quickExitWithoutLogging(int code) {
quickExitMutex->lock();
#ifdef MONGO_GCOV
+#if (defined(__clang__) && __clang_major__ >= 12) || __GNUC__ >= 11
+ __gcov_dump();
+ __gcov_reset();
+#else
__gcov_flush();
#endif
+#endif
#if __has_feature(address_sanitizer)
// Always dump coverage data first because older versions of sanitizers may not write coverage