summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2023-05-15 13:54:21 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-17 15:48:23 +0000
commit4f358bd58f40f37d2bcdc7d941890489ed5aa7a1 (patch)
tree83e2387ffd379b83f116a7cb4663c83463e39ee6
parentd71a066275aef95e15de4e9701dc94c217871f20 (diff)
downloadmongo-4f358bd58f40f37d2bcdc7d941890489ed5aa7a1.tar.gz
SERVER-77107 Add LLVM XRay support
-rw-r--r--src/mongo/util/quick_exit.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/util/quick_exit.cpp b/src/mongo/util/quick_exit.cpp
index 34da3a1cbc8..0e89fcfcc3f 100644
--- a/src/mongo/util/quick_exit.cpp
+++ b/src/mongo/util/quick_exit.cpp
@@ -65,6 +65,12 @@
#include <sanitizer/lsan_interface.h>
#endif
+#if __has_feature(xray_instrument)
+// See clang/test/Lexer/has_feature_xray_instrument.cpp
+// see compiler-rt/lib/xray/xray_basic_flags.inc
+#include <xray/xray_log_interface.h>
+#endif
+
#ifdef MONGO_GCOV
extern "C" void __gcov_flush();
extern "C" void __gcov_dump();
@@ -92,6 +98,13 @@ void quickExitWithoutLogging(ExitCode code) {
#endif
#endif
+#if __has_feature(xray_instrument)
+ // Stop XRay and flush the xray basic log
+ /* ignore */ __xray_log_finalize();
+ /* ignore */ __xray_unpatch();
+ /* ignore */ __xray_log_flushLog();
+#endif
+
#if __has_feature(address_sanitizer)
// Always dump coverage data first because older versions of sanitizers may not write coverage
// data before exiting with errors. The underlying issue is fixed in clang 3.6, which also