diff --git a/DEPS b/DEPS index 65492e2f..36405724 100644 --- a/DEPS +++ b/DEPS @@ -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', diff --git a/client/crash_report_database_test.cc b/client/crash_report_database_test.cc index 20512a45..6796de68 100644 --- a/client/crash_report_database_test.cc +++ b/client/crash_report_database_test.cc @@ -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 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 diff --git a/client/crashpad_client.h b/client/crashpad_client.h index 62941ddf..36589727 100644 --- a/client/crashpad_client.h +++ b/client/crashpad_client.h @@ -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 @@ -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 unhandled_signals_; -#endif // OS_MACOSX +#endif // OS_APPLE DISALLOW_COPY_AND_ASSIGN(CrashpadClient); }; diff --git a/client/crashpad_info.cc b/client/crashpad_info.cc index 7c1316e8..12307be5 100644 --- a/client/crashpad_info.cc +++ b/client/crashpad_info.cc @@ -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 #endif @@ -55,7 +55,7 @@ static_assert(std::is_standard_layout::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"), diff --git a/client/simulate_crash.h b/client/simulate_crash.h index 63e09a17..68c84e58 100644 --- a/client/simulate_crash.h +++ b/client/simulate_crash.h @@ -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" diff --git a/handler/crash_report_upload_thread.cc b/handler/crash_report_upload_thread.cc index fd48e1b6..1e5f1237 100644 --- a/handler/crash_report_upload_thread.cc +++ b/handler/crash_report_upload_thread.cc @@ -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(); diff --git a/handler/handler_main.cc b/handler/handler_main.cc index df70203d..2c9bfbc9 100644 --- a/handler/handler_main.cc +++ b/handler/handler_main.cc @@ -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 #include @@ -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 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()) { // Don’t 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()) { diff --git a/minidump/minidump_misc_info_writer.cc b/minidump/minidump_misc_info_writer.cc index a1340760..d2d85115 100644 --- a/minidump/minidump_misc_info_writer.cc +++ b/minidump/minidump_misc_info_writer.cc @@ -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 #elif defined(OS_ANDROID) #include @@ -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 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. Don’t 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), diff --git a/snapshot/crashpad_info_client_options_test.cc b/snapshot/crashpad_info_client_options_test.cc index 1c5759eb..7604cedc 100644 --- a/snapshot/crashpad_info_client_options_test.cc +++ b/snapshot/crashpad_info_client_options_test.cc @@ -25,7 +25,7 @@ #include "test/scoped_module_handle.h" #include "test/test_paths.h" -#if defined(OS_MACOSX) +#if defined(OS_APPLE) #include #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 module’s 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)() = diff --git a/snapshot/crashpad_info_size_test_module.cc b/snapshot/crashpad_info_size_test_module.cc index 53f4a3ff..584f83b0 100644 --- a/snapshot/crashpad_info_size_test_module.cc +++ b/snapshot/crashpad_info_size_test_module.cc @@ -16,11 +16,11 @@ #include "build/build_config.h" -#if defined(OS_MACOSX) +#if defined(OS_APPLE) #include #elif defined(OS_WIN) #include -#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) diff --git a/test/filesystem.cc b/test/filesystem.cc index c1a912d3..1d86e70e 100644 --- a/test/filesystem.cc +++ b/test/filesystem.cc @@ -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) diff --git a/test/gtest_death.h b/test/gtest_death.h index 3b9d1f3b..c67d3345 100644 --- a/test/gtest_death.h +++ b/test/gtest_death.h @@ -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) && \ diff --git a/test/multiprocess_exec_posix.cc b/test/multiprocess_exec_posix.cc index 54893ef6..59aad829 100644 --- a/test/multiprocess_exec_posix.cc +++ b/test/multiprocess_exec_posix.cc @@ -30,7 +30,7 @@ #include #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(); diff --git a/test/multiprocess_posix.cc b/test/multiprocess_posix.cc index 984def66..782d5ba9 100644 --- a/test/multiprocess_posix.cc +++ b/test/multiprocess_posix.cc @@ -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 system’s 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(); } diff --git a/test/process_type.cc b/test/process_type.cc index 94fd912d..ac0b865e 100644 --- a/test/process_type.cc +++ b/test/process_type.cc @@ -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 } diff --git a/test/process_type.h b/test/process_type.h index dc99687a..d14514e5 100644 --- a/test/process_type.h +++ b/test/process_type.h @@ -23,7 +23,7 @@ #include #elif defined(OS_WIN) #include -#elif defined(OS_MACOSX) +#elif defined(OS_APPLE) #include #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. diff --git a/tools/generate_dump.cc b/tools/generate_dump.cc index 2113a1ab..dd62cd7b 100644 --- a/tools/generate_dump.cc +++ b/tools/generate_dump.cc @@ -35,7 +35,7 @@ #include "util/posix/drop_privileges.h" #endif -#if defined(OS_MACOSX) +#if defined(OS_APPLE) #include #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 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( diff --git a/util/file/filesystem_posix.cc b/util/file/filesystem_posix.cc index bb51a9c1..60799eb4 100644 --- a/util/file/filesystem_posix.cc +++ b/util/file/filesystem_posix.cc @@ -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. diff --git a/util/file/filesystem_test.cc b/util/file/filesystem_test.cc index e1f66867..30cd0d12 100644 --- a/util/file/filesystem_test.cc +++ b/util/file/filesystem_test.cc @@ -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) { diff --git a/util/misc/address_types.h b/util/misc/address_types.h index 870938d3..b3c69c09 100644 --- a/util/misc/address_types.h +++ b/util/misc/address_types.h @@ -21,7 +21,7 @@ #include "build/build_config.h" -#if defined(OS_MACOSX) +#if defined(OS_APPLE) #include #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; diff --git a/util/misc/capture_context.h b/util/misc/capture_context.h index 3ff71184..eda4efac 100644 --- a/util/misc/capture_context.h +++ b/util/misc/capture_context.h @@ -17,7 +17,7 @@ #include "build/build_config.h" -#if defined(OS_MACOSX) +#if defined(OS_APPLE) #include #elif defined(OS_WIN) #include @@ -25,11 +25,11 @@ #include #elif defined(OS_FUCHSIA) #include -#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. //! diff --git a/util/misc/clock_posix.cc b/util/misc/clock_posix.cc index f0a24167..a9fe8e58 100644 --- a/util/misc/clock_posix.cc +++ b/util/misc/clock_posix.cc @@ -30,7 +30,7 @@ constexpr uint64_t kNanosecondsPerSecond = 1E9; namespace crashpad { -#if !defined(OS_MACOSX) +#if !defined(OS_APPLE) uint64_t ClockMonotonicNanoseconds() { timespec now; diff --git a/util/misc/metrics.cc b/util/misc/metrics.cc index bda90313..be75a720 100644 --- a/util/misc/metrics.cc +++ b/util/misc/metrics.cc @@ -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" diff --git a/util/misc/uuid.cc b/util/misc/uuid.cc index 5655bc2c..e444a07f 100644 --- a/util/misc/uuid.cc +++ b/util/misc/uuid.cc @@ -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 -#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) diff --git a/util/numeric/checked_address_range.cc b/util/numeric/checked_address_range.cc index c6c932d4..18d75685 100644 --- a/util/numeric/checked_address_range.cc +++ b/util/numeric/checked_address_range.cc @@ -18,7 +18,7 @@ #include "base/format_macros.h" #include "base/strings/stringprintf.h" -#if defined(OS_MACOSX) +#if defined(OS_APPLE) #include #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 -#endif // OS_MACOSX +#endif // OS_APPLE namespace crashpad { namespace internal { @@ -126,7 +126,7 @@ std::string CheckedAddressRangeGeneric::AsString() const { } // Explicit instantiations for the cases we use. -#if defined(OS_MACOSX) +#if defined(OS_APPLE) template class CheckedAddressRangeGeneric; #elif defined(OS_WIN) template class CheckedAddressRangeGeneric; @@ -134,7 +134,7 @@ template class CheckedAddressRangeGeneric; template class CheckedAddressRangeGeneric; #elif defined(OS_FUCHSIA) template class CheckedAddressRangeGeneric; -#endif // OS_MACOSX +#endif // OS_APPLE } // namespace internal } // namespace crashpad diff --git a/util/posix/close_multiple.cc b/util/posix/close_multiple.cc index 238f158c..4f24df1c 100644 --- a/util/posix/close_multiple.cc +++ b/util/posix/close_multiple.cc @@ -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 #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 it’s 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}; diff --git a/util/posix/drop_privileges.cc b/util/posix/drop_privileges.cc index 2dd2c214..7c1fe84e 100644 --- a/util/posix/drop_privileges.cc +++ b/util/posix/drop_privileges.cc @@ -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 diff --git a/util/posix/process_info.h b/util/posix/process_info.h index 7017cc64..439284fa 100644 --- a/util/posix/process_info.h +++ b/util/posix/process_info.h @@ -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 #include #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* 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 diff --git a/util/posix/process_info_test.cc b/util/posix/process_info_test.cc index 94bbb8e3..56ee356b 100644 --- a/util/posix/process_info_test.cc +++ b/util/posix/process_info_test.cc @@ -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())); diff --git a/util/posix/signals.cc b/util/posix/signals.cc index 7dbe10eb..252aff7e 100644 --- a/util/posix/signals.cc +++ b/util/posix/signals.cc @@ -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) diff --git a/util/posix/signals_test.cc b/util/posix/signals_test.cc index 58bfa8f8..6b960de1 100644 --- a/util/posix/signals_test.cc +++ b/util/posix/signals_test.cc @@ -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 can’t 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 can’t 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, diff --git a/util/posix/symbolic_constants_posix.cc b/util/posix/symbolic_constants_posix.cc index 5937c576..13bd7f96 100644 --- a/util/posix/symbolic_constants_posix.cc +++ b/util/posix/symbolic_constants_posix.cc @@ -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. diff --git a/util/posix/symbolic_constants_posix_test.cc b/util/posix/symbolic_constants_posix_test.cc index c7d62ee5..266b0571 100644 --- a/util/posix/symbolic_constants_posix_test.cc +++ b/util/posix/symbolic_constants_posix_test.cc @@ -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) diff --git a/util/process/process_memory_native.h b/util/process/process_memory_native.h index 39bfc893..e486c1c7 100644 --- a/util/process/process_memory_native.h +++ b/util/process/process_memory_native.h @@ -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. diff --git a/util/process/process_memory_test.cc b/util/process/process_memory_test.cc index 3f5db24f..3e3e0585 100644 --- a/util/process/process_memory_test.cc +++ b/util/process/process_memory_test.cc @@ -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* region) { diff --git a/util/stdlib/strnlen.cc b/util/stdlib/strnlen.cc index 7ef8d3b1..07b0db54 100644 --- a/util/stdlib/strnlen.cc +++ b/util/stdlib/strnlen.cc @@ -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 diff --git a/util/stdlib/strnlen.h b/util/stdlib/strnlen.h index 1db5f6e2..b88f2da2 100644 --- a/util/stdlib/strnlen.h +++ b/util/stdlib/strnlen.h @@ -20,7 +20,7 @@ #include "build/build_config.h" -#if defined(OS_MACOSX) && !defined(OS_IOS) +#if defined(OS_MAC) #include #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); } diff --git a/util/synchronization/semaphore.h b/util/synchronization/semaphore.h index dc3000b0..308b29b0 100644 --- a/util/synchronization/semaphore.h +++ b/util/synchronization/semaphore.h @@ -19,7 +19,7 @@ #include "build/build_config.h" -#if defined(OS_MACOSX) +#if defined(OS_APPLE) #include #elif defined(OS_WIN) #include @@ -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_; diff --git a/util/synchronization/semaphore_posix.cc b/util/synchronization/semaphore_posix.cc index ec5355d7..ebe62a4f 100644 --- a/util/synchronization/semaphore_posix.cc +++ b/util/synchronization/semaphore_posix.cc @@ -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";