diff options
| -rw-r--r-- | compiler-rt/include/xray/xray_interface.h | 4 | ||||
| -rw-r--r-- | compiler-rt/lib/xray/xray_interface.cc | 5 | ||||
| -rw-r--r-- | compiler-rt/test/xray/TestCases/Linux/custom-event-logging.cc | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/compiler-rt/include/xray/xray_interface.h b/compiler-rt/include/xray/xray_interface.h index c3833f0be35..dc0c277aa84 100644 --- a/compiler-rt/include/xray/xray_interface.h +++ b/compiler-rt/include/xray/xray_interface.h @@ -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, diff --git a/compiler-rt/lib/xray/xray_interface.cc b/compiler-rt/lib/xray/xray_interface.cc index 523ed16b9e1..e912b6e478a 100644 --- a/compiler-rt/lib/xray/xray_interface.cc +++ b/compiler-rt/lib/xray/xray_interface.cc @@ -119,10 +119,15 @@ int __xray_set_customevent_handler(void (*entry)(void *, size_t)) 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; diff --git a/compiler-rt/test/xray/TestCases/Linux/custom-event-logging.cc b/compiler-rt/test/xray/TestCases/Linux/custom-event-logging.cc index b1a766d4604..9bb5d44e111 100644 --- a/compiler-rt/test/xray/TestCases/Linux/custom-event-logging.cc +++ b/compiler-rt/test/xray/TestCases/Linux/custom-event-logging.cc @@ -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... |

