PR middle-end/85496
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_mac.h
blob4881b62ff575f08c594924785112085c8bbb2d2f
1 //===-- sanitizer_mac.h -----------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is shared between various sanitizers' runtime libraries and
9 // provides definitions for OSX-specific functions.
10 //===----------------------------------------------------------------------===//
11 #ifndef SANITIZER_MAC_H
12 #define SANITIZER_MAC_H
14 #include "sanitizer_common.h"
15 #include "sanitizer_platform.h"
16 #if SANITIZER_MAC
17 #include "sanitizer_posix.h"
19 namespace __sanitizer {
21 struct MemoryMappingLayoutData {
22 int current_image;
23 u32 current_magic;
24 u32 current_filetype;
25 ModuleArch current_arch;
26 u8 current_uuid[kModuleUUIDSize];
27 int current_load_cmd_count;
28 char *current_load_cmd_addr;
29 bool current_instrumented;
32 enum MacosVersion {
33 MACOS_VERSION_UNINITIALIZED = 0,
34 MACOS_VERSION_UNKNOWN,
35 MACOS_VERSION_LEOPARD,
36 MACOS_VERSION_SNOW_LEOPARD,
37 MACOS_VERSION_LION,
38 MACOS_VERSION_MOUNTAIN_LION,
39 MACOS_VERSION_MAVERICKS,
40 MACOS_VERSION_YOSEMITE,
41 MACOS_VERSION_UNKNOWN_NEWER
44 MacosVersion GetMacosVersion();
46 char **GetEnviron();
48 void RestrictMemoryToMaxAddress(uptr max_address);
50 } // namespace __sanitizer
52 extern "C" {
53 static char __crashreporter_info_buff__[__sanitizer::kErrorMessageBufferSize] =
54 {};
55 static const char *__crashreporter_info__ __attribute__((__used__)) =
56 &__crashreporter_info_buff__[0];
57 asm(".desc ___crashreporter_info__, 0x10");
58 } // extern "C"
60 namespace __sanitizer {
61 static BlockingMutex crashreporter_info_mutex(LINKER_INITIALIZED);
63 INLINE void CRAppendCrashLogMessage(const char *msg) {
64 BlockingMutexLock l(&crashreporter_info_mutex);
65 internal_strlcat(__crashreporter_info_buff__, msg,
66 sizeof(__crashreporter_info_buff__)); }
67 } // namespace __sanitizer
69 #endif // SANITIZER_MAC
70 #endif // SANITIZER_MAC_H