From 6a9e2e6003096a33e4006290e570bbd3da59e5c6 Mon Sep 17 00:00:00 2001 From: Avi Drissman Date: Wed, 16 Aug 2023 16:30:40 -0400 Subject: [PATCH] Adjust to movement of base/ files to base/apple This CL rolls mini_chromium to pick up the move of a bunch of files to base/apple, and makes changes to adjust. Bug: chromium:1444927 Change-Id: Ib692e2a1628e2c0c8228795eaecdb7f35b1c09fa Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4786387 Reviewed-by: Mark Mentovai Commit-Queue: Avi Drissman --- DEPS | 2 +- client/crash_report_database_mac.mm | 4 +- client/crashpad_client.h | 8 ++-- client/crashpad_client_ios.cc | 6 +-- client/crashpad_client_mac.cc | 39 ++++++++++--------- client/simulate_crash_mac.cc | 6 +-- handler/handler_main.cc | 4 +- handler/mac/crash_report_exception_handler.cc | 8 ++-- handler/mac/exception_handler_server.cc | 8 ++-- handler/mac/exception_handler_server.h | 8 ++-- ...xception_snapshot_ios_intermediate_dump.cc | 2 +- .../module_snapshot_ios_intermediate_dump.cc | 2 +- .../system_snapshot_ios_intermediate_dump.cc | 2 +- .../thread_snapshot_ios_intermediate_dump.cc | 2 +- snapshot/mac/process_reader_mac.cc | 8 ++-- snapshot/mac/process_reader_mac_test.cc | 6 +-- test/ios/host/handler_forbidden_allocators.cc | 2 +- test/mac/exception_swallower.cc | 8 ++-- test/mac/mach_errors.h | 5 ++- test/mac/mach_multiprocess.cc | 8 ++-- tools/generate_dump.cc | 4 +- tools/mac/catch_exception_tool.cc | 6 +-- tools/mac/exception_port_tool.cc | 12 +++--- util/ios/ios_intermediate_dump_writer_test.cc | 6 +-- util/ios/ios_system_data_collector.mm | 2 +- util/ios/scoped_vm_map_test.cc | 6 +-- util/ios/scoped_vm_read_test.cc | 6 +-- util/mach/bootstrap.cc | 14 +++---- util/mach/bootstrap.h | 9 +++-- util/mach/bootstrap_test.cc | 17 ++++---- util/mach/child_port_handshake.cc | 11 +++--- util/mach/child_port_handshake.h | 6 +-- util/mach/child_port_handshake_test.cc | 10 ++--- util/mach/exception_ports.cc | 2 +- util/mach/exception_ports_test.cc | 12 +++--- util/mach/exception_types.cc | 2 +- util/mach/mach_extensions.cc | 2 +- util/mach/mach_extensions_test.cc | 11 +++--- util/mach/mach_message.cc | 2 +- util/mach/mach_message_server.cc | 6 +-- util/mach/mach_message_server_test.cc | 6 +-- util/mach/mach_message_test.cc | 7 ++-- util/mach/notify_server_test.cc | 38 +++++++++--------- util/mach/scoped_task_suspend.cc | 2 +- util/mach/task_for_pid.cc | 6 +-- util/misc/clock_mac.cc | 2 +- util/posix/process_info_mac.cc | 2 +- util/process/process_memory_mac.cc | 2 +- util/process/process_memory_mac.h | 4 +- util/process/process_memory_mac_test.cc | 12 +++--- 50 files changed, 186 insertions(+), 179 deletions(-) diff --git a/DEPS b/DEPS index 75180399..42037773 100644 --- a/DEPS +++ b/DEPS @@ -47,7 +47,7 @@ deps = { '9719c1e1e676814c456b55f5f070eabad6709d31', 'crashpad/third_party/mini_chromium/mini_chromium': Var('chromium_git') + '/chromium/mini_chromium@' + - 'a722d31ef5245c1859ee8317796bc29bc7b08069', + 'f5370228f40bbb8c453e17f6af6c6742858c45d1', 'crashpad/third_party/libfuzzer/src': Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' + 'fda403cf93ecb8792cb1d061564d89a6553ca020', diff --git a/client/crash_report_database_mac.mm b/client/crash_report_database_mac.mm index 7221b595..c8522623 100644 --- a/client/crash_report_database_mac.mm +++ b/client/crash_report_database_mac.mm @@ -30,8 +30,8 @@ #include #include +#include "base/apple/scoped_nsautorelease_pool.h" #include "base/logging.h" -#include "base/mac/scoped_nsautorelease_pool.h" #include "base/posix/eintr_wrapper.h" #include "base/scoped_generic.h" #include "base/strings/string_piece.h" @@ -813,7 +813,7 @@ bool CrashReportDatabaseMac::ReadReportMetadataLocked( CrashReportDatabase::OperationStatus CrashReportDatabaseMac::ReportsInDirectory( const base::FilePath& path, std::vector* reports) { - base::mac::ScopedNSAutoreleasePool pool; + base::apple::ScopedNSAutoreleasePool pool; DCHECK(reports->empty()); diff --git a/client/crashpad_client.h b/client/crashpad_client.h index 11fa66e2..24424414 100644 --- a/client/crashpad_client.h +++ b/client/crashpad_client.h @@ -33,7 +33,7 @@ #endif // !BUILDFLAG(IS_FUCHSIA) #if BUILDFLAG(IS_APPLE) -#include "base/mac/scoped_mach_port.h" +#include "base/apple/scoped_mach_port.h" #elif BUILDFLAG(IS_WIN) #include #include "util/win/scoped_handle.h" @@ -627,7 +627,7 @@ class CrashpadClient { //! Crashpad exception handler service. //! //! \return `true` on success, `false` on failure with a message logged. - bool SetHandlerMachPort(base::mac::ScopedMachSendRight exception_port); + bool SetHandlerMachPort(base::apple::ScopedMachSendRight exception_port); //! \brief Retrieves a send right to the process’ crash handler Mach port. //! @@ -648,7 +648,7 @@ class CrashpadClient { //! SetHandlerMachService(). This method must only be called after a //! successful call to one of those methods. `MACH_PORT_NULL` on failure //! with a message logged. - base::mac::ScopedMachSendRight GetHandlerMachPort() const; + base::apple::ScopedMachSendRight GetHandlerMachPort() const; #endif #if BUILDFLAG(IS_WIN) || DOXYGEN @@ -790,7 +790,7 @@ class CrashpadClient { private: #if BUILDFLAG(IS_APPLE) - base::mac::ScopedMachSendRight exception_port_; + base::apple::ScopedMachSendRight exception_port_; #elif BUILDFLAG(IS_WIN) std::wstring ipc_pipe_; ScopedKernelHANDLE handler_start_thread_; diff --git a/client/crashpad_client_ios.cc b/client/crashpad_client_ios.cc index 53adf8d4..a34cc15e 100644 --- a/client/crashpad_client_ios.cc +++ b/client/crashpad_client_ios.cc @@ -21,9 +21,9 @@ #include #include +#include "base/apple/mach_logging.h" +#include "base/apple/scoped_mach_port.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" -#include "base/mac/scoped_mach_port.h" #include "client/ios_handler/exception_processor.h" #include "client/ios_handler/in_process_handler.h" #include "util/ios/raw_logging.h" @@ -393,7 +393,7 @@ class CrashHandler : public Thread, Signals::RestoreHandlerAndReraiseSignalOnReturn(siginfo, old_action); } - base::mac::ScopedMachReceiveRight exception_port_; + base::apple::ScopedMachReceiveRight exception_port_; ExceptionPorts::ExceptionHandlerVector original_handlers_; struct sigaction old_action_ = {}; internal::InProcessHandler in_process_handler_; diff --git a/client/crashpad_client_mac.cc b/client/crashpad_client_mac.cc index c5fc708d..8b85ac73 100644 --- a/client/crashpad_client_mac.cc +++ b/client/crashpad_client_mac.cc @@ -24,8 +24,8 @@ #include #include +#include "base/apple/mach_logging.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" #include "base/strings/stringprintf.h" #include "util/mac/mac_util.h" #include "util/mach/bootstrap.h" @@ -122,7 +122,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface { //! //! \return On success, a send right to the Crashpad handler that has been //! started. On failure, `MACH_PORT_NULL` with a message logged. - static base::mac::ScopedMachSendRight InitialStart( + static base::apple::ScopedMachSendRight InitialStart( const base::FilePath& handler, const base::FilePath& database, const base::FilePath& metrics_dir, @@ -130,10 +130,10 @@ class HandlerStarter final : public NotifyServer::DefaultInterface { const std::map& annotations, const std::vector& arguments, bool restartable) { - base::mac::ScopedMachReceiveRight receive_right( + base::apple::ScopedMachReceiveRight receive_right( NewMachPort(MACH_PORT_RIGHT_RECEIVE)); if (!receive_right.is_valid()) { - return base::mac::ScopedMachSendRight(); + return base::apple::ScopedMachSendRight(); } mach_port_t port; @@ -145,9 +145,9 @@ class HandlerStarter final : public NotifyServer::DefaultInterface { &right_type); if (kr != KERN_SUCCESS) { MACH_LOG(ERROR, kr) << "mach_port_extract_right"; - return base::mac::ScopedMachSendRight(); + return base::apple::ScopedMachSendRight(); } - base::mac::ScopedMachSendRight send_right(port); + base::apple::ScopedMachSendRight send_right(port); DCHECK_EQ(port, receive_right.get()); DCHECK_EQ(right_type, implicit_cast(MACH_MSG_TYPE_PORT_SEND)); @@ -171,7 +171,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface { std::move(receive_right), handler_restarter.get(), false)) { - return base::mac::ScopedMachSendRight(); + return base::apple::ScopedMachSendRight(); } if (handler_restarter && @@ -211,7 +211,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface { url_, annotations_, arguments_, - base::mac::ScopedMachReceiveRight(rights), + base::apple::ScopedMachReceiveRight(rights), this, true); @@ -256,7 +256,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface { const std::string& url, const std::map& annotations, const std::vector& arguments, - base::mac::ScopedMachReceiveRight receive_right, + base::apple::ScopedMachReceiveRight receive_right, HandlerStarter* handler_restarter, bool restart) { DCHECK(!restart || handler_restarter); @@ -282,7 +282,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface { // port-destroyed notifications can be delivered. handler_restarter->notify_port_.reset(); } else { - base::mac::ScopedMachSendRight previous_owner(previous); + base::apple::ScopedMachSendRight previous_owner(previous); DCHECK(restart || !previous_owner.is_valid()); } @@ -430,7 +430,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface { std::string url_; std::map annotations_; std::vector arguments_; - base::mac::ScopedMachReceiveRight notify_port_; + base::apple::ScopedMachReceiveRight notify_port_; uint64_t last_start_time_; }; @@ -458,7 +458,7 @@ bool CrashpadClient::StartHandler( // The “restartable” behavior can only be selected on OS X 10.10 and later. In // previous OS versions, if the initial client were to crash while attempting // to restart the handler, it would become an unkillable process. - base::mac::ScopedMachSendRight exception_port(HandlerStarter::InitialStart( + base::apple::ScopedMachSendRight exception_port(HandlerStarter::InitialStart( handler, database, metrics_dir, @@ -476,7 +476,8 @@ bool CrashpadClient::StartHandler( } bool CrashpadClient::SetHandlerMachService(const std::string& service_name) { - base::mac::ScopedMachSendRight exception_port(BootstrapLookUp(service_name)); + base::apple::ScopedMachSendRight exception_port( + BootstrapLookUp(service_name)); if (!exception_port.is_valid()) { return false; } @@ -486,7 +487,7 @@ bool CrashpadClient::SetHandlerMachService(const std::string& service_name) { } bool CrashpadClient::SetHandlerMachPort( - base::mac::ScopedMachSendRight exception_port) { + base::apple::ScopedMachSendRight exception_port) { DCHECK(!exception_port_.is_valid()); DCHECK(exception_port.is_valid()); @@ -498,7 +499,7 @@ bool CrashpadClient::SetHandlerMachPort( return true; } -base::mac::ScopedMachSendRight CrashpadClient::GetHandlerMachPort() const { +base::apple::ScopedMachSendRight CrashpadClient::GetHandlerMachPort() const { DCHECK(exception_port_.is_valid()); // For the purposes of this method, only return a port set by @@ -519,16 +520,16 @@ base::mac::ScopedMachSendRight CrashpadClient::GetHandlerMachPort() const { mach_task_self(), exception_port_.get(), MACH_PORT_RIGHT_SEND, 1); if (kr != KERN_SUCCESS) { MACH_LOG(ERROR, kr) << "mach_port_mod_refs"; - return base::mac::ScopedMachSendRight(MACH_PORT_NULL); + return base::apple::ScopedMachSendRight(MACH_PORT_NULL); } - return base::mac::ScopedMachSendRight(exception_port_.get()); + return base::apple::ScopedMachSendRight(exception_port_.get()); } // static void CrashpadClient::UseSystemDefaultHandler() { - base::mac::ScopedMachSendRight - system_crash_reporter_handler(SystemCrashReporterHandler()); + base::apple::ScopedMachSendRight system_crash_reporter_handler( + SystemCrashReporterHandler()); // Proceed even if SystemCrashReporterHandler() failed, setting MACH_PORT_NULL // to clear the current exception ports. diff --git a/client/simulate_crash_mac.cc b/client/simulate_crash_mac.cc index d801a431..427d9d54 100644 --- a/client/simulate_crash_mac.cc +++ b/client/simulate_crash_mac.cc @@ -19,10 +19,10 @@ #include +#include "base/apple/mach_logging.h" +#include "base/apple/scoped_mach_port.h" #include "base/check_op.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" -#include "base/mac/scoped_mach_port.h" #include "build/build_config.h" #include "util/mach/exc_client_variants.h" #include "util/mach/exception_behaviors.h" @@ -205,7 +205,7 @@ void SimulateCrash(const NativeCPUContext& cpu_context) { #error Port to your CPU architecture #endif - base::mac::ScopedMachSendRight thread(mach_thread_self()); + base::apple::ScopedMachSendRight thread(mach_thread_self()); exception_type_t exception = kMachExceptionSimulated; mach_exception_data_type_t codes[] = {0, 0}; mach_msg_type_number_t code_count = std::size(codes); diff --git a/handler/handler_main.cc b/handler/handler_main.cc index b7ba6b14..7e908c0a 100644 --- a/handler/handler_main.cc +++ b/handler/handler_main.cc @@ -71,7 +71,7 @@ #include #include -#include "base/mac/scoped_mach_port.h" +#include "base/apple/scoped_mach_port.h" #include "handler/mac/crash_report_exception_handler.h" #include "handler/mac/exception_handler_server.h" #include "handler/mac/file_limit_annotation.h" @@ -1113,7 +1113,7 @@ int HandlerMain(int argc, CloseStdinAndStdout(); } - base::mac::ScopedMachReceiveRight receive_right; + base::apple::ScopedMachReceiveRight receive_right; if (options.handshake_fd >= 0) { receive_right.reset( diff --git a/handler/mac/crash_report_exception_handler.cc b/handler/mac/crash_report_exception_handler.cc index 01a7895e..28d5e2ab 100644 --- a/handler/mac/crash_report_exception_handler.cc +++ b/handler/mac/crash_report_exception_handler.cc @@ -17,9 +17,9 @@ #include #include +#include "base/apple/mach_logging.h" +#include "base/apple/scoped_mach_port.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" -#include "base/mac/scoped_mach_port.h" #include "base/strings/stringprintf.h" #include "client/settings.h" #include "handler/mac/file_limit_annotation.h" @@ -200,8 +200,8 @@ kern_return_t CrashReportExceptionHandler::CatchMachException( // processes that haven’t actually crashed, and could result in reports not // actually associated with crashes being sent to the operating system // vendor. - base::mac::ScopedMachSendRight - system_crash_reporter_handler(SystemCrashReporterHandler()); + base::apple::ScopedMachSendRight system_crash_reporter_handler( + SystemCrashReporterHandler()); if (system_crash_reporter_handler.get()) { // Make copies of mutable out parameters so that the system crash reporter // can’t influence the state returned by this method. diff --git a/handler/mac/exception_handler_server.cc b/handler/mac/exception_handler_server.cc index 0e7f505c..5357c8cd 100644 --- a/handler/mac/exception_handler_server.cc +++ b/handler/mac/exception_handler_server.cc @@ -16,8 +16,8 @@ #include +#include "base/apple/mach_logging.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" #include "util/mach/composite_mach_message_server.h" #include "util/mach/mach_extensions.h" #include "util/mach/mach_message.h" @@ -73,7 +73,7 @@ class ExceptionHandlerServerRun : public UniversalMachExcServer::Interface, MACH_MSG_TYPE_MAKE_SEND_ONCE, &previous); MACH_CHECK(kr == KERN_SUCCESS, kr) << "mach_port_request_notification"; - base::mac::ScopedMachSendRight previous_owner(previous); + base::apple::ScopedMachSendRight previous_owner(previous); } // A single CompositeMachMessageServer will dispatch both exception messages @@ -84,7 +84,7 @@ class ExceptionHandlerServerRun : public UniversalMachExcServer::Interface, // from ever existing. Using distinct receive rights also allows the handler // methods to ensure that the messages they process were sent by a holder of // the proper send right. - base::mac::ScopedMachPortSet server_port_set( + base::apple::ScopedMachPortSet server_port_set( NewMachPort(MACH_PORT_RIGHT_PORT_SET)); CHECK(server_port_set.is_valid()); @@ -192,7 +192,7 @@ class ExceptionHandlerServerRun : public UniversalMachExcServer::Interface, } // namespace ExceptionHandlerServer::ExceptionHandlerServer( - base::mac::ScopedMachReceiveRight receive_port, + base::apple::ScopedMachReceiveRight receive_port, bool launchd) : receive_port_(std::move(receive_port)), notify_port_(NewMachPort(MACH_PORT_RIGHT_RECEIVE)), diff --git a/handler/mac/exception_handler_server.h b/handler/mac/exception_handler_server.h index 085ebd8a..6d63a290 100644 --- a/handler/mac/exception_handler_server.h +++ b/handler/mac/exception_handler_server.h @@ -17,7 +17,7 @@ #include -#include "base/mac/scoped_mach_port.h" +#include "base/apple/scoped_mach_port.h" #include "util/mach/exc_server_variants.h" namespace crashpad { @@ -34,7 +34,7 @@ class ExceptionHandlerServer { //! launchd. \a receive_port is not monitored for no-senders //! notifications, and instead, Stop() must be called to provide a “quit” //! signal. - ExceptionHandlerServer(base::mac::ScopedMachReceiveRight receive_port, + ExceptionHandlerServer(base::apple::ScopedMachReceiveRight receive_port, bool launchd); ExceptionHandlerServer(const ExceptionHandlerServer&) = delete; @@ -73,8 +73,8 @@ class ExceptionHandlerServer { void Stop(); private: - base::mac::ScopedMachReceiveRight receive_port_; - base::mac::ScopedMachReceiveRight notify_port_; + base::apple::ScopedMachReceiveRight receive_port_; + base::apple::ScopedMachReceiveRight notify_port_; bool launchd_; }; diff --git a/snapshot/ios/exception_snapshot_ios_intermediate_dump.cc b/snapshot/ios/exception_snapshot_ios_intermediate_dump.cc index ede18d4c..cee9c8a7 100644 --- a/snapshot/ios/exception_snapshot_ios_intermediate_dump.cc +++ b/snapshot/ios/exception_snapshot_ios_intermediate_dump.cc @@ -14,8 +14,8 @@ #include "snapshot/ios/exception_snapshot_ios_intermediate_dump.h" +#include "base/apple/mach_logging.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" #include "snapshot/cpu_context.h" #include "snapshot/ios/intermediate_dump_reader_util.h" #include "snapshot/mac/cpu_context_mac.h" diff --git a/snapshot/ios/module_snapshot_ios_intermediate_dump.cc b/snapshot/ios/module_snapshot_ios_intermediate_dump.cc index 44c8c202..09498f14 100644 --- a/snapshot/ios/module_snapshot_ios_intermediate_dump.cc +++ b/snapshot/ios/module_snapshot_ios_intermediate_dump.cc @@ -17,8 +17,8 @@ #include #include +#include "base/apple/mach_logging.h" #include "base/files/file_path.h" -#include "base/mac/mach_logging.h" #include "client/annotation.h" #include "snapshot/ios/intermediate_dump_reader_util.h" #include "util/ios/ios_intermediate_dump_data.h" diff --git a/snapshot/ios/system_snapshot_ios_intermediate_dump.cc b/snapshot/ios/system_snapshot_ios_intermediate_dump.cc index be676857..15f66992 100644 --- a/snapshot/ios/system_snapshot_ios_intermediate_dump.cc +++ b/snapshot/ios/system_snapshot_ios_intermediate_dump.cc @@ -22,8 +22,8 @@ #include +#include "base/apple/mach_logging.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" #include "base/strings/stringprintf.h" #include "build/build_config.h" #include "snapshot/cpu_context.h" diff --git a/snapshot/ios/thread_snapshot_ios_intermediate_dump.cc b/snapshot/ios/thread_snapshot_ios_intermediate_dump.cc index 901e1f11..d37ccef3 100644 --- a/snapshot/ios/thread_snapshot_ios_intermediate_dump.cc +++ b/snapshot/ios/thread_snapshot_ios_intermediate_dump.cc @@ -14,7 +14,7 @@ #include "snapshot/ios/thread_snapshot_ios_intermediate_dump.h" -#include "base/mac/mach_logging.h" +#include "base/apple/mach_logging.h" #include "snapshot/ios/intermediate_dump_reader_util.h" #include "snapshot/mac/cpu_context_mac.h" #include "util/ios/ios_intermediate_dump_data.h" diff --git a/snapshot/mac/process_reader_mac.cc b/snapshot/mac/process_reader_mac.cc index c694eb0e..ebc3c970 100644 --- a/snapshot/mac/process_reader_mac.cc +++ b/snapshot/mac/process_reader_mac.cc @@ -21,10 +21,10 @@ #include #include +#include "base/apple/mach_logging.h" +#include "base/apple/scoped_mach_port.h" +#include "base/apple/scoped_mach_vm.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" -#include "base/mac/scoped_mach_port.h" -#include "base/mac/scoped_mach_vm.h" #include "base/strings/stringprintf.h" #include "snapshot/mac/mach_o_image_reader.h" #include "snapshot/mac/process_types.h" @@ -265,7 +265,7 @@ void ProcessReaderMac::InitializeThreads() { // loop below will leak thread port send rights. ScopedForbidReturn threads_need_owners; - base::mac::ScopedMachVM threads_vm( + base::apple::ScopedMachVM threads_vm( reinterpret_cast(threads), mach_vm_round_page(thread_count * sizeof(*threads))); diff --git a/snapshot/mac/process_reader_mac_test.cc b/snapshot/mac/process_reader_mac_test.cc index 14cf33d3..e2cb0b0a 100644 --- a/snapshot/mac/process_reader_mac_test.cc +++ b/snapshot/mac/process_reader_mac_test.cc @@ -30,9 +30,9 @@ #include #include +#include "base/apple/mach_logging.h" #include "base/check_op.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" #include "base/posix/eintr_wrapper.h" #include "base/strings/stringprintf.h" #include "build/build_config.h" @@ -361,7 +361,7 @@ void ExpectSeveralThreads(ThreadMap* thread_map, // Non-main threads use the stack region to store thread data. See // macOS 12 libpthread-486.100.11 src/pthread.c _pthread_allocate(). #if defined(ARCH_CPU_ARM64) - // arm64 has an additional offset for alignment. See macOS 12 + // arm64 has an additional offset for alignment. See macOS 12 // libpthread-486.100.11 src/pthread.c _pthread_allocate() and // PTHREAD_T_OFFSET (defined in src/types_internal.h). expected_stack_region_end += sizeof(_opaque_pthread_t) + 0x3000; @@ -864,7 +864,7 @@ TEST(ProcessReaderMac, SelfModules) { bool expect_timestamp; if (index == 0 && MacOSVersionNumber() < 12'00'00) { - // Pre-dyld4, dyld didn’t set the main executable's timestamp, and it was + // Pre-dyld4, dyld didn’t set the main executable's timestamp, and it was // reported as 0. EXPECT_EQ(modules[index].timestamp, 0); } else if (IsMalformedCLKernelsModule(modules[index].reader->FileType(), diff --git a/test/ios/host/handler_forbidden_allocators.cc b/test/ios/host/handler_forbidden_allocators.cc index 5ede632c..4e829f0b 100644 --- a/test/ios/host/handler_forbidden_allocators.cc +++ b/test/ios/host/handler_forbidden_allocators.cc @@ -19,7 +19,7 @@ #include #include -#include "base/mac/mach_logging.h" +#include "base/apple/mach_logging.h" #include "client/crashpad_client.h" #include "util/ios/raw_logging.h" diff --git a/test/mac/exception_swallower.cc b/test/mac/exception_swallower.cc index 52c2a2d6..132fb428 100644 --- a/test/mac/exception_swallower.cc +++ b/test/mac/exception_swallower.cc @@ -20,8 +20,8 @@ #include +#include "base/apple/scoped_mach_port.h" #include "base/check_op.h" -#include "base/mac/scoped_mach_port.h" #include "base/strings/stringprintf.h" #include "handler/mac/exception_handler_server.h" #include "util/mach/bootstrap.h" @@ -58,7 +58,7 @@ class ExceptionSwallower::ExceptionSwallowerThread public UniversalMachExcServer::Interface { public: explicit ExceptionSwallowerThread( - base::mac::ScopedMachReceiveRight receive_right) + base::apple::ScopedMachReceiveRight receive_right) : Thread(), UniversalMachExcServer::Interface(), exception_handler_server_(std::move(receive_right), true), @@ -129,7 +129,7 @@ ExceptionSwallower::ExceptionSwallower() : exception_swallower_thread_() { base::StringPrintf("org.chromium.crashpad.test.exception_swallower.%d.%s", getpid(), RandomString().c_str()); - base::mac::ScopedMachReceiveRight receive_right( + base::apple::ScopedMachReceiveRight receive_right( BootstrapCheckIn(service_name)); CHECK(receive_right.is_valid()); @@ -164,7 +164,7 @@ void ExceptionSwallower::SwallowExceptions() { const char* service_name = CheckedGetenv(kServiceEnvironmentVariable); CHECK(service_name); - base::mac::ScopedMachSendRight exception_swallower_port( + base::apple::ScopedMachSendRight exception_swallower_port( BootstrapLookUp(service_name)); CHECK(exception_swallower_port.is_valid()); diff --git a/test/mac/mach_errors.h b/test/mac/mach_errors.h index ba3191b0..862d717c 100644 --- a/test/mac/mach_errors.h +++ b/test/mac/mach_errors.h @@ -23,8 +23,9 @@ namespace crashpad { namespace test { // This function formats messages in a similar way to the Mach error logging -// macros in base/mac/mach_logging.h. It exists to interoperate with Google Test -// assertions, which don’t interoperate with logging but can be streamed to. +// macros in base/apple/mach_logging.h. It exists to interoperate with Google +// Test assertions, which don’t interoperate with logging but can be streamed +// to. // // Where non-test code could do: // MACH_CHECK(kr == KERN_SUCCESS, kr) << "vm_deallocate"; diff --git a/test/mac/mach_multiprocess.cc b/test/mac/mach_multiprocess.cc index 6af870e8..d317055f 100644 --- a/test/mac/mach_multiprocess.cc +++ b/test/mac/mach_multiprocess.cc @@ -21,8 +21,8 @@ #include #include +#include "base/apple/scoped_mach_port.h" #include "base/auto_reset.h" -#include "base/mac/scoped_mach_port.h" #include "gtest/gtest.h" #include "test/errors.h" #include "test/mac/mach_errors.h" @@ -64,9 +64,9 @@ struct MachMultiprocessInfo { } std::string service_name; - base::mac::ScopedMachReceiveRight local_port; - base::mac::ScopedMachSendRight remote_port; - base::mac::ScopedMachSendRight child_task; // valid only in parent + base::apple::ScopedMachReceiveRight local_port; + base::apple::ScopedMachSendRight remote_port; + base::apple::ScopedMachSendRight child_task; // valid only in parent }; } // namespace internal diff --git a/tools/generate_dump.cc b/tools/generate_dump.cc index f0aad1ba..75e0e535 100644 --- a/tools/generate_dump.cc +++ b/tools/generate_dump.cc @@ -38,7 +38,7 @@ #if BUILDFLAG(IS_APPLE) #include -#include "base/mac/scoped_mach_port.h" +#include "base/apple/scoped_mach_port.h" #include "snapshot/mac/process_snapshot_mac.h" #include "util/mach/scoped_task_suspend.h" #include "util/mach/task_for_pid.h" @@ -144,7 +144,7 @@ int GenerateDumpMain(int argc, char* argv[]) { if (task == TASK_NULL) { return EXIT_FAILURE; } - base::mac::ScopedMachSendRight task_owner(task); + base::apple::ScopedMachSendRight task_owner(task); // This tool may have been installed as a setuid binary so that TaskForPID() // could succeed. Drop any privileges now that they’re no longer necessary. diff --git a/tools/mac/catch_exception_tool.cc b/tools/mac/catch_exception_tool.cc index 8d71a337..3f226597 100644 --- a/tools/mac/catch_exception_tool.cc +++ b/tools/mac/catch_exception_tool.cc @@ -24,9 +24,9 @@ #include #include +#include "base/apple/mach_logging.h" #include "base/files/scoped_file.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" #include "tools/tool_support.h" #include "util/mach/bootstrap.h" #include "util/mach/exc_server_variants.h" @@ -267,8 +267,8 @@ int CatchExceptionToolMain(int argc, char* argv[]) { return EXIT_FAILURE; } - base::mac::ScopedMachReceiveRight - service_port(BootstrapCheckIn(options.mach_service)); + base::apple::ScopedMachReceiveRight service_port( + BootstrapCheckIn(options.mach_service)); if (service_port == kMachPortNull) { return EXIT_FAILURE; } diff --git a/tools/mac/exception_port_tool.cc b/tools/mac/exception_port_tool.cc index 0c0a2aa8..437c15f4 100644 --- a/tools/mac/exception_port_tool.cc +++ b/tools/mac/exception_port_tool.cc @@ -25,8 +25,8 @@ #include #include -#include "base/mac/mach_logging.h" -#include "base/mac/scoped_mach_port.h" +#include "base/apple/mach_logging.h" +#include "base/apple/scoped_mach_port.h" #include "tools/tool_support.h" #include "util/mach/bootstrap.h" #include "util/mach/exception_ports.h" @@ -43,7 +43,7 @@ namespace { //! destruction. //! //! This class effectively implements what a vector of -//! base::mac::ScopedMachSendRight objects would be. +//! base::apple::ScopedMachSendRight objects would be. //! //! The various “show” operations performed by this program display Mach ports //! by their names as they are known in this task. For this to be useful, rights @@ -191,7 +191,7 @@ bool ParseHandlerString(const char* handler_string_ro, // |mach_send_right_pool|. void ShowBootstrapService(const std::string& service_name, MachSendRightPool* mach_send_right_pool) { - base::mac::ScopedMachSendRight service_port(BootstrapLookUp(service_name)); + base::apple::ScopedMachSendRight service_port(BootstrapLookUp(service_name)); if (service_port == kMachPortNull) { return; } @@ -283,7 +283,7 @@ void ShowExceptionPorts(const ExceptionPorts& exception_ports, // desired. bool SetExceptionPort(const ExceptionHandlerDescription* description, mach_port_t target_port) { - base::mac::ScopedMachSendRight service_port; + base::apple::ScopedMachSendRight service_port; if (description->handler.compare( 0, strlen(kHandlerBootstrapColon), kHandlerBootstrapColon) == 0) { const char* service_name = @@ -490,7 +490,7 @@ int ExceptionPortToolMain(int argc, char* argv[]) { return kExitFailure; } - base::mac::ScopedMachSendRight alternate_task_owner; + base::apple::ScopedMachSendRight alternate_task_owner; if (options.pid) { if (argc) { ToolSupport::UsageHint(me, "cannot combine -p with COMMAND"); diff --git a/util/ios/ios_intermediate_dump_writer_test.cc b/util/ios/ios_intermediate_dump_writer_test.cc index d1eb583e..2bf2b780 100644 --- a/util/ios/ios_intermediate_dump_writer_test.cc +++ b/util/ios/ios_intermediate_dump_writer_test.cc @@ -17,8 +17,8 @@ #include #include +#include "base/apple/scoped_mach_vm.h" #include "base/files/scoped_file.h" -#include "base/mac/scoped_mach_vm.h" #include "base/posix/eintr_wrapper.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -141,8 +141,8 @@ TEST_F(IOSIntermediateDumpWriterTest, MissingPropertyString) { region_size, VM_FLAGS_ANYWHERE), 0); - base::mac::ScopedMachVM vm_owner(reinterpret_cast(region), - region_size); + base::apple::ScopedMachVM vm_owner(reinterpret_cast(region), + region_size); // Fill first page with 'A' and second with 'B'. memset(region, 'A', page_size); diff --git a/util/ios/ios_system_data_collector.mm b/util/ios/ios_system_data_collector.mm index 564c8e79..28ede182 100644 --- a/util/ios/ios_system_data_collector.mm +++ b/util/ios/ios_system_data_collector.mm @@ -21,7 +21,7 @@ #include #import -#include "base/mac/mach_logging.h" +#include "base/apple/mach_logging.h" #include "base/numerics/safe_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" diff --git a/util/ios/scoped_vm_map_test.cc b/util/ios/scoped_vm_map_test.cc index e88568a7..6a6b3ebc 100644 --- a/util/ios/scoped_vm_map_test.cc +++ b/util/ios/scoped_vm_map_test.cc @@ -16,7 +16,7 @@ #include -#include "base/mac/scoped_mach_vm.h" +#include "base/apple/scoped_mach_vm.h" #include "gtest/gtest.h" #include "test/mac/mach_errors.h" @@ -73,8 +73,8 @@ TEST(ScopedVMMapTest, MissingMiddleVM) { VM_FLAGS_ANYWHERE); ASSERT_EQ(kr, KERN_SUCCESS) << MachErrorMessage(kr, "vm_allocate"); - base::mac::ScopedMachVM vm_owner(reinterpret_cast(region), - region_size); + base::apple::ScopedMachVM vm_owner(reinterpret_cast(region), + region_size); internal::ScopedVMMap vmmap_missing_middle; ASSERT_TRUE(vmmap_missing_middle.Map(region, region_size)); diff --git a/util/ios/scoped_vm_read_test.cc b/util/ios/scoped_vm_read_test.cc index c8b2e758..29e5c232 100644 --- a/util/ios/scoped_vm_read_test.cc +++ b/util/ios/scoped_vm_read_test.cc @@ -16,7 +16,7 @@ #include -#include "base/mac/scoped_mach_vm.h" +#include "base/apple/scoped_mach_vm.h" #include "gtest/gtest.h" #include "test/mac/mach_errors.h" @@ -68,8 +68,8 @@ TEST(ScopedVMReadTest, MissingMiddleVM) { VM_FLAGS_ANYWHERE); ASSERT_EQ(kr, KERN_SUCCESS) << MachErrorMessage(kr, "vm_allocate"); - base::mac::ScopedMachVM vm_owner(reinterpret_cast(region), - region_size); + base::apple::ScopedMachVM vm_owner(reinterpret_cast(region), + region_size); internal::ScopedVMRead vmread_missing_middle; ASSERT_TRUE(vmread_missing_middle.Read(region, region_size)); diff --git a/util/mach/bootstrap.cc b/util/mach/bootstrap.cc index be2769b2..f369f7f3 100644 --- a/util/mach/bootstrap.cc +++ b/util/mach/bootstrap.cc @@ -17,7 +17,7 @@ #include #include -#include "base/mac/mach_logging.h" +#include "base/apple/mach_logging.h" namespace { @@ -26,7 +26,7 @@ namespace { // and the right type returned. struct BootstrapCheckInTraits { - using Type = base::mac::ScopedMachReceiveRight; + using Type = base::apple::ScopedMachReceiveRight; static kern_return_t Call(mach_port_t bootstrap_port, const char* service_name, mach_port_t* service_port) { @@ -37,7 +37,7 @@ struct BootstrapCheckInTraits { constexpr char BootstrapCheckInTraits::kName[]; struct BootstrapLookUpTraits { - using Type = base::mac::ScopedMachSendRight; + using Type = base::apple::ScopedMachSendRight; static kern_return_t Call(mach_port_t bootstrap_port, const char* service_name, mach_port_t* service_port) { @@ -73,14 +73,14 @@ typename Traits::Type BootstrapCheckInOrLookUp( namespace crashpad { -base::mac::ScopedMachReceiveRight BootstrapCheckIn( +base::apple::ScopedMachReceiveRight BootstrapCheckIn( const std::string& service_name) { return BootstrapCheckInOrLookUp(service_name); } -base::mac::ScopedMachSendRight BootstrapLookUp( +base::apple::ScopedMachSendRight BootstrapLookUp( const std::string& service_name) { - base::mac::ScopedMachSendRight send( + base::apple::ScopedMachSendRight send( BootstrapCheckInOrLookUp(service_name)); // It’s possible to race the bootstrap server when the receive right @@ -102,7 +102,7 @@ base::mac::ScopedMachSendRight BootstrapLookUp( return send; } -base::mac::ScopedMachSendRight SystemCrashReporterHandler() { +base::apple::ScopedMachSendRight SystemCrashReporterHandler() { return BootstrapLookUp("com.apple.ReportCrash"); } diff --git a/util/mach/bootstrap.h b/util/mach/bootstrap.h index 362627eb..35004c32 100644 --- a/util/mach/bootstrap.h +++ b/util/mach/bootstrap.h @@ -17,7 +17,7 @@ #include -#include "base/mac/scoped_mach_port.h" +#include "base/apple/scoped_mach_port.h" namespace crashpad { @@ -30,7 +30,7 @@ namespace crashpad { //! //! \return On success, a receive right to the service port. On failure, //! `MACH_PORT_NULL` with a message logged. -base::mac::ScopedMachReceiveRight BootstrapCheckIn( +base::apple::ScopedMachReceiveRight BootstrapCheckIn( const std::string& service_name); //! \brief Makes a `boostrap_look_up()` call to the process’ bootstrap server. @@ -42,7 +42,8 @@ base::mac::ScopedMachReceiveRight BootstrapCheckIn( //! //! \return On success, a send right to the service port. On failure, //! `MACH_PORT_NULL` with a message logged. -base::mac::ScopedMachSendRight BootstrapLookUp(const std::string& service_name); +base::apple::ScopedMachSendRight BootstrapLookUp( + const std::string& service_name); //! \brief Obtains the system’s default Mach exception handler for crash-type //! exceptions. @@ -56,7 +57,7 @@ base::mac::ScopedMachSendRight BootstrapLookUp(const std::string& service_name); //! \return On success, a send right to an `exception_handler_t` corresponding //! to the system’s default crash reporter. On failure, `MACH_PORT_NULL`, //! with a message logged. -base::mac::ScopedMachSendRight SystemCrashReporterHandler(); +base::apple::ScopedMachSendRight SystemCrashReporterHandler(); } // namespace crashpad diff --git a/util/mach/bootstrap_test.cc b/util/mach/bootstrap_test.cc index a4089bf1..196f5949 100644 --- a/util/mach/bootstrap_test.cc +++ b/util/mach/bootstrap_test.cc @@ -14,7 +14,7 @@ #include "util/mach/bootstrap.h" -#include "base/mac/scoped_mach_port.h" +#include "base/apple/scoped_mach_port.h" #include "gtest/gtest.h" #include "util/mach/mach_extensions.h" #include "util/misc/random_string.h" @@ -25,7 +25,7 @@ namespace { TEST(Bootstrap, BootstrapCheckInAndLookUp) { // This should always exist. - base::mac::ScopedMachSendRight report_crash( + base::apple::ScopedMachSendRight report_crash( BootstrapLookUp("com.apple.ReportCrash")); EXPECT_NE(report_crash, kMachPortNull); @@ -34,11 +34,11 @@ TEST(Bootstrap, BootstrapCheckInAndLookUp) { { // The new service hasn’t checked in yet, so this should fail. - base::mac::ScopedMachSendRight send(BootstrapLookUp(service_name)); + base::apple::ScopedMachSendRight send(BootstrapLookUp(service_name)); EXPECT_EQ(send, kMachPortNull); // Check it in. - base::mac::ScopedMachReceiveRight receive(BootstrapCheckIn(service_name)); + base::apple::ScopedMachReceiveRight receive(BootstrapCheckIn(service_name)); EXPECT_NE(receive, kMachPortNull); // Now it should be possible to look up the new service. @@ -46,21 +46,22 @@ TEST(Bootstrap, BootstrapCheckInAndLookUp) { EXPECT_NE(send, kMachPortNull); // It shouldn’t be possible to check the service in while it’s active. - base::mac::ScopedMachReceiveRight receive_2(BootstrapCheckIn(service_name)); + base::apple::ScopedMachReceiveRight receive_2( + BootstrapCheckIn(service_name)); EXPECT_EQ(receive_2, kMachPortNull); } // The new service should be gone now. - base::mac::ScopedMachSendRight send(BootstrapLookUp(service_name)); + base::apple::ScopedMachSendRight send(BootstrapLookUp(service_name)); EXPECT_EQ(send, kMachPortNull); // It should be possible to check it in again. - base::mac::ScopedMachReceiveRight receive(BootstrapCheckIn(service_name)); + base::apple::ScopedMachReceiveRight receive(BootstrapCheckIn(service_name)); EXPECT_NE(receive, kMachPortNull); } TEST(Bootstrap, SystemCrashReporterHandler) { - base::mac::ScopedMachSendRight system_crash_reporter_handler( + base::apple::ScopedMachSendRight system_crash_reporter_handler( SystemCrashReporterHandler()); EXPECT_TRUE(system_crash_reporter_handler.is_valid()); } diff --git a/util/mach/child_port_handshake.cc b/util/mach/child_port_handshake.cc index 6277a144..afbf55f1 100644 --- a/util/mach/child_port_handshake.cc +++ b/util/mach/child_port_handshake.cc @@ -27,10 +27,10 @@ #include #include +#include "base/apple/mach_logging.h" +#include "base/apple/scoped_mach_port.h" #include "base/check_op.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" -#include "base/mac/scoped_mach_port.h" #include "base/notreached.h" #include "base/posix/eintr_wrapper.h" #include "base/rand_util.h" @@ -113,7 +113,8 @@ mach_port_t ChildPortHandshakeServer::RunServer( // Check the new service in with the bootstrap server, obtaining a receive // right for it. - base::mac::ScopedMachReceiveRight server_port(BootstrapCheckIn(service_name)); + base::apple::ScopedMachReceiveRight server_port( + BootstrapCheckIn(service_name)); CHECK(server_port.is_valid()); // Share the service name with the client via the pipe. @@ -137,7 +138,7 @@ mach_port_t ChildPortHandshakeServer::RunServer( // MACH_PORT_RIGHT_PORT_SET, to 10.12.0 xnu-3789.1.32/osfmk/ipc/ipc_pset.c // filt_machportattach(), which also handles MACH_PORT_TYPE_RECEIVE. Create a // new port set and add the receive right to it. - base::mac::ScopedMachPortSet server_port_set( + base::apple::ScopedMachPortSet server_port_set( NewMachPort(MACH_PORT_RIGHT_PORT_SET)); CHECK(server_port_set.is_valid()); @@ -442,7 +443,7 @@ bool ChildPortHandshake::RunClientInternal_SendCheckIn( mach_msg_type_name_t right_type) { // Get a send right to the server by looking up the service with the bootstrap // server by name. - base::mac::ScopedMachSendRight server_port(BootstrapLookUp(service_name)); + base::apple::ScopedMachSendRight server_port(BootstrapLookUp(service_name)); if (server_port == kMachPortNull) { return false; } diff --git a/util/mach/child_port_handshake.h b/util/mach/child_port_handshake.h index 77a17714..9a0b8e10 100644 --- a/util/mach/child_port_handshake.h +++ b/util/mach/child_port_handshake.h @@ -107,7 +107,7 @@ class ChildPortHandshakeTest; //! server_write_fd.reset(); //! //! // Make a new Mach receive right. -//! base::mac::ScopedMachReceiveRight +//! base::apple::ScopedMachReceiveRight //! receive_right(NewMachPort(MACH_PORT_RIGHT_RECEIVE)); //! //! // Make a send right corresponding to the receive right. @@ -118,7 +118,7 @@ class ChildPortHandshakeTest; //! MACH_MSG_TYPE_MAKE_SEND, //! &send_right, //! &send_right_type); -//! base::mac::ScopedMachSendRight send_right_owner(send_right); +//! base::apple::ScopedMachSendRight send_right_owner(send_right); //! //! // Send the receive right to the child process, retaining the send right //! // for use in the parent process. @@ -136,7 +136,7 @@ class ChildPortHandshakeTest; //! base::ScopedFD server_write_fd(atoi(argv[1])); //! //! // Obtain a receive right from the parent process. -//! base::mac::ScopedMachReceiveRight receive_right( +//! base::apple::ScopedMachReceiveRight receive_right( //! ChildPortHandshake::RunServerForFD( //! std::move(server_write_fd), //! ChildPortHandshake::PortRightType::kReceiveRight)); diff --git a/util/mach/child_port_handshake_test.cc b/util/mach/child_port_handshake_test.cc index fc85f559..e8fe91b7 100644 --- a/util/mach/child_port_handshake_test.cc +++ b/util/mach/child_port_handshake_test.cc @@ -14,7 +14,7 @@ #include "util/mach/child_port_handshake.h" -#include "base/mac/scoped_mach_port.h" +#include "base/apple/scoped_mach_port.h" #include "gtest/gtest.h" #include "test/multiprocess.h" #include "util/mach/child_port_types.h" @@ -99,8 +99,8 @@ class ChildPortHandshakeTest : public Multiprocess { return; } - base::mac::ScopedMachReceiveRight receive_right; - base::mac::ScopedMachSendRight send_right; + base::apple::ScopedMachReceiveRight receive_right; + base::apple::ScopedMachSendRight send_right; if (test_type_ == TestType::kClientChecksIn_ReceiveRight) { receive_right.reset(child_port_handshake_.RunServer( ChildPortHandshake::PortRightType::kReceiveRight)); @@ -152,7 +152,7 @@ class ChildPortHandshakeTest : public Multiprocess { } case TestType::kClientChecksIn_SendOnceRight: { - base::mac::ScopedMachReceiveRight receive_right( + base::apple::ScopedMachReceiveRight receive_right( NewMachPort(MACH_PORT_RIGHT_RECEIVE)); ASSERT_TRUE(child_port_handshake_.RunClient( receive_right.get(), MACH_MSG_TYPE_MAKE_SEND_ONCE)); @@ -372,7 +372,7 @@ TEST(ChildPortHandshake, NoClient) { // is similar to kClientDoesNotCheckIn, but because there’s no client at all, // the server is guaranteed to see that its pipe partner is gone. ChildPortHandshake child_port_handshake; - base::mac::ScopedMachSendRight child_port(child_port_handshake.RunServer( + base::apple::ScopedMachSendRight child_port(child_port_handshake.RunServer( ChildPortHandshake::PortRightType::kSendRight)); EXPECT_FALSE(child_port.is_valid()); } diff --git a/util/mach/exception_ports.cc b/util/mach/exception_ports.cc index 1184045c..b983cc6c 100644 --- a/util/mach/exception_ports.cc +++ b/util/mach/exception_ports.cc @@ -14,8 +14,8 @@ #include "util/mach/exception_ports.h" +#include "base/apple/mach_logging.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" #include "base/notreached.h" namespace crashpad { diff --git a/util/mach/exception_ports_test.cc b/util/mach/exception_ports_test.cc index f6a88672..b37a99a2 100644 --- a/util/mach/exception_ports_test.cc +++ b/util/mach/exception_ports_test.cc @@ -19,9 +19,9 @@ #include #include +#include "base/apple/mach_logging.h" +#include "base/apple/scoped_mach_port.h" #include "base/check.h" -#include "base/mac/mach_logging.h" -#include "base/mac/scoped_mach_port.h" #include "base/notreached.h" #include "build/build_config.h" #include "gtest/gtest.h" @@ -444,8 +444,8 @@ class TestExceptionPorts : public MachMultiprocess, ScopedForbidReturn threads_need_owners; ASSERT_EQ(thread_count, 2u); - base::mac::ScopedMachSendRight main_thread(threads[0]); - base::mac::ScopedMachSendRight other_thread(threads[1]); + base::apple::ScopedMachSendRight main_thread(threads[0]); + base::apple::ScopedMachSendRight other_thread(threads[1]); threads_need_owners.Disarm(); ExceptionPorts main_thread_ports(ExceptionPorts::kTargetTypeThread, @@ -467,7 +467,7 @@ class TestExceptionPorts : public MachMultiprocess, mach_task_self(), local_port, local_port, MACH_MSG_TYPE_MAKE_SEND); ASSERT_EQ(kr, KERN_SUCCESS) << MachErrorMessage(kr, "mach_port_insert_right"); - base::mac::ScopedMachSendRight send_owner(local_port); + base::apple::ScopedMachSendRight send_owner(local_port); switch (set_or_swap_) { case kSetExceptionPort: { @@ -819,7 +819,7 @@ TEST(ExceptionPorts, HostExceptionPorts) { const bool expect_success = geteuid() == 0; - base::mac::ScopedMachSendRight host(mach_host_self()); + base::apple::ScopedMachSendRight host(mach_host_self()); ExceptionPorts explicit_host_ports(ExceptionPorts::kTargetTypeHost, host.get()); EXPECT_STREQ("host", explicit_host_ports.TargetTypeName()); diff --git a/util/mach/exception_types.cc b/util/mach/exception_types.cc index c050b285..e73b7c8b 100644 --- a/util/mach/exception_types.cc +++ b/util/mach/exception_types.cc @@ -21,9 +21,9 @@ #include #include +#include "base/apple/mach_logging.h" #include "base/check_op.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" #include "util/mac/mac_util.h" #include "util/mach/mach_extensions.h" #include "util/misc/no_cfi_icall.h" diff --git a/util/mach/mach_extensions.cc b/util/mach/mach_extensions.cc index 885d6074..463d364a 100644 --- a/util/mach/mach_extensions.cc +++ b/util/mach/mach_extensions.cc @@ -17,7 +17,7 @@ #include #include -#include "base/mac/mach_logging.h" +#include "base/apple/mach_logging.h" #include "build/build_config.h" #include "util/mac/mac_util.h" diff --git a/util/mach/mach_extensions_test.cc b/util/mach/mach_extensions_test.cc index 0314b698..31042f7c 100644 --- a/util/mach/mach_extensions_test.cc +++ b/util/mach/mach_extensions_test.cc @@ -14,7 +14,7 @@ #include "util/mach/mach_extensions.h" -#include "base/mac/scoped_mach_port.h" +#include "base/apple/scoped_mach_port.h" #include "build/build_config.h" #include "gtest/gtest.h" #include "test/mac/mach_errors.h" @@ -25,12 +25,13 @@ namespace test { namespace { TEST(MachExtensions, MachThreadSelf) { - base::mac::ScopedMachSendRight thread_self(mach_thread_self()); + base::apple::ScopedMachSendRight thread_self(mach_thread_self()); EXPECT_EQ(MachThreadSelf(), thread_self); } TEST(MachExtensions, NewMachPort_Receive) { - base::mac::ScopedMachReceiveRight port(NewMachPort(MACH_PORT_RIGHT_RECEIVE)); + base::apple::ScopedMachReceiveRight port( + NewMachPort(MACH_PORT_RIGHT_RECEIVE)); ASSERT_NE(port, kMachPortNull); mach_port_type_t type; @@ -41,7 +42,7 @@ TEST(MachExtensions, NewMachPort_Receive) { } TEST(MachExtensions, NewMachPort_PortSet) { - base::mac::ScopedMachPortSet port(NewMachPort(MACH_PORT_RIGHT_PORT_SET)); + base::apple::ScopedMachPortSet port(NewMachPort(MACH_PORT_RIGHT_PORT_SET)); ASSERT_NE(port, kMachPortNull); mach_port_type_t type; @@ -52,7 +53,7 @@ TEST(MachExtensions, NewMachPort_PortSet) { } TEST(MachExtensions, NewMachPort_DeadName) { - base::mac::ScopedMachSendRight port(NewMachPort(MACH_PORT_RIGHT_DEAD_NAME)); + base::apple::ScopedMachSendRight port(NewMachPort(MACH_PORT_RIGHT_DEAD_NAME)); ASSERT_NE(port, kMachPortNull); mach_port_type_t type; diff --git a/util/mach/mach_message.cc b/util/mach/mach_message.cc index 008724fb..28e42279 100644 --- a/util/mach/mach_message.cc +++ b/util/mach/mach_message.cc @@ -18,8 +18,8 @@ #include +#include "base/apple/mach_logging.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" #include "build/build_config.h" #include "util/misc/clock.h" #include "util/misc/implicit_cast.h" diff --git a/util/mach/mach_message_server.cc b/util/mach/mach_message_server.cc index e1529c66..bfe8a8cf 100644 --- a/util/mach/mach_message_server.cc +++ b/util/mach/mach_message_server.cc @@ -18,9 +18,9 @@ #include +#include "base/apple/mach_logging.h" +#include "base/apple/scoped_mach_vm.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" -#include "base/mac/scoped_mach_vm.h" #include "util/mach/mach_message.h" namespace crashpad { @@ -83,7 +83,7 @@ class MachMessageBuffer { } private: - base::mac::ScopedMachVM vm_; + base::apple::ScopedMachVM vm_; }; // Wraps MachMessageWithDeadline(), using a MachMessageBuffer argument which diff --git a/util/mach/mach_message_server_test.cc b/util/mach/mach_message_server_test.cc index dd6c1b2c..335aa7bf 100644 --- a/util/mach/mach_message_server_test.cc +++ b/util/mach/mach_message_server_test.cc @@ -22,7 +22,7 @@ #include #include -#include "base/mac/scoped_mach_port.h" +#include "base/apple/scoped_mach_port.h" #include "gtest/gtest.h" #include "test/mac/mach_errors.h" #include "test/mac/mach_multiprocess.h" @@ -445,7 +445,7 @@ class TestMachMessageServer : public MachMessageServer::Interface, // local_receive_port_owner will the receive right that is created in this // scope and intended to be destroyed when leaving this scope, after it has // been carried in a Mach message. - base::mac::ScopedMachReceiveRight local_receive_port_owner; + base::apple::ScopedMachReceiveRight local_receive_port_owner; // A LargeRequestMessage is always allocated, but the message that will be // sent will be a normal RequestMessage due to the msgh_size field @@ -582,7 +582,7 @@ class TestMachMessageServer : public MachMessageServer::Interface, // A receive right allocated in the child process. A send right will be // created from this right and sent to the parent parent process in the // request message. - base::mac::ScopedMachReceiveRight child_complex_message_port_; + base::apple::ScopedMachReceiveRight child_complex_message_port_; // The send right received in the parent process. This right is stored in a // member variable to test that resources carried in complex messages are diff --git a/util/mach/mach_message_test.cc b/util/mach/mach_message_test.cc index b7778132..5698179e 100644 --- a/util/mach/mach_message_test.cc +++ b/util/mach/mach_message_test.cc @@ -18,7 +18,7 @@ #include -#include "base/mac/scoped_mach_port.h" +#include "base/apple/scoped_mach_port.h" #include "build/build_config.h" #include "gtest/gtest.h" #include "test/mac/mach_errors.h" @@ -116,7 +116,7 @@ TEST(MachMessage, MachMessageDestroyReceivedPort) { ASSERT_NE(port, kMachPortNull); EXPECT_TRUE(MachMessageDestroyReceivedPort(port, MACH_MSG_TYPE_PORT_RECEIVE)); - base::mac::ScopedMachReceiveRight receive( + base::apple::ScopedMachReceiveRight receive( NewMachPort(MACH_PORT_RIGHT_RECEIVE)); mach_msg_type_name_t right_type; kern_return_t kr = mach_port_extract_right(mach_task_self(), @@ -163,7 +163,8 @@ TEST(MachMessage, MachMessageDestroyReceivedPort) { #if BUILDFLAG(IS_MAC) TEST(MachMessage, AuditPIDFromMachMessageTrailer) { - base::mac::ScopedMachReceiveRight port(NewMachPort(MACH_PORT_RIGHT_RECEIVE)); + base::apple::ScopedMachReceiveRight port( + NewMachPort(MACH_PORT_RIGHT_RECEIVE)); ASSERT_NE(port, kMachPortNull); mach_msg_empty_send_t send = {}; diff --git a/util/mach/notify_server_test.cc b/util/mach/notify_server_test.cc index 324439ed..2c9e7e6a 100644 --- a/util/mach/notify_server_test.cc +++ b/util/mach/notify_server_test.cc @@ -16,8 +16,8 @@ #include +#include "base/apple/scoped_mach_port.h" #include "base/compiler_specific.h" -#include "base/mac/scoped_mach_port.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "test/mac/mach_errors.h" @@ -234,7 +234,7 @@ class NotifyServerTestBase : public testing::Test, return false; } - base::mac::ScopedMachSendRight previous_owner(previous); + base::apple::ScopedMachSendRight previous_owner(previous); EXPECT_EQ(previous, kMachPortNull); return true; @@ -284,7 +284,7 @@ class NotifyServerTestBase : public testing::Test, void TearDown() override { server_port_.reset(); } private: - base::mac::ScopedMachReceiveRight server_port_; + base::apple::ScopedMachReceiveRight server_port_; }; using NotifyServerTest = StrictMock; @@ -319,11 +319,11 @@ TEST_F(NotifyServerTest, NoNotification) { // When a send-once right with a dead-name notification request is deallocated, // a port-deleted notification should be generated. TEST_F(NotifyServerTest, MachNotifyPortDeleted) { - base::mac::ScopedMachReceiveRight receive_right( + base::apple::ScopedMachReceiveRight receive_right( NewMachPort(MACH_PORT_RIGHT_RECEIVE)); ASSERT_TRUE(receive_right.is_valid()); - base::mac::ScopedMachSendRight send_once_right( + base::apple::ScopedMachSendRight send_once_right( SendOnceRightFromReceiveRight(receive_right.get())); ASSERT_TRUE(send_once_right.is_valid()); @@ -346,7 +346,7 @@ TEST_F(NotifyServerTest, MachNotifyPortDeleted) { // When a receive right with a port-destroyed notification request is destroyed, // a port-destroyed notification should be generated. TEST_F(NotifyServerTest, MachNotifyPortDestroyed) { - base::mac::ScopedMachReceiveRight receive_right( + base::apple::ScopedMachReceiveRight receive_right( NewMachPort(MACH_PORT_RIGHT_RECEIVE)); ASSERT_TRUE(receive_right.is_valid()); @@ -370,7 +370,7 @@ TEST_F(NotifyServerTest, MachNotifyPortDestroyed) { // When a receive right with a port-destroyed notification request is not // destroyed, no port-destroyed notification should be generated. TEST_F(NotifyServerTest, MachNotifyPortDestroyed_NoNotification) { - base::mac::ScopedMachReceiveRight receive_right( + base::apple::ScopedMachReceiveRight receive_right( NewMachPort(MACH_PORT_RIGHT_RECEIVE)); ASSERT_TRUE(receive_right.is_valid()); @@ -383,7 +383,7 @@ TEST_F(NotifyServerTest, MachNotifyPortDestroyed_NoNotification) { // When a no-senders notification request is registered for a receive right with // no senders, a no-senders notification should be generated. TEST_F(NotifyServerTest, MachNotifyNoSenders_NoSendRight) { - base::mac::ScopedMachReceiveRight receive_right( + base::apple::ScopedMachReceiveRight receive_right( NewMachPort(MACH_PORT_RIGHT_RECEIVE)); ASSERT_TRUE(receive_right.is_valid()); @@ -403,11 +403,11 @@ TEST_F(NotifyServerTest, MachNotifyNoSenders_NoSendRight) { // notification request is deallocated, a no-senders notification should be // generated. TEST_F(NotifyServerTest, MachNotifyNoSenders_SendRightDeallocated) { - base::mac::ScopedMachReceiveRight receive_right( + base::apple::ScopedMachReceiveRight receive_right( NewMachPort(MACH_PORT_RIGHT_RECEIVE)); ASSERT_TRUE(receive_right.is_valid()); - base::mac::ScopedMachSendRight send_right( + base::apple::ScopedMachSendRight send_right( SendRightFromReceiveRight(receive_right.get())); ASSERT_TRUE(send_right.is_valid()); @@ -428,15 +428,15 @@ TEST_F(NotifyServerTest, MachNotifyNoSenders_SendRightDeallocated) { // When the a receive right with a no-senders notification request never loses // all senders, no no-senders notification should be generated. TEST_F(NotifyServerTest, MachNotifyNoSenders_NoNotification) { - base::mac::ScopedMachReceiveRight receive_right( + base::apple::ScopedMachReceiveRight receive_right( NewMachPort(MACH_PORT_RIGHT_RECEIVE)); ASSERT_TRUE(receive_right.is_valid()); - base::mac::ScopedMachSendRight send_right_0( + base::apple::ScopedMachSendRight send_right_0( SendRightFromReceiveRight(receive_right.get())); ASSERT_TRUE(send_right_0.is_valid()); - base::mac::ScopedMachSendRight send_right_1( + base::apple::ScopedMachSendRight send_right_1( SendRightFromReceiveRight(receive_right.get())); ASSERT_TRUE(send_right_1.is_valid()); @@ -454,7 +454,7 @@ TEST_F(NotifyServerTest, MachNotifyNoSenders_NoNotification) { // When a send-once right is deallocated without being used, a send-once // notification notification should be sent via the send-once right. TEST_F(NotifyServerTest, MachNotifySendOnce_ExplicitDeallocation) { - base::mac::ScopedMachSendRight send_once_right( + base::apple::ScopedMachSendRight send_once_right( SendOnceRightFromReceiveRight(ServerPort())); ASSERT_TRUE(send_once_right.is_valid()); @@ -473,7 +473,7 @@ TEST_F(NotifyServerTest, MachNotifySendOnce_ExplicitDeallocation) { // the send-once right is destroyed, and a send-once notification should appear // on the reply port. TEST_F(NotifyServerTest, MachNotifySendOnce_ImplicitDeallocation) { - base::mac::ScopedMachReceiveRight receive_right( + base::apple::ScopedMachReceiveRight receive_right( NewMachPort(MACH_PORT_RIGHT_RECEIVE)); ASSERT_TRUE(receive_right.is_valid()); @@ -507,11 +507,11 @@ TEST_F(NotifyServerTest, MachNotifySendOnce_ImplicitDeallocation) { // notification request is destroyed, a dead-name notification should be // generated. TEST_F(NotifyServerTest, MachNotifyDeadName) { - base::mac::ScopedMachReceiveRight receive_right( + base::apple::ScopedMachReceiveRight receive_right( NewMachPort(MACH_PORT_RIGHT_RECEIVE)); ASSERT_TRUE(receive_right.is_valid()); - base::mac::ScopedMachSendRight send_once_right( + base::apple::ScopedMachSendRight send_once_right( SendOnceRightFromReceiveRight(receive_right.get())); ASSERT_TRUE(send_once_right.is_valid()); @@ -546,11 +546,11 @@ TEST_F(NotifyServerTest, MachNotifyDeadName) { // notification request is not destroyed, no dead-name notification should be // generated. TEST_F(NotifyServerTest, MachNotifyDeadName_NoNotification) { - base::mac::ScopedMachReceiveRight receive_right( + base::apple::ScopedMachReceiveRight receive_right( NewMachPort(MACH_PORT_RIGHT_RECEIVE)); ASSERT_TRUE(receive_right.is_valid()); - base::mac::ScopedMachSendRight send_once_right( + base::apple::ScopedMachSendRight send_once_right( SendOnceRightFromReceiveRight(receive_right.get())); ASSERT_TRUE(send_once_right.is_valid()); diff --git a/util/mach/scoped_task_suspend.cc b/util/mach/scoped_task_suspend.cc index b91a16a6..67cad4f1 100644 --- a/util/mach/scoped_task_suspend.cc +++ b/util/mach/scoped_task_suspend.cc @@ -14,9 +14,9 @@ #include "util/mach/scoped_task_suspend.h" +#include "base/apple/mach_logging.h" #include "base/check_op.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" namespace crashpad { diff --git a/util/mach/task_for_pid.cc b/util/mach/task_for_pid.cc index 08e031d7..5827dc45 100644 --- a/util/mach/task_for_pid.cc +++ b/util/mach/task_for_pid.cc @@ -21,8 +21,8 @@ #include #include -#include "base/mac/mach_logging.h" -#include "base/mac/scoped_mach_port.h" +#include "base/apple/mach_logging.h" +#include "base/apple/scoped_mach_port.h" #include "util/posix/process_info.h" namespace crashpad { @@ -154,7 +154,7 @@ task_t TaskForPID(pid_t pid) { return TASK_NULL; } - base::mac::ScopedMachSendRight task_owner(task); + base::apple::ScopedMachSendRight task_owner(task); if (!TaskForPIDCheck(task)) { return TASK_NULL; diff --git a/util/misc/clock_mac.cc b/util/misc/clock_mac.cc index e2142ed4..81e53170 100644 --- a/util/misc/clock_mac.cc +++ b/util/misc/clock_mac.cc @@ -16,7 +16,7 @@ #include -#include "base/mac/mach_logging.h" +#include "base/apple/mach_logging.h" namespace { diff --git a/util/posix/process_info_mac.cc b/util/posix/process_info_mac.cc index 23f8b72f..07a93a5b 100644 --- a/util/posix/process_info_mac.cc +++ b/util/posix/process_info_mac.cc @@ -18,8 +18,8 @@ #include +#include "base/apple/mach_logging.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" namespace crashpad { diff --git a/util/process/process_memory_mac.cc b/util/process/process_memory_mac.cc index fc8719b4..a3cb6696 100644 --- a/util/process/process_memory_mac.cc +++ b/util/process/process_memory_mac.cc @@ -19,8 +19,8 @@ #include +#include "base/apple/mach_logging.h" #include "base/logging.h" -#include "base/mac/mach_logging.h" #include "base/strings/stringprintf.h" #include "util/stdlib/strnlen.h" diff --git a/util/process/process_memory_mac.h b/util/process/process_memory_mac.h index 6c76e3d2..9803daf9 100644 --- a/util/process/process_memory_mac.h +++ b/util/process/process_memory_mac.h @@ -21,7 +21,7 @@ #include #include -#include "base/mac/scoped_mach_vm.h" +#include "base/apple/scoped_mach_vm.h" #include "util/misc/address_types.h" #include "util/misc/initialization_state_dcheck.h" #include "util/process/process_memory.h" @@ -82,7 +82,7 @@ class ProcessMemoryMac : public ProcessMemory { size_t user_offset, size_t user_size); - base::mac::ScopedMachVM vm_; + base::apple::ScopedMachVM vm_; const void* data_; size_t user_size_; diff --git a/util/process/process_memory_mac_test.cc b/util/process/process_memory_mac_test.cc index 9e2b7b06..296b536d 100644 --- a/util/process/process_memory_mac_test.cc +++ b/util/process/process_memory_mac_test.cc @@ -21,8 +21,8 @@ #include #include -#include "base/mac/scoped_mach_port.h" -#include "base/mac/scoped_mach_vm.h" +#include "base/apple/scoped_mach_port.h" +#include "base/apple/scoped_mach_vm.h" #include "gtest/gtest.h" #include "test/mac/mach_errors.h" #include "util/misc/from_pointer_cast.h" @@ -37,7 +37,7 @@ TEST(ProcessMemoryMac, ReadMappedSelf) { kern_return_t kr = vm_allocate(mach_task_self(), &address, kSize, VM_FLAGS_ANYWHERE); ASSERT_EQ(kr, KERN_SUCCESS) << MachErrorMessage(kr, "vm_allocate"); - base::mac::ScopedMachVM vm_owner(address, mach_vm_round_page(kSize)); + base::apple::ScopedMachVM vm_owner(address, mach_vm_round_page(kSize)); char* region = reinterpret_cast(address); for (size_t index = 0; index < kSize; ++index) { @@ -92,7 +92,7 @@ TEST(ProcessMemoryMac, ReadSelfUnmapped) { kern_return_t kr = vm_allocate(mach_task_self(), &address, kSize, VM_FLAGS_ANYWHERE); ASSERT_EQ(kr, KERN_SUCCESS) << MachErrorMessage(kr, "vm_allocate"); - base::mac::ScopedMachVM vm_owner(address, mach_vm_round_page(kSize)); + base::apple::ScopedMachVM vm_owner(address, mach_vm_round_page(kSize)); char* region = reinterpret_cast(address); for (size_t index = 0; index < kSize; ++index) { @@ -154,7 +154,7 @@ TEST(ProcessMemoryMac, ReadCStringSelfUnmapped) { kern_return_t kr = vm_allocate(mach_task_self(), &address, kSize, VM_FLAGS_ANYWHERE); ASSERT_EQ(kr, KERN_SUCCESS) << MachErrorMessage(kr, "vm_allocate"); - base::mac::ScopedMachVM vm_owner(address, mach_vm_round_page(kSize)); + base::apple::ScopedMachVM vm_owner(address, mach_vm_round_page(kSize)); char* region = reinterpret_cast(address); for (size_t index = 0; index < kSize; ++index) { @@ -219,7 +219,7 @@ bool IsAddressMapped(vm_address_t address) { // |object| will be MACH_PORT_NULL (10.9.4 xnu-2422.110.17/osfmk/vm/vm_map.c // vm_map_region()), but the interface acts as if it might carry a send // right, so treat it as documented. - base::mac::ScopedMachSendRight object_owner(object); + base::apple::ScopedMachSendRight object_owner(object); return address >= region_address && address <= region_address + region_size; }