mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-25 22:30:49 +08:00
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 <mark@chromium.org> Commit-Queue: Avi Drissman <avi@chromium.org>
This commit is contained in:
parent
43d04a8661
commit
6a9e2e6003
2
DEPS
2
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',
|
||||
|
@ -30,8 +30,8 @@
|
||||
#include <mutex>
|
||||
#include <tuple>
|
||||
|
||||
#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<CrashReportDatabase::Report>* reports) {
|
||||
base::mac::ScopedNSAutoreleasePool pool;
|
||||
base::apple::ScopedNSAutoreleasePool pool;
|
||||
|
||||
DCHECK(reports->empty());
|
||||
|
||||
|
@ -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 <windows.h>
|
||||
#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_;
|
||||
|
@ -21,9 +21,9 @@
|
||||
#include <ios>
|
||||
#include <iterator>
|
||||
|
||||
#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_;
|
||||
|
@ -24,8 +24,8 @@
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
#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<std::string, std::string>& annotations,
|
||||
const std::vector<std::string>& 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_name_t>(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<std::string, std::string>& annotations,
|
||||
const std::vector<std::string>& 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<std::string, std::string> annotations_;
|
||||
std::vector<std::string> 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.
|
||||
|
@ -19,10 +19,10 @@
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#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);
|
||||
|
@ -71,7 +71,7 @@
|
||||
#include <libgen.h>
|
||||
#include <signal.h>
|
||||
|
||||
#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(
|
||||
|
@ -17,9 +17,9 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#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.
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#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)),
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include <mach/mach.h>
|
||||
|
||||
#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_;
|
||||
};
|
||||
|
||||
|
@ -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"
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include <mach-o/loader.h>
|
||||
#include <mach/mach.h>
|
||||
|
||||
#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"
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#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"
|
||||
|
@ -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"
|
||||
|
@ -21,10 +21,10 @@
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#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<vm_address_t>(threads),
|
||||
mach_vm_round_page(thread_count * sizeof(*threads)));
|
||||
|
||||
|
@ -30,9 +30,9 @@
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
#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(),
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <pthread.h>
|
||||
#include <limits>
|
||||
|
||||
#include "base/mac/mach_logging.h"
|
||||
#include "base/apple/mach_logging.h"
|
||||
#include "client/crashpad_client.h"
|
||||
#include "util/ios/raw_logging.h"
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#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());
|
||||
|
||||
|
@ -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";
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
#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
|
||||
|
@ -38,7 +38,7 @@
|
||||
#if BUILDFLAG(IS_APPLE)
|
||||
#include <mach/mach.h>
|
||||
|
||||
#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.
|
||||
|
@ -24,9 +24,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
@ -25,8 +25,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#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");
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include <fcntl.h>
|
||||
#include <mach/mach.h>
|
||||
|
||||
#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<vm_address_t>(region),
|
||||
region_size);
|
||||
base::apple::ScopedMachVM vm_owner(reinterpret_cast<vm_address_t>(region),
|
||||
region_size);
|
||||
|
||||
// Fill first page with 'A' and second with 'B'.
|
||||
memset(region, 'A', page_size);
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <TargetConditionals.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#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"
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#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<vm_address_t>(region),
|
||||
region_size);
|
||||
base::apple::ScopedMachVM vm_owner(reinterpret_cast<vm_address_t>(region),
|
||||
region_size);
|
||||
|
||||
internal::ScopedVMMap<char> vmmap_missing_middle;
|
||||
ASSERT_TRUE(vmmap_missing_middle.Map(region, region_size));
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#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<vm_address_t>(region),
|
||||
region_size);
|
||||
base::apple::ScopedMachVM vm_owner(reinterpret_cast<vm_address_t>(region),
|
||||
region_size);
|
||||
|
||||
internal::ScopedVMRead<char> vmread_missing_middle;
|
||||
ASSERT_TRUE(vmread_missing_middle.Read(region, region_size));
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <mach/mach.h>
|
||||
#include <servers/bootstrap.h>
|
||||
|
||||
#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<BootstrapCheckInTraits>(service_name);
|
||||
}
|
||||
|
||||
base::mac::ScopedMachSendRight BootstrapLookUp(
|
||||
base::apple::ScopedMachSendRight BootstrapLookUp(
|
||||
const std::string& service_name) {
|
||||
base::mac::ScopedMachSendRight send(
|
||||
base::apple::ScopedMachSendRight send(
|
||||
BootstrapCheckInOrLookUp<BootstrapLookUpTraits>(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");
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#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
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -27,10 +27,10 @@
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -19,9 +19,9 @@
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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());
|
||||
|
@ -21,9 +21,9 @@
|
||||
#include <libproc.h>
|
||||
#include <strings.h>
|
||||
|
||||
#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"
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <Availability.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "base/mac/mach_logging.h"
|
||||
#include "base/apple/mach_logging.h"
|
||||
#include "build/build_config.h"
|
||||
#include "util/mac/mac_util.h"
|
||||
|
||||
|
@ -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;
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#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"
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#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
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <iterator>
|
||||
#include <set>
|
||||
|
||||
#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
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#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 = {};
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#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<NotifyServerTestBase>;
|
||||
@ -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());
|
||||
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include <iterator>
|
||||
#include <set>
|
||||
|
||||
#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;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <mach/mach_time.h>
|
||||
|
||||
#include "base/mac/mach_logging.h"
|
||||
#include "base/apple/mach_logging.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#include "base/apple/mach_logging.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/mac/mach_logging.h"
|
||||
|
||||
namespace crashpad {
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#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"
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#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_;
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#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<char*>(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<char*>(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<char*>(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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user