interception_mac.cc revision 245614
1//===-- interception_mac.cc -------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file is a part of AddressSanitizer, an address sanity checker. 11// 12// Mac-specific interception methods. 13//===----------------------------------------------------------------------===// 14 15#ifdef __APPLE__ 16 17#include "interception.h" 18#include "mach_override/mach_override.h" 19 20namespace __interception { 21bool OverrideFunction(uptr old_func, uptr new_func, uptr *orig_old_func) { 22 *orig_old_func = 0; 23 int res = __asan_mach_override_ptr_custom((void*)old_func, (void*)new_func, 24 (void**)orig_old_func, 25 __interception_allocate_island, 26 __interception_deallocate_island); 27 return (res == 0) && (*orig_old_func != 0); 28} 29} // namespace __interception 30 31#endif // __APPLE__ 32