1 //===-- interception_mac.cc -------------------------------------*- C++ -*-===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is a part of AddressSanitizer, an address sanity checker.
10 // Mac-specific interception methods.
11 //===----------------------------------------------------------------------===//
15 #include "interception.h"
16 #include "mach_override/mach_override.h"
18 namespace __interception
{
19 bool OverrideFunction(uptr old_func
, uptr new_func
, uptr
*orig_old_func
) {
21 int res
= __asan_mach_override_ptr_custom((void*)old_func
, (void*)new_func
,
22 (void**)orig_old_func
,
23 __interception_allocate_island
,
24 __interception_deallocate_island
);
25 return (res
== 0) && (*orig_old_func
!= 0);
27 } // namespace __interception