diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-22 19:43:56 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-22 19:43:56 +0000 |
commit | 99ea5e489fa5765bf0eb50ca4261ab5cc20abeeb (patch) | |
tree | 4c90812321bc8c987ef756cc5d05af608f7192a2 /lib/xray/xray_interface.cc | |
parent | 834763c1a4849df24fd4f9b466d0c160cf7ed44b (diff) |
Diffstat (limited to 'lib/xray/xray_interface.cc')
-rw-r--r-- | lib/xray/xray_interface.cc | 14 |
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 { |