2014-02-03 23:32:19 +08:00
|
|
|
//===-- sanitizer_mac.h -----------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file is shared between various sanitizers' runtime libraries and
|
|
|
|
// provides definitions for OSX-specific functions.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SANITIZER_MAC_H
|
|
|
|
#define SANITIZER_MAC_H
|
|
|
|
|
2015-11-21 02:42:07 +08:00
|
|
|
#include "sanitizer_common.h"
|
2014-02-03 23:45:03 +08:00
|
|
|
#include "sanitizer_platform.h"
|
|
|
|
#if SANITIZER_MAC
|
2015-04-09 01:08:24 +08:00
|
|
|
#include "sanitizer_posix.h"
|
2014-02-03 23:45:03 +08:00
|
|
|
|
2014-02-03 23:32:19 +08:00
|
|
|
namespace __sanitizer {
|
|
|
|
|
Removed platform-specific ifdefs from sanitizer_procmaps.h
Summary: Removed platform-specific ifdefs for linux, mac, freebsd and netbsd from sanitizer_procmaps.h
Patch by Yicheng Wang <yichengfb@fb.com>
Reviewers: kcc, kubamracek, alekseyshl, fjricci, vitalybuka
Reviewed By: fjricci, vitalybuka
Subscribers: vitalybuka, emaste, krytarowski, llvm-commits
Differential Revision: https://reviews.llvm.org/D38098
llvm-svn: 313999
2017-09-23 01:48:24 +08:00
|
|
|
struct MemoryMappingLayoutData {
|
|
|
|
int current_image;
|
|
|
|
u32 current_magic;
|
|
|
|
u32 current_filetype;
|
|
|
|
ModuleArch current_arch;
|
|
|
|
u8 current_uuid[kModuleUUIDSize];
|
|
|
|
int current_load_cmd_count;
|
|
|
|
char *current_load_cmd_addr;
|
|
|
|
bool current_instrumented;
|
|
|
|
};
|
|
|
|
|
2014-02-03 23:32:19 +08:00
|
|
|
enum MacosVersion {
|
|
|
|
MACOS_VERSION_UNINITIALIZED = 0,
|
|
|
|
MACOS_VERSION_UNKNOWN,
|
|
|
|
MACOS_VERSION_LEOPARD,
|
|
|
|
MACOS_VERSION_SNOW_LEOPARD,
|
|
|
|
MACOS_VERSION_LION,
|
|
|
|
MACOS_VERSION_MOUNTAIN_LION,
|
2014-11-06 02:53:22 +08:00
|
|
|
MACOS_VERSION_MAVERICKS,
|
|
|
|
MACOS_VERSION_YOSEMITE,
|
2014-12-16 12:46:15 +08:00
|
|
|
MACOS_VERSION_UNKNOWN_NEWER
|
2014-02-03 23:32:19 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
MacosVersion GetMacosVersion();
|
|
|
|
|
2015-06-24 05:39:49 +08:00
|
|
|
char **GetEnviron();
|
|
|
|
|
2017-07-13 07:29:21 +08:00
|
|
|
void RestrictMemoryToMaxAddress(uptr max_address);
|
|
|
|
|
2014-02-03 23:32:19 +08:00
|
|
|
} // namespace __sanitizer
|
|
|
|
|
2015-11-21 02:42:07 +08:00
|
|
|
extern "C" {
|
2016-09-16 05:02:18 +08:00
|
|
|
static char __crashreporter_info_buff__[__sanitizer::kErrorMessageBufferSize] =
|
|
|
|
{};
|
2015-11-21 02:42:07 +08:00
|
|
|
static const char *__crashreporter_info__ __attribute__((__used__)) =
|
|
|
|
&__crashreporter_info_buff__[0];
|
|
|
|
asm(".desc ___crashreporter_info__, 0x10");
|
|
|
|
} // extern "C"
|
2016-09-16 05:02:18 +08:00
|
|
|
|
|
|
|
namespace __sanitizer {
|
2016-01-07 07:15:01 +08:00
|
|
|
static BlockingMutex crashreporter_info_mutex(LINKER_INITIALIZED);
|
2015-11-21 02:42:07 +08:00
|
|
|
|
2016-01-07 07:15:01 +08:00
|
|
|
INLINE void CRAppendCrashLogMessage(const char *msg) {
|
|
|
|
BlockingMutexLock l(&crashreporter_info_mutex);
|
|
|
|
internal_strlcat(__crashreporter_info_buff__, msg,
|
2015-11-21 02:42:07 +08:00
|
|
|
sizeof(__crashreporter_info_buff__)); }
|
2016-09-16 05:02:18 +08:00
|
|
|
} // namespace __sanitizer
|
2015-11-21 02:42:07 +08:00
|
|
|
|
2014-02-03 23:45:03 +08:00
|
|
|
#endif // SANITIZER_MAC
|
2014-02-03 23:32:19 +08:00
|
|
|
#endif // SANITIZER_MAC_H
|