1 //===-- sanitizer_mac.h -----------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file is shared between various sanitizers' runtime libraries and
10 // provides definitions for OSX-specific functions.
11 //===----------------------------------------------------------------------===//
12 #ifndef SANITIZER_MAC_H
13 #define SANITIZER_MAC_H
15 #include "sanitizer_common.h"
16 #include "sanitizer_platform.h"
18 #include "sanitizer_posix.h"
20 namespace __sanitizer
{
22 struct MemoryMappingLayoutData
{
26 ModuleArch current_arch
;
27 u8 current_uuid
[kModuleUUIDSize
];
28 int current_load_cmd_count
;
29 const char *current_load_cmd_addr
;
30 bool current_instrumented
;
34 MACOS_VERSION_UNINITIALIZED
= 0,
35 MACOS_VERSION_UNKNOWN
,
36 MACOS_VERSION_LEOPARD
,
37 MACOS_VERSION_SNOW_LEOPARD
,
39 MACOS_VERSION_MOUNTAIN_LION
,
40 MACOS_VERSION_MAVERICKS
,
41 MACOS_VERSION_YOSEMITE
,
42 MACOS_VERSION_EL_CAPITAN
,
44 MACOS_VERSION_HIGH_SIERRA
,
45 MACOS_VERSION_HIGH_SIERRA_DOT_RELEASE_4
,
47 MACOS_VERSION_CATALINA
,
48 MACOS_VERSION_UNKNOWN_NEWER
51 MacosVersion
GetMacosVersion();
55 void RestrictMemoryToMaxAddress(uptr max_address
);
57 } // namespace __sanitizer
60 static char __crashreporter_info_buff__
[__sanitizer::kErrorMessageBufferSize
] =
62 static const char *__crashreporter_info__
__attribute__((__used__
)) =
63 &__crashreporter_info_buff__
[0];
64 asm(".desc ___crashreporter_info__, 0x10");
67 namespace __sanitizer
{
68 static BlockingMutex
crashreporter_info_mutex(LINKER_INITIALIZED
);
70 INLINE
void CRAppendCrashLogMessage(const char *msg
) {
71 BlockingMutexLock
l(&crashreporter_info_mutex
);
72 internal_strlcat(__crashreporter_info_buff__
, msg
,
73 sizeof(__crashreporter_info_buff__
)); }
74 } // namespace __sanitizer
76 #endif // SANITIZER_MAC
77 #endif // SANITIZER_MAC_H