Migrate to OS_MAC and OS_APPLE in Crashpad

This migrates:

 defined(OS_MACOSX) -> defined(OS_APPLE)
 defined(OS_MACOSX) && !defined(OS_IOS) -> defined(OS_MAC)
 !defined(OS_MACOSX) || defined(OS_IOS) -> !defined(OS_MAC)

Bug: chromium:1105907
Change-Id: I1b4abc19bbbe8df90e9c6e64cd29324b40b8ab71
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2321777
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Avi Drissman 2020-07-27 22:20:52 -04:00 committed by Commit Bot
parent e89ba0d1d6
commit 4ae896bad0
39 changed files with 143 additions and 145 deletions

2
DEPS
View File

@ -42,7 +42,7 @@ deps = {
'7bde79cc274d06451bf65ae82c012a5d3e476b5a',
'crashpad/third_party/mini_chromium/mini_chromium':
Var('chromium_git') + '/chromium/mini_chromium@' +
'85e41f6b6cb5dd31521c4a06b15c25d3345a6194',
'891e31d0b649ec9fa98ca5745f9dcd14a34de34c',
'crashpad/third_party/libfuzzer/src':
Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' +
'fda403cf93ecb8792cb1d061564d89a6553ca020',

View File

@ -674,7 +674,7 @@ TEST_F(CrashReportDatabaseTest, RequestUpload) {
}
TEST_F(CrashReportDatabaseTest, Attachments) {
#if defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_APPLE) || defined(OS_WIN)
// Attachments aren't supported on Mac and Windows yet.
GTEST_SKIP();
#else
@ -720,7 +720,7 @@ TEST_F(CrashReportDatabaseTest, Attachments) {
}
TEST_F(CrashReportDatabaseTest, OrphanedAttachments) {
#if defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_APPLE) || defined(OS_WIN)
// Attachments aren't supported on Mac and Windows yet.
GTEST_SKIP();
#else
@ -770,7 +770,7 @@ TEST_F(CrashReportDatabaseTest, OrphanedAttachments) {
// This test uses knowledge of the database format to break it, so it only
// applies to the unfified database implementation.
#if !defined(OS_MACOSX) && !defined(OS_WIN)
#if !defined(OS_APPLE) && !defined(OS_WIN)
TEST_F(CrashReportDatabaseTest, CleanBrokenDatabase) {
// Remove report files if metadata goes missing.
CrashReportDatabase::Report report;
@ -836,7 +836,7 @@ TEST_F(CrashReportDatabaseTest, CleanBrokenDatabase) {
EXPECT_FALSE(PathExists(report.file_path));
EXPECT_FALSE(PathExists(metadata3));
}
#endif // !OS_MACOSX && !OS_WIN
#endif // !OS_APPLE && !OS_WIN
TEST_F(CrashReportDatabaseTest, TotalSize_MainReportOnly) {
std::unique_ptr<CrashReportDatabase::NewReport> new_report;
@ -860,7 +860,7 @@ TEST_F(CrashReportDatabaseTest, TotalSize_MainReportOnly) {
}
TEST_F(CrashReportDatabaseTest, GetReportSize_RightSizeWithAttachments) {
#if defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_APPLE) || defined(OS_WIN)
// Attachments aren't supported on Mac and Windows yet.
return;
#else

View File

@ -28,7 +28,7 @@
#include "util/file/file_io.h"
#include "util/misc/capture_context.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include "base/mac/scoped_mach_port.h"
#elif defined(OS_WIN)
#include <windows.h>
@ -473,7 +473,7 @@ class CrashpadClient {
static void DumpWithoutCrash(NativeCPUContext* context);
#endif
#if defined(OS_MACOSX) || DOXYGEN
#if defined(OS_APPLE) || DOXYGEN
//! \brief Sets the process crash handler to a Mach service registered with
//! the bootstrap server.
//!
@ -623,7 +623,7 @@ class CrashpadClient {
};
#endif
#if defined(OS_MACOSX) || DOXYGEN
#if defined(OS_APPLE) || DOXYGEN
//! \brief Configures the process to direct its crashes to the default handler
//! for the operating system.
//!
@ -657,14 +657,14 @@ class CrashpadClient {
#endif
private:
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
base::mac::ScopedMachSendRight exception_port_;
#elif defined(OS_WIN)
std::wstring ipc_pipe_;
ScopedKernelHANDLE handler_start_thread_;
#elif defined(OS_LINUX) || defined(OS_ANDROID)
std::set<int> unhandled_signals_;
#endif // OS_MACOSX
#endif // OS_APPLE
DISALLOW_COPY_AND_ASSIGN(CrashpadClient);
};

View File

@ -19,7 +19,7 @@
#include "util/misc/address_sanitizer.h"
#include "util/misc/from_pointer_cast.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include <mach-o/loader.h>
#endif
@ -55,7 +55,7 @@ static_assert(std::is_standard_layout<CrashpadInfo>::value,
#if defined(OS_POSIX)
__attribute__((
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
// Put the structure in a well-known section name where it can be easily
// found without having to consult the symbol table.
section(SEG_DATA ",crashpad_info"),

View File

@ -17,7 +17,7 @@
#include "build/build_config.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include "client/simulate_crash_mac.h"
#elif defined(OS_WIN)
#include "client/simulate_crash_win.h"

View File

@ -40,9 +40,9 @@
#include "util/net/url.h"
#include "util/stdlib/map_insert.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include "handler/mac/file_limit_annotation.h"
#endif // OS_MACOSX
#endif // OS_APPLE
namespace crashpad {
@ -136,9 +136,9 @@ void CrashReportUploadThread::ProcessPendingReports() {
void CrashReportUploadThread::ProcessPendingReport(
const CrashReportDatabase::Report& report) {
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
RecordFileLimitAnnotation();
#endif // OS_MACOSX
#endif // OS_APPLE
Settings* const settings = database_->GetSettings();

View File

@ -66,7 +66,7 @@
#include "handler/linux/crash_report_exception_handler.h"
#include "handler/linux/exception_handler_server.h"
#include "util/posix/signals.h"
#elif defined(OS_MACOSX)
#elif defined(OS_APPLE)
#include <libgen.h>
#include <signal.h>
@ -89,7 +89,7 @@
#elif defined(OS_LINUX)
#include "handler/linux/crash_report_exception_handler.h"
#include "handler/linux/exception_handler_server.h"
#endif // OS_MACOSX
#endif // OS_APPLE
namespace crashpad {
@ -106,9 +106,9 @@ void Usage(const base::FilePath& me) {
" at the time of the crash\n"
#endif // OS_WIN || OS_LINUX
" --database=PATH store the crash report database at PATH\n"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
" --handshake-fd=FD establish communication with the client over FD\n"
#endif // OS_MACOSX
#endif // OS_APPLE
#if defined(OS_WIN)
" --initial-client-data=HANDLE_request_crash_dump,\n"
" HANDLE_request_non_crash_dump,\n"
@ -123,9 +123,9 @@ void Usage(const base::FilePath& me) {
#if defined(OS_ANDROID) || defined(OS_LINUX)
" --initial-client-fd=FD a socket connected to a client.\n"
#endif // OS_ANDROID || OS_LINUX
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
" --mach-service=SERVICE register SERVICE with the bootstrap server\n"
#endif // OS_MACOSX
#endif // OS_APPLE
" --metrics-dir=DIR store metrics files in DIR (only in Chromium)\n"
" --monitor-self run a second handler to catch crashes in the first\n"
" --monitor-self-annotation=KEY=VALUE\n"
@ -145,10 +145,10 @@ void Usage(const base::FilePath& me) {
#if defined(OS_WIN)
" --pipe-name=PIPE communicate with the client over PIPE\n"
#endif // OS_WIN
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
" --reset-own-crash-exception-port-to-system-default\n"
" reset the server's exception handler to default\n"
#endif // OS_MACOSX
#endif // OS_APPLE
#if defined(OS_LINUX) || defined(OS_ANDROID)
" --sanitization-information=SANITIZATION_INFORMATION_ADDRESS\n"
" the address of a SanitizationInformation struct.\n"
@ -188,7 +188,7 @@ struct Options {
base::FilePath database;
base::FilePath metrics_dir;
std::vector<std::string> monitor_self_arguments;
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
std::string mach_service;
int handshake_fd;
bool reset_own_crash_exception_port_to_system_default;
@ -204,7 +204,7 @@ struct Options {
#elif defined(OS_WIN)
std::string pipe_name;
InitialClientData initial_client_data;
#endif // OS_MACOSX
#endif // OS_APPLE
bool identify_client_via_url;
bool monitor_self;
bool periodic_tasks;
@ -276,7 +276,7 @@ class CallMetricsRecordNormalExit {
DISALLOW_COPY_AND_ASSIGN(CallMetricsRecordNormalExit);
};
#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_ANDROID)
#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_ANDROID)
void HandleCrashSignal(int sig, siginfo_t* siginfo, void* context) {
MetricsRecordExit(Metrics::LifetimeMilestone::kCrashed);
@ -336,7 +336,7 @@ void InstallCrashHandler() {
Signals::InstallTerminateHandlers(HandleTerminateSignal, 0, nullptr);
}
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
struct ResetSIGTERMTraits {
static struct sigaction* InvalidValue() {
@ -362,7 +362,7 @@ void HandleSIGTERM(int sig, siginfo_t* siginfo, void* context) {
g_exception_handler_server->Stop();
}
#endif // OS_MACOSX
#endif // OS_APPLE
#elif defined(OS_WIN)
@ -419,7 +419,7 @@ void InstallCrashHandler() {
ALLOW_UNUSED_LOCAL(terminate_handler);
}
#endif // OS_MACOSX
#endif // OS_APPLE
void MonitorSelf(const Options& options) {
base::FilePath executable_path;
@ -529,18 +529,18 @@ int HandlerMain(int argc,
kOptionAttachment,
#endif // OS_WIN || OS_LINUX
kOptionDatabase,
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
kOptionHandshakeFD,
#endif // OS_MACOSX
#endif // OS_APPLE
#if defined(OS_WIN)
kOptionInitialClientData,
#endif // OS_WIN
#if defined(OS_ANDROID) || defined(OS_LINUX)
kOptionInitialClientFD,
#endif // OS_ANDROID || OS_LINUX
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
kOptionMachService,
#endif // OS_MACOSX
#endif // OS_APPLE
kOptionMetrics,
kOptionMonitorSelf,
kOptionMonitorSelfAnnotation,
@ -555,9 +555,9 @@ int HandlerMain(int argc,
#if defined(OS_WIN)
kOptionPipeName,
#endif // OS_WIN
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
kOptionResetOwnCrashExceptionPortToSystemDefault,
#endif // OS_MACOSX
#endif // OS_APPLE
#if defined(OS_LINUX) || defined(OS_ANDROID)
kOptionSanitizationInformation,
kOptionSharedClientConnection,
@ -584,21 +584,21 @@ int HandlerMain(int argc,
{"attachment", required_argument, nullptr, kOptionAttachment},
#endif // OS_WIN || OS_LINUX
{"database", required_argument, nullptr, kOptionDatabase},
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
{"handshake-fd", required_argument, nullptr, kOptionHandshakeFD},
#endif // OS_MACOSX
#endif // OS_APPLE
#if defined(OS_WIN)
{"initial-client-data",
required_argument,
nullptr,
kOptionInitialClientData},
#endif // OS_MACOSX
#endif // OS_APPLE
#if defined(OS_ANDROID) || defined(OS_LINUX)
{"initial-client-fd", required_argument, nullptr, kOptionInitialClientFD},
#endif // OS_ANDROID || OS_LINUX
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
{"mach-service", required_argument, nullptr, kOptionMachService},
#endif // OS_MACOSX
#endif // OS_APPLE
{"metrics-dir", required_argument, nullptr, kOptionMetrics},
{"monitor-self", no_argument, nullptr, kOptionMonitorSelf},
{"monitor-self-annotation",
@ -625,12 +625,12 @@ int HandlerMain(int argc,
#if defined(OS_WIN)
{"pipe-name", required_argument, nullptr, kOptionPipeName},
#endif // OS_WIN
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
{"reset-own-crash-exception-port-to-system-default",
no_argument,
nullptr,
kOptionResetOwnCrashExceptionPortToSystemDefault},
#endif // OS_MACOSX
#endif // OS_APPLE
#if defined(OS_LINUX) || defined(OS_ANDROID)
{"sanitization-information",
required_argument,
@ -669,7 +669,7 @@ int HandlerMain(int argc,
};
Options options = {};
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
options.handshake_fd = -1;
#endif
options.identify_client_via_url = true;
@ -705,7 +705,7 @@ int HandlerMain(int argc,
ToolSupport::CommandLineArgumentToFilePathStringType(optarg));
break;
}
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
case kOptionHandshakeFD: {
if (!StringToNumber(optarg, &options.handshake_fd) ||
options.handshake_fd < 0) {
@ -719,7 +719,7 @@ int HandlerMain(int argc,
options.mach_service = optarg;
break;
}
#endif // OS_MACOSX
#endif // OS_APPLE
#if defined(OS_WIN)
case kOptionInitialClientData: {
if (!options.initial_client_data.InitializeFromString(optarg)) {
@ -788,12 +788,12 @@ int HandlerMain(int argc,
break;
}
#endif // OS_WIN
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
case kOptionResetOwnCrashExceptionPortToSystemDefault: {
options.reset_own_crash_exception_port_to_system_default = true;
break;
}
#endif // OS_MACOSX
#endif // OS_APPLE
#if defined(OS_LINUX) || defined(OS_ANDROID)
case kOptionSanitizationInformation: {
if (!StringToNumber(optarg,
@ -861,7 +861,7 @@ int HandlerMain(int argc,
argc -= optind;
argv += optind;
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
if (options.handshake_fd < 0 && options.mach_service.empty()) {
ToolSupport::UsageHint(me, "--handshake-fd or --mach-service is required");
return ExitFailure();
@ -910,7 +910,7 @@ int HandlerMain(int argc,
ExitFailure();
}
#endif // OS_ANDROID
#endif // OS_MACOSX
#endif // OS_APPLE
if (options.database.empty()) {
ToolSupport::UsageHint(me, "--database is required");
@ -922,11 +922,11 @@ int HandlerMain(int argc,
return ExitFailure();
}
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
if (options.reset_own_crash_exception_port_to_system_default) {
CrashpadClient::UseSystemDefaultHandler();
}
#endif // OS_MACOSX
#endif // OS_APPLE
if (options.monitor_self) {
MonitorSelf(options);
@ -1045,7 +1045,7 @@ int HandlerMain(int argc,
prune_thread.Get()->Start();
}
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
if (options.mach_service.empty()) {
// Dont do this when being run by launchd. See launchd.plist(5).
CloseStdinAndStdout();
@ -1100,7 +1100,7 @@ int HandlerMain(int argc,
}
#elif defined(OS_LINUX) || defined(OS_ANDROID)
ExceptionHandlerServer exception_handler_server;
#endif // OS_MACOSX
#endif // OS_APPLE
base::GlobalHistogramAllocator* histogram_allocator = nullptr;
if (!options.metrics_dir.empty()) {

View File

@ -30,7 +30,7 @@
#include "util/numeric/in_range_cast.h"
#include "util/numeric/safe_assignment.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include <AvailabilityMacros.h>
#elif defined(OS_ANDROID)
#include <android/api-level.h>
@ -66,7 +66,7 @@ std::string BuildString(const SystemSnapshot* system_snapshot) {
return machine_description;
}
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
// Converts the value of the MAC_OS_VERSION_MIN_REQUIRED or
// MAC_OS_X_VERSION_MAX_ALLOWED macro from <AvailabilityMacros.h> to a number
// identifying the minor macOS version that it represents. For example, with an
@ -100,7 +100,7 @@ std::string MinidumpMiscInfoDebugBuildString() {
// Caution: the minidump file format only has room for 39 UTF-16 code units
// plus a UTF-16 NUL terminator. Dont let strings get longer than this, or
// they will be truncated and a message will be logged.
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
static constexpr char kOS[] = "mac";
#elif defined(OS_ANDROID)
static constexpr char kOS[] = "android";
@ -136,7 +136,7 @@ std::string MinidumpMiscInfoDebugBuildString() {
PACKAGE_VERSION,
kOS);
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
debug_build_string += base::StringPrintf(
",%d,%d",
AvailabilityVersionToMacOSXMinorVersion(MAC_OS_X_VERSION_MIN_REQUIRED),

View File

@ -25,7 +25,7 @@
#include "test/scoped_module_handle.h"
#include "test/test_paths.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include <dlfcn.h>
#include "snapshot/mac/process_snapshot_mac.h"
#elif defined(OS_WIN)
@ -77,7 +77,7 @@ class ScopedUnsetCrashpadInfoOptions {
};
CrashpadInfoClientOptions SelfProcessSnapshotAndGetCrashpadOptions() {
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
ProcessSnapshotMac process_snapshot;
EXPECT_TRUE(process_snapshot.Initialize(mach_task_self()));
#elif defined(OS_WIN)
@ -89,7 +89,7 @@ CrashpadInfoClientOptions SelfProcessSnapshotAndGetCrashpadOptions() {
EXPECT_TRUE(process_snapshot.Initialize(*zx::process::self()));
#else
#error Port.
#endif // OS_MACOSX
#endif // OS_APPLE
CrashpadInfoClientOptions options;
process_snapshot.GetCrashpadOptions(&options);
@ -164,7 +164,7 @@ TEST(CrashpadInfoClientOptions, TwoModules) {
<< ErrorMessage();
#else
#error Port.
#endif // OS_MACOSX
#endif // OS_APPLE
// Get the function pointer from the module. This wraps GetCrashpadInfo(), but
// because it runs in the module, it returns the remote modules CrashpadInfo
@ -262,7 +262,7 @@ TEST_P(CrashpadInfoSizes_ClientOptions, DifferentlySizedStruct) {
<< ErrorMessage();
#else
#error Port.
#endif // OS_MACOSX
#endif // OS_APPLE
// Get the function pointer from the module.
CrashpadInfo* (*TestModule_GetCrashpadInfo)() =

View File

@ -16,11 +16,11 @@
#include "build/build_config.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include <mach-o/loader.h>
#elif defined(OS_WIN)
#include <windows.h>
#endif // OS_MACOSX
#endif // OS_APPLE
namespace crashpad {
@ -67,7 +67,7 @@ struct TestCrashpadInfo {
// of the point of this test).
#if defined(OS_POSIX)
__attribute__((
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
section(SEG_DATA ",crashpad_info"),
#endif
#if defined(ADDRESS_SANITIZER)

View File

@ -121,7 +121,7 @@ bool PathExists(const base::FilePath& path) {
bool SetFileModificationTime(const base::FilePath& path,
const timespec& mtime) {
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
// utimensat() isn't available on macOS until 10.13, so lutimes() is used
// instead.
struct stat st;
@ -173,7 +173,7 @@ bool SetFileModificationTime(const base::FilePath& path,
return false;
}
return true;
#endif // OS_MACOSX
#endif // OS_APPLE
}
#if !defined(OS_FUCHSIA)

View File

@ -19,13 +19,13 @@
#include "build/build_config.h"
#include "gtest/gtest.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include "test/mac/exception_swallower.h"
#endif
//! \file
#if (defined(OS_MACOSX) && !defined(OS_IOS)) || DOXYGEN
#if defined(OS_MAC) || DOXYGEN
//! \brief Wraps the Google Test `ASSERT_DEATH_IF_SUPPORTED()` macro to make
//! assertions about death caused by crashes.
@ -73,14 +73,14 @@
regex); \
} while (false)
#else // OS_MACOSX && !OS_IOS
#else // OS_MAC
#define ASSERT_DEATH_CRASH(statement, regex) \
ASSERT_DEATH_IF_SUPPORTED(statement, regex)
#define EXPECT_DEATH_CRASH(statement, regex) \
EXPECT_DEATH_IF_SUPPORTED(statement, regex)
#endif // OS_MACOSX && !OS_IOS
#endif // OS_MAC
#if !(!defined(MINI_CHROMIUM_BASE_LOGGING_H_) && \
defined(OFFICIAL_BUILD) && \

View File

@ -30,7 +30,7 @@
#include <stdio_ext.h>
#endif
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include "util/mach/task_for_pid.h"
#endif
@ -154,7 +154,7 @@ void MultiprocessExec::MultiprocessChild() {
}
ProcessType MultiprocessExec::ChildProcess() {
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
return TaskForPID(ChildPID());
#else
return ChildPID();

View File

@ -33,7 +33,7 @@
#include "util/misc/scoped_forbid_return.h"
#include "util/posix/signals.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include "test/mac/exception_swallower.h"
#endif
@ -73,7 +73,7 @@ void Multiprocess::Run() {
ASSERT_NO_FATAL_FAILURE(PreFork());
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
// If the child is expected to crash, set up an exception swallower to swallow
// the exception instead of allowing it to be seen by the systems crash
// reporter.
@ -81,7 +81,7 @@ void Multiprocess::Run() {
if (reason_ == kTerminationSignal && Signals::IsCrashSignal(code_)) {
exception_swallower.reset(new ExceptionSwallower());
}
#endif // OS_MACOSX
#endif // OS_APPLE
pid_t pid = fork();
ASSERT_GE(pid, 0) << ErrnoMessage("fork");
@ -139,7 +139,7 @@ void Multiprocess::Run() {
ADD_FAILURE() << message;
}
} else {
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
if (exception_swallower.get()) {
ExceptionSwallower::SwallowExceptions();
}
@ -147,7 +147,7 @@ void Multiprocess::Run() {
if (reason_ == kTerminationSignal && Signals::IsCrashSignal(code_)) {
Signals::InstallDefaultHandler(code_);
}
#endif // OS_MACOSX
#endif // OS_APPLE
RunChild();
}

View File

@ -30,7 +30,7 @@ ProcessType GetSelfProcess() {
return getpid();
#elif defined(OS_WIN)
return GetCurrentProcess();
#elif defined(OS_MACOSX)
#elif defined(OS_APPLE)
return mach_task_self();
#endif
}

View File

@ -23,7 +23,7 @@
#include <sys/types.h>
#elif defined(OS_WIN)
#include <windows.h>
#elif defined(OS_MACOSX)
#elif defined(OS_APPLE)
#include <mach/mach.h>
#endif
@ -37,7 +37,7 @@ using ProcessType = zx::unowned_process;
using ProcessType = pid_t;
#elif defined(OS_WIN)
using ProcessType = HANDLE;
#elif defined(OS_MACOSX)
#elif defined(OS_APPLE)
using ProcessType = task_t;
#else
#error Port.

View File

@ -35,7 +35,7 @@
#include "util/posix/drop_privileges.h"
#endif
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include <mach/mach.h>
#include "base/mac/scoped_mach_port.h"
@ -49,7 +49,7 @@
#include "util/win/xp_compat.h"
#elif defined(OS_LINUX) || defined(OS_ANDROID)
#include "snapshot/linux/process_snapshot_linux.h"
#endif // OS_MACOSX
#endif // OS_APPLE
namespace crashpad {
namespace {
@ -136,7 +136,7 @@ int GenerateDumpMain(int argc, char* argv[]) {
return EXIT_FAILURE;
}
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
task_t task = TaskForPID(options.pid);
if (task == TASK_NULL) {
return EXIT_FAILURE;
@ -161,7 +161,7 @@ int GenerateDumpMain(int argc, char* argv[]) {
PLOG(ERROR) << "could not open process " << options.pid;
return EXIT_FAILURE;
}
#endif // OS_MACOSX
#endif // OS_APPLE
if (options.dump_path.empty()) {
options.dump_path = base::StringPrintf("minidump.%" PRI_PROCESS_ID,
@ -169,7 +169,7 @@ int GenerateDumpMain(int argc, char* argv[]) {
}
{
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
std::unique_ptr<ScopedTaskSuspend> suspend;
if (options.suspend) {
suspend.reset(new ScopedTaskSuspend(task));
@ -179,9 +179,9 @@ int GenerateDumpMain(int argc, char* argv[]) {
if (options.suspend) {
suspend.reset(new ScopedProcessSuspend(process.get()));
}
#endif // OS_MACOSX
#endif // OS_APPLE
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
ProcessSnapshotMac process_snapshot;
if (!process_snapshot.Initialize(task)) {
return EXIT_FAILURE;
@ -202,7 +202,7 @@ int GenerateDumpMain(int argc, char* argv[]) {
if (!process_snapshot.Initialize(nullptr)) {
return EXIT_FAILURE;
}
#endif // OS_MACOSX
#endif // OS_APPLE
FileWriter file_writer;
base::FilePath dump_path(

View File

@ -32,7 +32,7 @@ bool FileModificationTime(const base::FilePath& path, timespec* mtime) {
return false;
}
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
*mtime = st.st_mtimespec;
#elif defined(OS_ANDROID)
// This is needed to compile with traditional NDK headers.

View File

@ -28,7 +28,7 @@ namespace test {
namespace {
bool CurrentTime(timespec* now) {
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
timeval now_tv;
int res = gettimeofday(&now_tv, nullptr);
if (res != 0) {

View File

@ -21,7 +21,7 @@
#include "build/build_config.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include <mach/mach_types.h>
#elif defined(OS_WIN)
#include "util/win/address_types.h"
@ -45,7 +45,7 @@ using VMAddress = uint64_t;
//! VMAddress), potentially across bitness.
using VMSize = uint64_t;
#elif defined(OS_MACOSX)
#elif defined(OS_APPLE)
using VMAddress = mach_vm_address_t;
using VMSize = mach_vm_size_t;

View File

@ -17,7 +17,7 @@
#include "build/build_config.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include <mach/mach.h>
#elif defined(OS_WIN)
#include <windows.h>
@ -25,11 +25,11 @@
#include <ucontext.h>
#elif defined(OS_FUCHSIA)
#include <signal.h>
#endif // OS_MACOSX
#endif // OS_APPLE
namespace crashpad {
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#if defined(ARCH_CPU_X86_FAMILY)
using NativeCPUContext = x86_thread_state;
#elif defined(ARCH_CPU_ARM64)
@ -39,7 +39,7 @@ using NativeCPUContext = arm_unified_thread_state;
using NativeCPUContext = CONTEXT;
#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA)
using NativeCPUContext = ucontext_t;
#endif // OS_MACOSX
#endif // OS_APPLE
//! \brief Saves the CPU context.
//!

View File

@ -30,7 +30,7 @@ constexpr uint64_t kNanosecondsPerSecond = 1E9;
namespace crashpad {
#if !defined(OS_MACOSX)
#if !defined(OS_APPLE)
uint64_t ClockMonotonicNanoseconds() {
timespec now;

View File

@ -19,7 +19,7 @@
#include "base/numerics/safe_conversions.h"
#include "build/build_config.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#define METRICS_OS_NAME "Mac"
#elif defined(OS_WIN)
#define METRICS_OS_NAME "Win"

View File

@ -30,9 +30,9 @@
#include "base/strings/utf_string_conversions.h"
#include "base/sys_byteorder.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include <uuid/uuid.h>
#endif // OS_MACOSX
#endif // OS_APPLE
namespace crashpad {
@ -88,7 +88,7 @@ bool UUID::InitializeFromString(const base::StringPiece16& string) {
}
bool UUID::InitializeWithNew() {
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
uuid_t uuid;
uuid_generate(uuid);
InitializeFromBytes(uuid);
@ -109,7 +109,7 @@ bool UUID::InitializeWithNew() {
return true;
#else
#error Port.
#endif // OS_MACOSX
#endif // OS_APPLE
}
#if defined(OS_WIN)

View File

@ -18,7 +18,7 @@
#include "base/format_macros.h"
#include "base/strings/stringprintf.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include <mach/mach.h>
#elif defined(OS_WIN)
#include "util/win/address_types.h"
@ -26,7 +26,7 @@
#include "util/linux/address_types.h"
#elif defined(OS_FUCHSIA)
#include <zircon/types.h>
#endif // OS_MACOSX
#endif // OS_APPLE
namespace crashpad {
namespace internal {
@ -126,7 +126,7 @@ std::string CheckedAddressRangeGeneric<ValueType, SizeType>::AsString() const {
}
// Explicit instantiations for the cases we use.
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
template class CheckedAddressRangeGeneric<mach_vm_address_t, mach_vm_size_t>;
#elif defined(OS_WIN)
template class CheckedAddressRangeGeneric<WinVMAddress, WinVMSize>;
@ -134,7 +134,7 @@ template class CheckedAddressRangeGeneric<WinVMAddress, WinVMSize>;
template class CheckedAddressRangeGeneric<LinuxVMAddress, LinuxVMSize>;
#elif defined(OS_FUCHSIA)
template class CheckedAddressRangeGeneric<zx_vaddr_t, size_t>;
#endif // OS_MACOSX
#endif // OS_APPLE
} // namespace internal
} // namespace crashpad

View File

@ -31,7 +31,7 @@
#include "util/file/directory_reader.h"
#include "util/misc/implicit_cast.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include <sys/sysctl.h>
#endif
@ -51,7 +51,7 @@ namespace {
void CloseNowOrOnExec(int fd, bool ebadf_ok) {
int rv;
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
// Try to set close-on-exec, to avoid attempting to close a guarded FD with
// a close guard set.
rv = fcntl(fd, F_SETFD, FD_CLOEXEC);
@ -72,7 +72,7 @@ void CloseNowOrOnExec(int fd, bool ebadf_ok) {
// This is an advantage over looping over all possible file descriptors, because
// no attempt needs to be made to close file descriptors that are not open.
bool CloseMultipleNowOrOnExecUsingFDDir(int min_fd, int preserve_fd) {
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
static constexpr char kFDDir[] = "/dev/fd";
#elif defined(OS_LINUX) || defined(OS_ANDROID)
static constexpr char kFDDir[] = "/proc/self/fd";
@ -146,7 +146,7 @@ void CloseMultipleNowOrOnExec(int fd, int preserve_fd) {
// while the system is running, but its still a better upper bound than the
// current RLIMIT_NOFILE value.
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
// See 10.11.6 xnu-3248.60.10/bsd/kern/kern_resource.c maxfilesperproc,
// referenced by dosetrlimit().
int oid[] = {CTL_KERN, KERN_MAXFILESPERPROC};

View File

@ -25,7 +25,7 @@ void DropPrivileges() {
gid_t gid = getgid();
uid_t uid = getuid();
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
// Based on the POSIX.1-2008 2013 edition documentation for setreuid() and
// setregid(), setreuid() and setregid() alone should be sufficient to drop
// privileges. The standard specifies that the saved ID should be set to the

View File

@ -28,7 +28,7 @@
#include "util/misc/initialization_state.h"
#include "util/misc/initialization_state_dcheck.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include <mach/mach.h>
#include <sys/sysctl.h>
#endif
@ -61,7 +61,7 @@ class ProcessInfo {
bool InitializeWithPtrace(PtraceConnection* connection);
#endif // OS_LINUX || OS_ANDROID || DOXYGEN
#if defined(OS_MACOSX) || DOXYGEN
#if defined(OS_APPLE) || DOXYGEN
//! \brief Initializes this object with information about the process whose ID
//! is \a pid.
//!
@ -166,7 +166,7 @@ class ProcessInfo {
bool Arguments(std::vector<std::string>* argv) const;
private:
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
kinfo_proc kern_proc_info_;
#elif defined(OS_LINUX) || defined(OS_ANDROID)
// Some members are marked mutable so that they can be lazily initialized by

View File

@ -172,7 +172,7 @@ TEST(ProcessInfo, Self) {
TestSelfProcess(process_info);
}
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
TEST(ProcessInfo, SelfTask) {
ProcessInfo process_info;
ASSERT_TRUE(process_info.InitializeWithTask(mach_task_self()));

View File

@ -82,10 +82,10 @@ constexpr int kTerminateSignals[] = {
#if defined(SIGSTKFLT)
SIGSTKFLT,
#endif // defined(SIGSTKFLT)
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
SIGXCPU,
SIGXFSZ,
#endif // defined(OS_MACOSX)
#endif // defined(OS_APPLE)
#if defined(OS_LINUX)
SIGIO,
#endif // defined(OS_LINUX)

View File

@ -54,9 +54,9 @@ bool CanCauseSignal(int sig) {
#endif // defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL
sig == SIGPIPE ||
sig == SIGSEGV ||
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
sig == SIGSYS ||
#endif // OS_MACOSX
#endif // OS_APPLE
#if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM64)
sig == SIGTRAP ||
#endif // defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM64)
@ -177,7 +177,7 @@ void CauseSignal(int sig) {
break;
}
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
case SIGSYS: {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@ -189,7 +189,7 @@ void CauseSignal(int sig) {
}
break;
}
#endif // OS_MACOSX
#endif // OS_APPLE
#if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM64)
case SIGTRAP: {
@ -465,7 +465,7 @@ TEST(Signals, Raise_HandlerReraisesToDefault) {
continue;
}
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
if (sig == SIGBUS) {
// Signal handlers cant distinguish between SIGBUS arising out of a
// hardware fault and SIGBUS raised asynchronously.
@ -474,7 +474,7 @@ TEST(Signals, Raise_HandlerReraisesToDefault) {
// re-raise test must be skipped.
continue;
}
#endif // defined(OS_MACOSX)
#endif // defined(OS_APPLE)
SignalsTest test(SignalsTest::TestType::kHandlerReraisesToDefault,
SignalsTest::SignalSource::kRaise,
@ -492,7 +492,7 @@ TEST(Signals, Raise_HandlerReraisesToPrevious) {
continue;
}
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
if (sig == SIGBUS) {
// Signal handlers cant distinguish between SIGBUS arising out of a
// hardware fault and SIGBUS raised asynchronously.
@ -501,7 +501,7 @@ TEST(Signals, Raise_HandlerReraisesToPrevious) {
// re-raise test must be skipped.
continue;
}
#endif // defined(OS_MACOSX)
#endif // defined(OS_APPLE)
SignalsTest test(SignalsTest::TestType::kHandlerReraisesToPrevious,
SignalsTest::SignalSource::kRaise,

View File

@ -29,7 +29,7 @@ namespace {
constexpr const char* kSignalNames[] = {
nullptr,
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
// sed -Ene 's/^#define[[:space:]]SIG([[:alnum:]]+)[[:space:]]+[[:digit:]]{1,2}([[:space:]]|$).*/ "\1",/p'
// /usr/include/sys/signal.h
// and fix up by removing the entry for SIGPOLL.

View File

@ -63,7 +63,7 @@ constexpr struct {
{SIGVTALRM, "SIGVTALRM", "VTALRM"},
{SIGWINCH, "SIGWINCH", "WINCH"},
{SIGXCPU, "SIGXCPU", "XCPU"},
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
{SIGEMT, "SIGEMT", "EMT"},
{SIGINFO, "SIGINFO", "INFO"},
#elif defined(OS_LINUX) || defined(OS_ANDROID)

View File

@ -20,7 +20,7 @@
#include "util/process/process_memory_linux.h"
#elif defined(OS_WIN)
#include "util/process/process_memory_win.h"
#elif defined(OS_MACOSX)
#elif defined(OS_APPLE)
#include "util/process/process_memory_mac.h"
#endif
@ -33,7 +33,7 @@ using ProcessMemoryNative = ProcessMemoryFuchsia;
using ProcessMemoryNative = ProcessMemoryLinux;
#elif defined(OS_WIN)
using ProcessMemoryNative = ProcessMemoryWin;
#elif defined(OS_MACOSX)
#elif defined(OS_APPLE)
using ProcessMemoryNative = ProcessMemoryMac;
#else
#error Port.

View File

@ -30,9 +30,9 @@
#include "util/misc/from_pointer_cast.h"
#include "util/process/process_memory_native.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include "test/mac/mach_multiprocess.h"
#endif // defined(OS_MACOSX)
#endif // defined(OS_APPLE)
namespace crashpad {
namespace test {
@ -42,7 +42,7 @@ namespace {
// port which requires root or a code signing entitlement. To account for this
// we implement an adaptor class that wraps MachMultiprocess on macOS, because
// it shares the child's task port, and makes it behave like MultiprocessExec.
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
class MultiprocessAdaptor : public MachMultiprocess {
public:
void SetChildTestMainFunction(const std::string& function_name) {
@ -97,7 +97,7 @@ class MultiprocessAdaptor : public MultiprocessExec {
void MultiprocessParent() override { Parent(); }
};
#endif // defined(OS_MACOSX)
#endif // defined(OS_APPLE)
void DoChildReadTestSetup(size_t* region_size,
std::unique_ptr<char[]>* region) {

View File

@ -14,8 +14,7 @@
#include "util/stdlib/strnlen.h"
#if defined(OS_MACOSX) && !defined(OS_IOS) && \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
#if defined(OS_MAC) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
// Redeclare a method only available on Mac OS X 10.7 and later to suppress a

View File

@ -20,7 +20,7 @@
#include "build/build_config.h"
#if defined(OS_MACOSX) && !defined(OS_IOS)
#if defined(OS_MAC)
#include <AvailabilityMacros.h>
#endif
@ -38,8 +38,7 @@ namespace crashpad {
//! and not all systems standard libraries provide an implementation.
size_t strnlen(const char* string, size_t max_length);
#if !defined(OS_MACOSX) || defined(OS_IOS) || \
MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
#if !defined(OS_MAC) || MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
inline size_t strnlen(const char* string, size_t max_length) {
return ::strnlen(string, max_length);
}

View File

@ -19,7 +19,7 @@
#include "build/build_config.h"
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
#include <dispatch/dispatch.h>
#elif defined(OS_WIN)
#include <windows.h>
@ -76,7 +76,7 @@ class Semaphore {
void Signal();
private:
#if defined(OS_MACOSX)
#if defined(OS_APPLE)
dispatch_semaphore_t semaphore_;
#elif defined(OS_WIN)
HANDLE semaphore_;

View File

@ -63,7 +63,7 @@ void Semaphore::Signal() {
cv_.notify_one();
}
#elif !defined(OS_MACOSX)
#elif !defined(OS_APPLE)
Semaphore::Semaphore(int value) {
PCHECK(sem_init(&semaphore_, 0, value) == 0) << "sem_init";