[compiler-rt] r361194 - This change adds an API to allow setting the flag to indicate that the profile data has been dumped to the file.

Max Moroz via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 13:02:20 PDT 2019


Author: dor1s
Date: Mon May 20 13:02:20 2019
New Revision: 361194

URL: http://llvm.org/viewvc/llvm-project?rev=361194&view=rev
Log:
This change adds an API to allow setting the flag to indicate that the profile data has been dumped to the file.

Summary:
The main use is for users to disable dumping profile data to the file
for certain processes in case the processes don't have permission to
write to the disks, and trying to do so would result in side effects
such as crashes.

Patch by Yuke Liao (@liaoyuke).

Additional context (Chromium use case):
- https://bugs.chromium.org/p/chromium/issues/detail?id=842424
- https://bugs.chromium.org/p/chromium/issues/detail?id=957655
- https://chromium-review.googlesource.com/c/chromium/src/+/1610093

Reviewers: Dor1s, vsk, davidxl

Reviewed By: Dor1s, davidxl

Subscribers: delcypher, davidxl, sajjadm, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D62078

Modified:
    compiler-rt/trunk/lib/profile/InstrProfiling.c
    compiler-rt/trunk/lib/profile/InstrProfiling.h

Modified: compiler-rt/trunk/lib/profile/InstrProfiling.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfiling.c?rev=361194&r1=361193&r2=361194&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfiling.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfiling.c Mon May 20 13:02:20 2019
@@ -35,6 +35,10 @@ COMPILER_RT_VISIBILITY void lprofSetProf
   ProfileDumped = 1;
 }
 
+COMPILER_RT_VISIBILITY void __llvm_profile_set_dumped() {
+  lprofSetProfileDumped();
+}
+
 /* Return the number of bytes needed to add to SizeInBytes to make it
  *   the result a multiple of 8.
  */

Modified: compiler-rt/trunk/lib/profile/InstrProfiling.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfiling.h?rev=361194&r1=361193&r2=361194&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfiling.h (original)
+++ compiler-rt/trunk/lib/profile/InstrProfiling.h Mon May 20 13:02:20 2019
@@ -192,6 +192,14 @@ uint64_t __llvm_profile_get_data_size(co
                                       const __llvm_profile_data *End);
 
 /*!
+ * \brief Set the flag that profile data has been dumped to the file.
+ * This is useful for users to disable dumping profile data to the file for
+ * certain processes in case the processes don't have permission to write to
+ * the disks, and trying to do so would result in side effects such as crashes.
+ */
+void __llvm_profile_set_dumped();
+
+/*!
  * This variable is defined in InstrProfilingRuntime.cc as a hidden
  * symbol. Its main purpose is to enable profile runtime user to
  * bypass runtime initialization code -- if the client code explicitly




More information about the llvm-commits mailing list