]>
Commit | Line | Data |
---|---|---|
dee5ea7a KS |
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 | |
13 | ||
10189819 | 14 | #include "sanitizer_common.h" |
dee5ea7a KS |
15 | #include "sanitizer_platform.h" |
16 | #if SANITIZER_MAC | |
696d846a | 17 | #include "sanitizer_posix.h" |
dee5ea7a KS |
18 | |
19 | namespace __sanitizer { | |
20 | ||
5d3805fc JJ |
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; | |
30 | }; | |
31 | ||
dee5ea7a KS |
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, | |
c5be964a KS |
39 | MACOS_VERSION_MAVERICKS, |
40 | MACOS_VERSION_YOSEMITE, | |
696d846a | 41 | MACOS_VERSION_UNKNOWN_NEWER |
dee5ea7a KS |
42 | }; |
43 | ||
44 | MacosVersion GetMacosVersion(); | |
45 | ||
696d846a MO |
46 | char **GetEnviron(); |
47 | ||
5d3805fc JJ |
48 | void RestrictMemoryToMaxAddress(uptr max_address); |
49 | ||
dee5ea7a KS |
50 | } // namespace __sanitizer |
51 | ||
10189819 MO |
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" | |
59 | ||
60 | namespace __sanitizer { | |
61 | static BlockingMutex crashreporter_info_mutex(LINKER_INITIALIZED); | |
62 | ||
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 | |
68 | ||
dee5ea7a KS |
69 | #endif // SANITIZER_MAC |
70 | #endif // SANITIZER_MAC_H |