summaryrefslogtreecommitdiff
path: root/lib/xray/xray_interface.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xray/xray_interface.cc')
-rw-r--r--lib/xray/xray_interface.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/xray/xray_interface.cc b/lib/xray/xray_interface.cc
index c437a72e3f05e..e912b6e478a3c 100644
--- a/lib/xray/xray_interface.cc
+++ b/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;
@@ -326,7 +331,14 @@ uintptr_t __xray_function_address(int32_t FuncId) XRAY_NEVER_INSTRUMENT {
__sanitizer::SpinMutexLock Guard(&XRayInstrMapMutex);
if (FuncId <= 0 || static_cast<size_t>(FuncId) > XRayInstrMap.Functions)
return 0;
- return XRayInstrMap.SledsIndex[FuncId - 1].Begin->Address;
+ return XRayInstrMap.SledsIndex[FuncId - 1].Begin->Address
+// On PPC, function entries are always aligned to 16 bytes. The beginning of a
+// sled might be a local entry, which is always +8 based on the global entry.
+// Always return the global entry.
+#ifdef __PPC__
+ & ~0xf
+#endif
+ ;
}
size_t __xray_max_function_id() XRAY_NEVER_INSTRUMENT {