[compiler-rt] r303526 - [XRay][compiler-rt] Add __xray_remove_customevent_handler(...)

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Sun May 21 20:23:54 PDT 2017


Author: dberris
Date: Sun May 21 22:23:54 2017
New Revision: 303526

URL: http://llvm.org/viewvc/llvm-project?rev=303526&view=rev
Log:
[XRay][compiler-rt] Add __xray_remove_customevent_handler(...)

This change adds __xray_remove_customevent_handler(...) to be consistent
with other APIs that add/remove handlers.

Modified:
    compiler-rt/trunk/include/xray/xray_interface.h
    compiler-rt/trunk/lib/xray/xray_interface.cc
    compiler-rt/trunk/test/xray/TestCases/Linux/custom-event-logging.cc

Modified: compiler-rt/trunk/include/xray/xray_interface.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/xray/xray_interface.h?rev=303526&r1=303525&r2=303526&view=diff
==============================================================================
--- compiler-rt/trunk/include/xray/xray_interface.h (original)
+++ compiler-rt/trunk/include/xray/xray_interface.h Sun May 21 22:23:54 2017
@@ -69,6 +69,10 @@ extern int __xray_remove_handler_arg1();
 /// Provide a function to invoke when XRay encounters a custom event.
 extern int __xray_set_customevent_handler(void (*entry)(void*, std::size_t));
 
+/// This removes whatever the currently provided custom event handler is.
+/// Returns 1 on success, 0 on error.
+extern int __xray_remove_customevent_handler();
+
 enum XRayPatchingStatus {
   NOT_INITIALIZED = 0,
   SUCCESS = 1,

Modified: compiler-rt/trunk/lib/xray/xray_interface.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_interface.cc?rev=303526&r1=303525&r2=303526&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_interface.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_interface.cc Sun May 21 22:23:54 2017
@@ -119,10 +119,15 @@ int __xray_set_customevent_handler(void
   return 0;
 }
 
+
 int __xray_remove_handler() XRAY_NEVER_INSTRUMENT {
   return __xray_set_handler(nullptr);
 }
 
+int __xray_remove_customevent_handler() XRAY_NEVER_INSTRUMENT {
+  return __xray_set_customevent_handler(nullptr);
+}
+
 __sanitizer::atomic_uint8_t XRayPatching{0};
 
 using namespace __xray;

Modified: compiler-rt/trunk/test/xray/TestCases/Linux/custom-event-logging.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/xray/TestCases/Linux/custom-event-logging.cc?rev=303526&r1=303525&r2=303526&view=diff
==============================================================================
--- compiler-rt/trunk/test/xray/TestCases/Linux/custom-event-logging.cc (original)
+++ compiler-rt/trunk/test/xray/TestCases/Linux/custom-event-logging.cc Sun May 21 22:23:54 2017
@@ -33,7 +33,7 @@ int main() {
   // CHECK-NEXT: after calling the custom logging...
   printf("removing custom event handler...\n");
   // CHECK-NEXT: removing custom event handler...
-  __xray_set_customevent_handler(nullptr);
+  __xray_remove_customevent_handler();
   foo();
   // CHECK-NEXT: before calling the custom logging...
   // CHECK-NEXT: after calling the custom logging...




More information about the llvm-commits mailing list