mirror of
https://github.com/chromium/crashpad.git
synced 2025-01-14 01:08:01 +08:00
Convert NULL to nullptr.
This change was generated mechanically by running: find . \( -name \*.cc -or -name \*.mm -or -name \*.h \) \ -and -not -path ./third_party/\* -and -not -path ./out/\* \ -exec sed -i '' -E -e 's/(^|[^_])NULL/\1nullptr/g' {} + Further manual fix-ups were applied to remove casts of nullptr to other pointer types where possible, to preserve the intentional use of NULL (as a short form of MACH_PORT_NULL) in exception_port_tool, and to fix 80-column violations. https://groups.google.com/a/chromium.org/d/topic/chromium-dev/4mijeJHzxLg/discussion TEST=*_test R=rsesek@chromium.org Review URL: https://codereview.chromium.org/656703002
This commit is contained in:
parent
d90ce10e1f
commit
5d74f120fc
@ -78,8 +78,8 @@ class TSimpleStringDictionary {
|
||||
current_(0) {
|
||||
}
|
||||
|
||||
//! \brief Returns the next entry in the map, or `NULL` if at the end of the
|
||||
//! collection.
|
||||
//! \brief Returns the next entry in the map, or `nullptr` if at the end of
|
||||
//! the collection.
|
||||
const Entry* Next() {
|
||||
while (current_ < map_.num_entries) {
|
||||
const Entry* entry = &map_.entries_[current_++];
|
||||
@ -87,7 +87,7 @@ class TSimpleStringDictionary {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -134,19 +134,19 @@ class TSimpleStringDictionary {
|
||||
|
||||
//! \brief Given \a key, returns its corresponding value.
|
||||
//!
|
||||
//! \param[in] key The key to look up. This must not be `NULL`.
|
||||
//! \param[in] key The key to look up. This must not be `nullptr`.
|
||||
//!
|
||||
//! \return The corresponding value for \a key, or if \a key is not found,
|
||||
//! `NULL`.
|
||||
//! `nullptr`.
|
||||
const char* GetValueForKey(const char* key) const {
|
||||
DCHECK(key);
|
||||
if (!key) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Entry* entry = GetConstEntryForKey(key);
|
||||
if (!entry) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return entry->value;
|
||||
@ -155,12 +155,12 @@ class TSimpleStringDictionary {
|
||||
//! \brief Stores \a value into \a key, replacing the existing value if \a key
|
||||
//! is already present.
|
||||
//!
|
||||
//! If there \a key is not yet in the map and the map is already full
|
||||
//! (containing \a NumEntries active entries), this operation silently fails.
|
||||
//! If \a key is not yet in the map and the map is already full (containing
|
||||
//! \a NumEntries active entries), this operation silently fails.
|
||||
//!
|
||||
//! \param[in] key The key to store. This must not be `NULL`.
|
||||
//! \param[in] value The value to store. If `NULL`, \a key is removed from the
|
||||
//! map.
|
||||
//! \param[in] key The key to store. This must not be `nullptr`.
|
||||
//! \param[in] value The value to store. If `nullptr`, \a key is removed from
|
||||
//! the map.
|
||||
void SetKeyValue(const char* key, const char* value) {
|
||||
if (!value) {
|
||||
RemoveKey(key);
|
||||
@ -194,7 +194,7 @@ class TSimpleStringDictionary {
|
||||
}
|
||||
}
|
||||
|
||||
// If the map is out of space, entry will be NULL.
|
||||
// If the map is out of space, |entry| will be nullptr.
|
||||
if (!entry) {
|
||||
return;
|
||||
}
|
||||
@ -216,9 +216,9 @@ class TSimpleStringDictionary {
|
||||
|
||||
//! \brief Removes \a key from the map.
|
||||
//!
|
||||
//! If the key is not found, this is a no-op.
|
||||
//! If \a key is not found, this is a no-op.
|
||||
//!
|
||||
//! \param[in] key The key of the entry to remove. This must not be `NULL`.
|
||||
//! \param[in] key The key of the entry to remove. This must not be `nullptr`.
|
||||
void RemoveKey(const char* key) {
|
||||
DCHECK(key);
|
||||
if (!key) {
|
||||
@ -231,7 +231,7 @@ class TSimpleStringDictionary {
|
||||
entry->value[0] = '\0';
|
||||
}
|
||||
|
||||
DCHECK_EQ(GetEntryForKey(key), static_cast<void*>(NULL));
|
||||
DCHECK_EQ(GetEntryForKey(key), static_cast<Entry*>(nullptr));
|
||||
}
|
||||
|
||||
//! \brief Returns a serialized form of the map.
|
||||
@ -253,7 +253,7 @@ class TSimpleStringDictionary {
|
||||
return &entries_[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Entry* GetEntryForKey(const char* key) {
|
||||
|
@ -71,8 +71,8 @@ TEST(SimpleStringDictionary, SimpleStringDictionary) {
|
||||
// Now make sure it's not there anymore
|
||||
EXPECT_FALSE(dict.GetValueForKey("key3"));
|
||||
|
||||
// Remove by setting value to NULL
|
||||
dict.SetKeyValue("key2", NULL);
|
||||
// Remove by setting value to nullptr
|
||||
dict.SetKeyValue("key2", nullptr);
|
||||
|
||||
// Now make sure it's not there anymore
|
||||
EXPECT_FALSE(dict.GetValueForKey("key2"));
|
||||
@ -279,13 +279,13 @@ TEST(SimpleStringDictionary, OutOfSpace) {
|
||||
|
||||
TEST(SimpleStringDictionaryDeathTest, NullKey) {
|
||||
TSimpleStringDictionary<4, 6, 6> map;
|
||||
ASSERT_DEATH(map.SetKeyValue(NULL, "hello"), "key");
|
||||
ASSERT_DEATH(map.SetKeyValue(nullptr, "hello"), "key");
|
||||
|
||||
map.SetKeyValue("hi", "there");
|
||||
ASSERT_DEATH(map.GetValueForKey(NULL), "key");
|
||||
ASSERT_DEATH(map.GetValueForKey(nullptr), "key");
|
||||
EXPECT_STREQ("there", map.GetValueForKey("hi"));
|
||||
|
||||
ASSERT_DEATH(map.GetValueForKey(NULL), "key");
|
||||
ASSERT_DEATH(map.GetValueForKey(nullptr), "key");
|
||||
map.RemoveKey("hi");
|
||||
EXPECT_EQ(0u, map.GetCount());
|
||||
}
|
||||
|
@ -37,22 +37,22 @@ namespace {
|
||||
// getsectbyname() function. getsectbyname() is always present in libmacho.
|
||||
// getsectiondata() and getsegmentdata() are not always present, but when they
|
||||
// are, they’re in the same library as getsectbyname(). If the library cannot
|
||||
// be found or a handle to it cannot be returned, returns NULL.
|
||||
// be found or a handle to it cannot be returned, returns nullptr.
|
||||
void* SystemLibMachOHandle() {
|
||||
Dl_info info;
|
||||
if (!dladdr(reinterpret_cast<void*>(getsectbyname), &info)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return dlopen(info.dli_fname, RTLD_LAZY | RTLD_LOCAL);
|
||||
}
|
||||
|
||||
// Returns a function pointer to a function in libmacho based on a lookup of
|
||||
// that function by symbol name. Returns NULL if libmacho cannot be found or
|
||||
// that function by symbol name. Returns nullptr if libmacho cannot be found or
|
||||
// opened, or if the named symbol cannot be found in libmacho.
|
||||
void* LookUpSystemLibMachOSymbol(const char* symbol) {
|
||||
static void* dl_handle = SystemLibMachOHandle();
|
||||
if (!dl_handle) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return dlsym(dl_handle, symbol);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
namespace crashpad {
|
||||
|
||||
MinidumpExceptionWriter::MinidumpExceptionWriter()
|
||||
: MinidumpStreamWriter(), exception_(), context_(NULL) {
|
||||
: MinidumpStreamWriter(), exception_(), context_(nullptr) {
|
||||
}
|
||||
|
||||
void MinidumpExceptionWriter::SetContext(MinidumpContextWriter* context) {
|
||||
|
@ -171,8 +171,8 @@ MinidumpModuleWriter::MinidumpModuleWriter()
|
||||
: MinidumpWritable(),
|
||||
module_(),
|
||||
name_(),
|
||||
codeview_record_(NULL),
|
||||
misc_debug_record_(NULL) {
|
||||
codeview_record_(nullptr),
|
||||
misc_debug_record_(nullptr) {
|
||||
module_.VersionInfo.dwSignature = VS_FFI_SIGNATURE;
|
||||
module_.VersionInfo.dwStrucVersion = VS_FFI_STRUCVERSION;
|
||||
}
|
||||
|
@ -81,11 +81,11 @@ TEST(MinidumpModuleWriter, EmptyModuleList) {
|
||||
EXPECT_EQ(0u, module_list->NumberOfModules);
|
||||
}
|
||||
|
||||
// If |expected_pdb_name| is non-NULL, |codeview_record| is used to locate a
|
||||
// If |expected_pdb_name| is not nullptr, |codeview_record| is used to locate a
|
||||
// CodeView record in |file_contents|, and its fields are compared against the
|
||||
// the |expected_pdb_*| values. If |expected_pdb_uuid| is supplied, the CodeView
|
||||
// record must be a PDB 7.0 link, otherwise, it must be a PDB 2.0 link. If
|
||||
// |expected_pdb_name| is NULL, |codeview_record| must not point to anything.
|
||||
// |expected_pdb_name| is nullptr, |codeview_record| must not point to anything.
|
||||
void ExpectCodeViewRecord(const MINIDUMP_LOCATION_DESCRIPTOR* codeview_record,
|
||||
const std::string& file_contents,
|
||||
const char* expected_pdb_name,
|
||||
@ -148,10 +148,10 @@ void ExpectCodeViewRecord(const MINIDUMP_LOCATION_DESCRIPTOR* codeview_record,
|
||||
}
|
||||
}
|
||||
|
||||
// If |expected_debug_name| is non-NULL, |misc_record| is used to locate a
|
||||
// If |expected_debug_name| is not nullptr, |misc_record| is used to locate a
|
||||
// miscellanous debugging record in |file_contents|, and its fields are compared
|
||||
// against the the |expected_debug_*| values. If |expected_debug_name| is NULL,
|
||||
// |misc_record| must not point to anything.
|
||||
// against the the |expected_debug_*| values. If |expected_debug_name| is
|
||||
// nullptr, |misc_record| must not point to anything.
|
||||
void ExpectMiscellaneousDebugRecord(
|
||||
const MINIDUMP_LOCATION_DESCRIPTOR* misc_record,
|
||||
const std::string& file_contents,
|
||||
@ -315,11 +315,11 @@ TEST(MinidumpModuleWriter, EmptyModule) {
|
||||
&module_list->Modules[0],
|
||||
file_writer.string(),
|
||||
kModuleName,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
false));
|
||||
}
|
||||
@ -479,7 +479,7 @@ TEST(MinidumpModuleWriter, OneModule_CodeViewUsesPDB20_MiscUsesUTF16) {
|
||||
file_writer.string(),
|
||||
kModuleName,
|
||||
kPDBName,
|
||||
NULL,
|
||||
nullptr,
|
||||
kPDBTimestamp,
|
||||
kPDBAge,
|
||||
kDebugName,
|
||||
@ -578,7 +578,7 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||
&pdb_uuid_0,
|
||||
0,
|
||||
kPDBAge0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
false));
|
||||
}
|
||||
@ -593,11 +593,11 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||
&module_list->Modules[1],
|
||||
file_writer.string(),
|
||||
kModuleName1,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
false));
|
||||
}
|
||||
@ -613,10 +613,10 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||
file_writer.string(),
|
||||
kModuleName2,
|
||||
kPDBName2,
|
||||
NULL,
|
||||
nullptr,
|
||||
kPDBTimestamp2,
|
||||
kPDBAge2,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
false));
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ TEST(MinidumpStringWriter, ConvertInvalidUTF8ToUTF16) {
|
||||
size_t out_units =
|
||||
minidump_string->Length / sizeof(minidump_string->Buffer[0]);
|
||||
EXPECT_EQ(0, minidump_string->Buffer[out_units]);
|
||||
EXPECT_NE(reinterpret_cast<char16*>(NULL),
|
||||
EXPECT_NE(nullptr,
|
||||
base::c16memchr(minidump_string->Buffer, 0xfffd, out_units));
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
namespace crashpad {
|
||||
|
||||
MinidumpThreadWriter::MinidumpThreadWriter()
|
||||
: MinidumpWritable(), thread_(), stack_(NULL), context_(NULL) {
|
||||
: MinidumpWritable(), thread_(), stack_(nullptr), context_(nullptr) {
|
||||
}
|
||||
|
||||
const MINIDUMP_THREAD* MinidumpThreadWriter::MinidumpThread() const {
|
||||
@ -95,7 +95,7 @@ MinidumpThreadListWriter::MinidumpThreadListWriter()
|
||||
: MinidumpStreamWriter(),
|
||||
thread_list_base_(),
|
||||
threads_(),
|
||||
memory_list_writer_(NULL) {
|
||||
memory_list_writer_(nullptr) {
|
||||
}
|
||||
|
||||
MinidumpThreadListWriter::~MinidumpThreadListWriter() {
|
||||
|
@ -55,7 +55,7 @@ class MinidumpThreadWriter final : public internal::MinidumpWritable {
|
||||
//! corresponding to this object’s stack.
|
||||
//!
|
||||
//! If the thread does not have a stack, or its stack could not be determined,
|
||||
//! this will return NULL.
|
||||
//! this will return nullptr.
|
||||
//!
|
||||
//! This method is provided so that MinidumpThreadListWriter can obtain thread
|
||||
//! stack memory regions for the purposes of adding them to a
|
||||
|
@ -30,8 +30,8 @@ namespace test {
|
||||
namespace {
|
||||
|
||||
// This returns the MINIDUMP_THREAD_LIST stream in |thread_list|. If
|
||||
// |memory_list| is non-NULL, a MINIDUMP_MEMORY_LIST stream is also expected in
|
||||
// |file_contents|, and that stream will be returned in |memory_list|.
|
||||
// |memory_list| is not nullptr, a MINIDUMP_MEMORY_LIST stream is also expected
|
||||
// in |file_contents|, and that stream will be returned in |memory_list|.
|
||||
void GetThreadListStream(const std::string& file_contents,
|
||||
const MINIDUMP_THREAD_LIST** thread_list,
|
||||
const MINIDUMP_MEMORY_LIST** memory_list) {
|
||||
@ -85,15 +85,15 @@ TEST(MinidumpThreadWriter, EmptyThreadList) {
|
||||
|
||||
const MINIDUMP_THREAD_LIST* thread_list;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetThreadListStream(file_writer.string(), &thread_list, NULL));
|
||||
GetThreadListStream(file_writer.string(), &thread_list, nullptr));
|
||||
|
||||
EXPECT_EQ(0u, thread_list->NumberOfThreads);
|
||||
}
|
||||
|
||||
// The MINIDUMP_THREADs |expected| and |observed| are compared against each
|
||||
// other using gtest assertions. If |stack| is non-NULL, |observed| is expected
|
||||
// to contain a populated MINIDUMP_MEMORY_DESCRIPTOR in its Stack field,
|
||||
// otherwise, its Stack field is expected to be zeroed out. The memory
|
||||
// other using gtest assertions. If |stack| is not nullptr, |observed| is
|
||||
// expected to contain a populated MINIDUMP_MEMORY_DESCRIPTOR in its Stack
|
||||
// field, otherwise, its Stack field is expected to be zeroed out. The memory
|
||||
// descriptor will be placed in |stack|. |observed| must contain a populated
|
||||
// ThreadContext field. The context will be recovered from |file_contents| and
|
||||
// stored in |context_base|.
|
||||
@ -166,7 +166,7 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
||||
|
||||
const MINIDUMP_THREAD_LIST* thread_list;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetThreadListStream(file_writer.string(), &thread_list, NULL));
|
||||
GetThreadListStream(file_writer.string(), &thread_list, nullptr));
|
||||
|
||||
EXPECT_EQ(1u, thread_list->NumberOfThreads);
|
||||
|
||||
@ -183,7 +183,7 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
||||
ExpectThread(&expected,
|
||||
&thread_list->Threads[0],
|
||||
file_writer.string(),
|
||||
NULL,
|
||||
nullptr,
|
||||
reinterpret_cast<const void**>(&observed_context)));
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(ExpectMinidumpContextX86(kSeed, observed_context));
|
||||
@ -231,7 +231,7 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
|
||||
|
||||
const MINIDUMP_THREAD_LIST* thread_list;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetThreadListStream(file_writer.string(), &thread_list, NULL));
|
||||
GetThreadListStream(file_writer.string(), &thread_list, nullptr));
|
||||
|
||||
EXPECT_EQ(1u, thread_list->NumberOfThreads);
|
||||
|
||||
|
@ -45,15 +45,15 @@ namespace internal {
|
||||
//! \param[in] flavor The native thread state flavor of \a state. This may be
|
||||
//! `x86_THREAD_STATE32`, `x86_FLOAT_STATE32`, `x86_DEBUG_STATE32`,
|
||||
//! `x86_THREAD_STATE`, `x86_FLOAT_STATE`, or `x86_DEBUG_STATE`. It may also
|
||||
//! be `THREAD_STATE_NONE` if \a state is not supplied (and is `NULL`).
|
||||
//! be `THREAD_STATE_NONE` if \a state is not supplied (and is `nullptr`).
|
||||
//! \param[in] state The native thread state, which may be a casted pointer to
|
||||
//! `x86_thread_state32_t`, `x86_float_state32_t`, `x86_debug_state32_t`,
|
||||
//! `x86_thread_state`, `x86_float_state`, or `x86_debug_state`. This
|
||||
//! parameter may be `NULL` to not supply this data, in which case \a flavor
|
||||
//! must be `THREAD_STATE_NONE`. If a “universal” structure is used, it must
|
||||
//! carry 32-bit state data of the correct type.
|
||||
//! parameter may be `nullptr` to not supply this data, in which case \a
|
||||
//! flavor must be `THREAD_STATE_NONE`. If a “universal” structure is used,
|
||||
//! it must carry 32-bit state data of the correct type.
|
||||
//! \param[in] state_count The number of `natural_t`-sized (`int`-sized) units
|
||||
//! in \a state. This may be 0 if \a state is `NULL`.
|
||||
//! in \a state. This may be 0 if \a state is `nullptr`.
|
||||
//! \param[in] x86_thread_state32 The state of the thread’s integer registers.
|
||||
//! \param[in] x86_float_state32 The state of the thread’s floating-point
|
||||
//! registers.
|
||||
@ -86,15 +86,15 @@ void InitializeCPUContextX86(CPUContextX86* context,
|
||||
//! \param[in] flavor The native thread state flavor of \a state. This may be
|
||||
//! `x86_THREAD_STATE64`, `x86_FLOAT_STATE64`, `x86_DEBUG_STATE64`,
|
||||
//! `x86_THREAD_STATE`, `x86_FLOAT_STATE`, or `x86_DEBUG_STATE`. It may also
|
||||
//! be `THREAD_STATE_NONE` if \a state is not supplied (and is `NULL`).
|
||||
//! be `THREAD_STATE_NONE` if \a state is not supplied (and is `nullptr`).
|
||||
//! \param[in] state The native thread state, which may be a casted pointer to
|
||||
//! `x86_thread_state64_t`, `x86_float_state64_t`, `x86_debug_state64_t`,
|
||||
//! `x86_thread_state`, `x86_float_state`, or `x86_debug_state`. This
|
||||
//! parameter may be `NULL` to not supply this data, in which case \a flavor
|
||||
//! must be `THREAD_STATE_NONE`. If a “universal” structure is used, it must
|
||||
//! carry 64-bit state data of the correct type.
|
||||
//! parameter may be `nullptr` to not supply this data, in which case \a
|
||||
//! flavor must be `THREAD_STATE_NONE`. If a “universal” structure is used,
|
||||
//! it must carry 64-bit state data of the correct type.
|
||||
//! \param[in] state_count The number of `int`-sized units in \a state. This may
|
||||
//! be 0 if \a state is `NULL`.
|
||||
//! be 0 if \a state is `nullptr`.
|
||||
//! \param[in] x86_thread_state64 The state of the thread’s integer registers.
|
||||
//! \param[in] x86_float_state64 The state of the thread’s floating-point
|
||||
//! registers.
|
||||
|
@ -38,7 +38,7 @@ TEST(CPUContextMac, InitializeContextX86) {
|
||||
CPUContextX86 cpu_context_x86 = {};
|
||||
internal::InitializeCPUContextX86(&cpu_context_x86,
|
||||
THREAD_STATE_NONE,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
&x86_thread_state32,
|
||||
&x86_float_state32,
|
||||
@ -233,7 +233,7 @@ TEST(CPUContextMac, InitializeContextX86_64) {
|
||||
CPUContextX86_64 cpu_context_x86_64 = {};
|
||||
internal::InitializeCPUContextX86_64(&cpu_context_x86_64,
|
||||
THREAD_STATE_NONE,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
&x86_thread_state64,
|
||||
&x86_float_state64,
|
||||
|
@ -61,7 +61,7 @@ bool ExceptionSnapshotMac::Initialize(ProcessReader* process_reader,
|
||||
|
||||
if (exception_ == EXC_CRASH) {
|
||||
exception_ = ExcCrashRecoverOriginalException(
|
||||
exception_code_0, &exception_code_0, NULL);
|
||||
exception_code_0, &exception_code_0, nullptr);
|
||||
}
|
||||
|
||||
// ExceptionInfo() returns code[0] in a 32-bit field. This shouldn’t be a
|
||||
@ -74,7 +74,7 @@ bool ExceptionSnapshotMac::Initialize(ProcessReader* process_reader,
|
||||
return false;
|
||||
}
|
||||
|
||||
const ProcessReader::Thread* thread = NULL;
|
||||
const ProcessReader::Thread* thread = nullptr;
|
||||
for (const ProcessReader::Thread& loop_thread : process_reader->Threads()) {
|
||||
if (exception_thread == loop_thread.port) {
|
||||
thread = &loop_thread;
|
||||
|
@ -21,7 +21,7 @@ namespace internal {
|
||||
|
||||
MemorySnapshotMac::MemorySnapshotMac()
|
||||
: MemorySnapshot(),
|
||||
process_reader_(NULL),
|
||||
process_reader_(nullptr),
|
||||
address_(0),
|
||||
size_(0),
|
||||
initialized_() {
|
||||
|
@ -104,7 +104,7 @@ class ProcessSnapshot {
|
||||
//! \return An ExceptionSnapshot object. The caller does not take ownership of
|
||||
//! this object, it is scoped to the lifetime of the ProcessSnapshot
|
||||
//! object that it was obtained from. If the snapshot is not a result of
|
||||
//! an exception, returns `NULL`.
|
||||
//! an exception, returns `nullptr`.
|
||||
virtual const ExceptionSnapshot* Exception() const = 0;
|
||||
|
||||
protected:
|
||||
|
@ -35,7 +35,7 @@ template <typename T>
|
||||
T ReadIntSysctlByName(const char* name, T default_value) {
|
||||
T value;
|
||||
size_t value_len = sizeof(value);
|
||||
if (sysctlbyname(name, &value, &value_len, NULL, 0) != 0) {
|
||||
if (sysctlbyname(name, &value, &value_len, nullptr, 0) != 0) {
|
||||
PLOG(WARNING) << "sysctlbyname " << name;
|
||||
return default_value;
|
||||
}
|
||||
@ -51,7 +51,7 @@ T CastIntSysctlByName(const char* name, T default_value) {
|
||||
|
||||
std::string ReadStringSysctlByName(const char* name) {
|
||||
size_t buf_len;
|
||||
if (sysctlbyname(name, NULL, &buf_len, NULL, 0) != 0) {
|
||||
if (sysctlbyname(name, nullptr, &buf_len, nullptr, 0) != 0) {
|
||||
PLOG(WARNING) << "sysctlbyname (size) " << name;
|
||||
return std::string();
|
||||
}
|
||||
@ -61,7 +61,7 @@ std::string ReadStringSysctlByName(const char* name) {
|
||||
}
|
||||
|
||||
std::string value(buf_len - 1, '\0');
|
||||
if (sysctlbyname(name, &value[0], &buf_len, NULL, 0) != 0) {
|
||||
if (sysctlbyname(name, &value[0], &buf_len, nullptr, 0) != 0) {
|
||||
PLOG(WARNING) << "sysctlbyname " << name;
|
||||
return std::string();
|
||||
}
|
||||
@ -89,8 +89,8 @@ SystemSnapshotMac::SystemSnapshotMac()
|
||||
: SystemSnapshot(),
|
||||
os_version_full_(),
|
||||
os_version_build_(),
|
||||
process_reader_(NULL),
|
||||
snapshot_time_(NULL),
|
||||
process_reader_(nullptr),
|
||||
snapshot_time_(nullptr),
|
||||
os_version_major_(0),
|
||||
os_version_minor_(0),
|
||||
os_version_bugfix_(0),
|
||||
|
@ -50,7 +50,7 @@ class SystemSnapshotMacTest : public testing::Test {
|
||||
// testing::Test:
|
||||
virtual void SetUp() override {
|
||||
ASSERT_TRUE(process_reader_.Initialize(mach_task_self()));
|
||||
ASSERT_EQ(0, gettimeofday(&snapshot_time_, NULL))
|
||||
ASSERT_EQ(0, gettimeofday(&snapshot_time_, nullptr))
|
||||
<< ErrnoMessage("gettimeofday");
|
||||
system_snapshot_.Initialize(&process_reader_, &snapshot_time_);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ bool ThreadSnapshotMac::Initialize(
|
||||
context_.x86_64 = &context_union_.x86_64;
|
||||
InitializeCPUContextX86_64(context_.x86_64,
|
||||
THREAD_STATE_NONE,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
&process_reader_thread.thread_context.t64,
|
||||
&process_reader_thread.float_context.f64,
|
||||
@ -69,7 +69,7 @@ bool ThreadSnapshotMac::Initialize(
|
||||
context_.x86 = &context_union_.x86;
|
||||
InitializeCPUContextX86(context_.x86,
|
||||
THREAD_STATE_NONE,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
&process_reader_thread.thread_context.t32,
|
||||
&process_reader_thread.float_context.f32,
|
||||
|
@ -200,18 +200,18 @@ int CatchExceptionToolMain(int argc, char* argv[]) {
|
||||
Options options = {};
|
||||
|
||||
const struct option long_options[] = {
|
||||
{"file", required_argument, NULL, kOptionFile},
|
||||
{"mach_service", required_argument, NULL, kOptionMachService},
|
||||
{"nonblocking", no_argument, NULL, kOptionNonblocking},
|
||||
{"persistent", no_argument, NULL, kOptionPersistent},
|
||||
{"timeout", required_argument, NULL, kOptionTimeout},
|
||||
{"help", no_argument, NULL, kOptionHelp},
|
||||
{"version", no_argument, NULL, kOptionVersion},
|
||||
{NULL, 0, NULL, 0},
|
||||
{"file", required_argument, nullptr, kOptionFile},
|
||||
{"mach_service", required_argument, nullptr, kOptionMachService},
|
||||
{"nonblocking", no_argument, nullptr, kOptionNonblocking},
|
||||
{"persistent", no_argument, nullptr, kOptionPersistent},
|
||||
{"timeout", required_argument, nullptr, kOptionTimeout},
|
||||
{"help", no_argument, nullptr, kOptionHelp},
|
||||
{"version", no_argument, nullptr, kOptionVersion},
|
||||
{nullptr, 0, nullptr, 0},
|
||||
};
|
||||
|
||||
int opt;
|
||||
while ((opt = getopt_long(argc, argv, "f:m:npt:", long_options, NULL)) !=
|
||||
while ((opt = getopt_long(argc, argv, "f:m:npt:", long_options, nullptr)) !=
|
||||
-1) {
|
||||
switch (opt) {
|
||||
case kOptionFile:
|
||||
@ -240,7 +240,7 @@ int CatchExceptionToolMain(int argc, char* argv[]) {
|
||||
ToolSupport::Version(me);
|
||||
return EXIT_SUCCESS;
|
||||
default:
|
||||
ToolSupport::UsageHint(me, NULL);
|
||||
ToolSupport::UsageHint(me, nullptr);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ bool ParseHandlerString(const char* handler_string_ro,
|
||||
char* handler_string_c = &handler_string[0];
|
||||
|
||||
char* token;
|
||||
while ((token = strsep(&handler_string_c, ",")) != NULL) {
|
||||
while ((token = strsep(&handler_string_c, ",")) != nullptr) {
|
||||
if (strncmp(token, kTargetEquals, strlen(kTargetEquals)) == 0) {
|
||||
const char* value = token + strlen(kTargetEquals);
|
||||
if (strcmp(value, "host") == 0) {
|
||||
@ -402,23 +402,23 @@ int ExceptionPortToolMain(int argc, char* argv[]) {
|
||||
} options = {};
|
||||
|
||||
const struct option long_options[] = {
|
||||
{"set_handler", required_argument, NULL, kOptionSetPort},
|
||||
{"show_bootstrap", required_argument, NULL, kOptionShowBootstrap},
|
||||
{"pid", required_argument, NULL, kOptionPid},
|
||||
{"show_host", no_argument, NULL, kOptionShowHost},
|
||||
{"show_task", no_argument, NULL, kOptionShowTask},
|
||||
{"show_thread", no_argument, NULL, kOptionShowThread},
|
||||
{"show_new_host", no_argument, NULL, kOptionShowNewHost},
|
||||
{"show_new_task", no_argument, NULL, kOptionShowNewTask},
|
||||
{"show_new_thread", no_argument, NULL, kOptionShowNewThread},
|
||||
{"numeric", no_argument, NULL, kOptionNumeric},
|
||||
{"help", no_argument, NULL, kOptionHelp},
|
||||
{"version", no_argument, NULL, kOptionVersion},
|
||||
{NULL, 0, NULL, 0},
|
||||
{"set_handler", required_argument, nullptr, kOptionSetPort},
|
||||
{"show_bootstrap", required_argument, nullptr, kOptionShowBootstrap},
|
||||
{"pid", required_argument, nullptr, kOptionPid},
|
||||
{"show_host", no_argument, nullptr, kOptionShowHost},
|
||||
{"show_task", no_argument, nullptr, kOptionShowTask},
|
||||
{"show_thread", no_argument, nullptr, kOptionShowThread},
|
||||
{"show_new_host", no_argument, nullptr, kOptionShowNewHost},
|
||||
{"show_new_task", no_argument, nullptr, kOptionShowNewTask},
|
||||
{"show_new_thread", no_argument, nullptr, kOptionShowNewThread},
|
||||
{"numeric", no_argument, nullptr, kOptionNumeric},
|
||||
{"help", no_argument, nullptr, kOptionHelp},
|
||||
{"version", no_argument, nullptr, kOptionVersion},
|
||||
{nullptr, 0, nullptr, 0},
|
||||
};
|
||||
|
||||
int opt;
|
||||
while ((opt = getopt_long(argc, argv, "+s:p:htHTn", long_options, NULL)) !=
|
||||
while ((opt = getopt_long(argc, argv, "+s:p:htHTn", long_options, nullptr)) !=
|
||||
-1) {
|
||||
switch (opt) {
|
||||
case kOptionSetPort: {
|
||||
@ -475,7 +475,7 @@ int ExceptionPortToolMain(int argc, char* argv[]) {
|
||||
ToolSupport::Version(me);
|
||||
return kExitSuccess;
|
||||
default:
|
||||
ToolSupport::UsageHint(me, NULL);
|
||||
ToolSupport::UsageHint(me, nullptr);
|
||||
return kExitFailure;
|
||||
}
|
||||
}
|
||||
|
@ -82,17 +82,18 @@ int OnDemandServiceToolMain(int argc, char* argv[]) {
|
||||
} options = {};
|
||||
|
||||
const struct option long_options[] = {
|
||||
{"load", no_argument, NULL, kOptionLoadJob},
|
||||
{"unload", no_argument, NULL, kOptionUnloadJob},
|
||||
{"label", required_argument, NULL, kOptionJobLabel},
|
||||
{"mach_service", required_argument, NULL, kOptionMachService},
|
||||
{"help", no_argument, NULL, kOptionHelp},
|
||||
{"version", no_argument, NULL, kOptionVersion},
|
||||
{NULL, 0, NULL, 0},
|
||||
{"load", no_argument, nullptr, kOptionLoadJob},
|
||||
{"unload", no_argument, nullptr, kOptionUnloadJob},
|
||||
{"label", required_argument, nullptr, kOptionJobLabel},
|
||||
{"mach_service", required_argument, nullptr, kOptionMachService},
|
||||
{"help", no_argument, nullptr, kOptionHelp},
|
||||
{"version", no_argument, nullptr, kOptionVersion},
|
||||
{nullptr, 0, nullptr, 0},
|
||||
};
|
||||
|
||||
int opt;
|
||||
while ((opt = getopt_long(argc, argv, "+LUl:m:", long_options, NULL)) != -1) {
|
||||
while ((opt = getopt_long(argc, argv, "+LUl:m:", long_options, nullptr)) !=
|
||||
-1) {
|
||||
switch (opt) {
|
||||
case kOptionLoadJob:
|
||||
options.operation = kOperationLoadJob;
|
||||
@ -113,7 +114,7 @@ int OnDemandServiceToolMain(int argc, char* argv[]) {
|
||||
ToolSupport::Version(me);
|
||||
return EXIT_SUCCESS;
|
||||
default:
|
||||
ToolSupport::UsageHint(me, NULL);
|
||||
ToolSupport::UsageHint(me, nullptr);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace crashpad {
|
||||
//! \param[in] property_cf The Core Foundation-type property list to convert.
|
||||
//!
|
||||
//! \return The converted launchd-type `launch_data_t`. The caller takes
|
||||
//! ownership of the returned value. On error, returns `NULL`.
|
||||
//! ownership of the returned value. On error, returns `nullptr`.
|
||||
//!
|
||||
//! \note This function handles all `CFPropertyListRef` types except for
|
||||
//! `CFDateRef`, because there’s no `launch_data_type_t` analogue. Not all
|
||||
|
@ -29,7 +29,7 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) {
|
||||
// list elements according to which is more convenient and correct for any
|
||||
// specific task.
|
||||
|
||||
launch_data_t data_launch = NULL;
|
||||
launch_data_t data_launch = nullptr;
|
||||
CFTypeID type_id_cf = CFGetTypeID(property_cf);
|
||||
|
||||
if (type_id_cf == CFDictionaryGetTypeID()) {
|
||||
@ -40,14 +40,14 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) {
|
||||
|
||||
for (NSString* key in dictionary_ns) {
|
||||
if (![key isKindOfClass:[NSString class]]) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CFPropertyListRef value_cf =
|
||||
static_cast<CFPropertyListRef>([dictionary_ns objectForKey:key]);
|
||||
launch_data_t value_launch = CFPropertyToLaunchData(value_cf);
|
||||
if (!value_launch) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
launch_data_dict_insert(
|
||||
@ -68,7 +68,7 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) {
|
||||
static_cast<CFPropertyListRef>(element_ns);
|
||||
launch_data_t element_launch = CFPropertyToLaunchData(element_cf);
|
||||
if (!element_launch) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
launch_data_array_set_index(array_launch, element_launch, index++);
|
||||
@ -103,7 +103,7 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) {
|
||||
break;
|
||||
}
|
||||
|
||||
default: { return NULL; }
|
||||
default: { return nullptr; }
|
||||
}
|
||||
|
||||
} else if (type_id_cf == CFBooleanGetTypeID()) {
|
||||
|
@ -99,14 +99,14 @@ CFDictionaryRef TryCFCopySystemVersionDictionary() {
|
||||
if (_CFCopySystemVersionDictionary) {
|
||||
return _CFCopySystemVersionDictionary();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CFDictionaryRef TryCFCopyServerVersionDictionary() {
|
||||
if (_CFCopyServerVersionDictionary) {
|
||||
return _CFCopyServerVersionDictionary();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const void* TryCFDictionaryGetValue(CFDictionaryRef dictionary,
|
||||
@ -114,7 +114,7 @@ const void* TryCFDictionaryGetValue(CFDictionaryRef dictionary,
|
||||
if (value) {
|
||||
return CFDictionaryGetValue(dictionary, value);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Converts |version| to a triplet of version numbers on behalf of
|
||||
|
@ -32,7 +32,7 @@ int MacOSXMinorVersion();
|
||||
|
||||
//! \brief Returns the version of the running operating system.
|
||||
//!
|
||||
//! All parameters are required. No parameter may be `NULL`.
|
||||
//! All parameters are required. No parameter may be `nullptr`.
|
||||
//!
|
||||
//! \param[out] major The major version of the operating system, such as `10`
|
||||
//! for Mac OS X 10.9.2.
|
||||
|
@ -50,7 +50,7 @@ MachOImageReader::MachOImageReader()
|
||||
dysymtab_command_(),
|
||||
symbol_table_(),
|
||||
id_dylib_command_(),
|
||||
process_reader_(NULL),
|
||||
process_reader_(nullptr),
|
||||
file_type_(0),
|
||||
initialized_(),
|
||||
symbol_table_initialized_() {
|
||||
@ -301,7 +301,7 @@ const MachOImageSegmentReader* MachOImageReader::GetSegmentByName(
|
||||
|
||||
const auto& iterator = segment_map_.find(segment_name);
|
||||
if (iterator == segment_map_.end()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const MachOImageSegmentReader* segment = segments_[iterator->second];
|
||||
@ -316,7 +316,7 @@ const process_types::section* MachOImageReader::GetSectionByName(
|
||||
|
||||
const MachOImageSegmentReader* segment = GetSegmentByName(segment_name);
|
||||
if (!segment) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return segment->GetSectionByName(section_name, address);
|
||||
@ -331,7 +331,7 @@ const process_types::section* MachOImageReader::GetSectionAtIndex(
|
||||
static_assert(NO_SECT == 0, "NO_SECT must be zero");
|
||||
if (index == NO_SECT) {
|
||||
LOG(WARNING) << "section index " << index << " out of range";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Switch to a more comfortable 0-based index.
|
||||
@ -354,7 +354,7 @@ const process_types::section* MachOImageReader::GetSectionAtIndex(
|
||||
}
|
||||
|
||||
LOG(WARNING) << "section index " << index << " out of range";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool MachOImageReader::LookUpExternalDefinedSymbol(
|
||||
|
@ -108,10 +108,10 @@ class MachOImageReader {
|
||||
//! \param[in] segment_name The name of the segment to search for, for
|
||||
//! example, `"__TEXT"`.
|
||||
//!
|
||||
//! \return A pointer to the segment information if it was found, or `NULL` if
|
||||
//! it was not found. The caller does not take ownership; the lifetime of
|
||||
//! the returned object is scoped to the lifetime of this MachOImageReader
|
||||
//! object.
|
||||
//! \return A pointer to the segment information if it was found, or `nullptr`
|
||||
//! if it was not found. The caller does not take ownership; the lifetime
|
||||
//! of the returned object is scoped to the lifetime of this
|
||||
//! MachOImageReader object.
|
||||
const MachOImageSegmentReader* GetSegmentByName(
|
||||
const std::string& segment_name) const;
|
||||
|
||||
@ -124,12 +124,12 @@ class MachOImageReader {
|
||||
//! \param[out] address The actual address that the section was loaded at in
|
||||
//! memory, taking any “slide” into account if the section did not load at
|
||||
//! its preferred address as stored in the Mach-O image file. This
|
||||
//! parameter can be `NULL`.
|
||||
//! parameter can be `nullptr`.
|
||||
//!
|
||||
//! \return A pointer to the section information if it was found, or `NULL` if
|
||||
//! it was not found. The caller does not take ownership; the lifetime of
|
||||
//! the returned object is scoped to the lifetime of this MachOImageReader
|
||||
//! object.
|
||||
//! \return A pointer to the section information if it was found, or `nullptr`
|
||||
//! if it was not found. The caller does not take ownership; the lifetime
|
||||
//! of the returned object is scoped to the lifetime of this
|
||||
//! MachOImageReader object.
|
||||
//!
|
||||
//! No parameter is provided for the section’s size, because it can be
|
||||
//! obtained from the returned process_types::section::size field.
|
||||
@ -149,18 +149,18 @@ class MachOImageReader {
|
||||
//! appears in the segment load commands. This is a 1-based index,
|
||||
//! matching the section number values used for `nlist::n_sect`.
|
||||
//! \param[out] containing_segment The segment that contains the section.
|
||||
//! This parameter can be `NULL`. The caller does not take ownership;
|
||||
//! This parameter can be `nullptr`. The caller does not take ownership;
|
||||
//! the lifetime of the returned object is scoped to the lifetime of this
|
||||
//! MachOImageReader object.
|
||||
//! \param[out] address The actual address that the section was loaded at in
|
||||
//! memory, taking any “slide” into account if the section did not load at
|
||||
//! its preferred address as stored in the Mach-O image file. This
|
||||
//! parameter can be `NULL`.
|
||||
//! parameter can be `nullptr`.
|
||||
//!
|
||||
//! \return A pointer to the section information. If \a index is out of range,
|
||||
//! logs a warning and returns `NULL`. The caller does not take ownership;
|
||||
//! the lifetime of the returned object is scoped to the lifetime of this
|
||||
//! MachOImageReader object.
|
||||
//! logs a warning and returns `nullptr`. The caller does not take
|
||||
//! ownership; the lifetime of the returned object is scoped to the
|
||||
//! lifetime of this MachOImageReader object.
|
||||
//!
|
||||
//! No parameter is provided for the section’s size, because it can be
|
||||
//! obtained from the returned process_types::section::size field.
|
||||
@ -170,12 +170,13 @@ class MachOImageReader {
|
||||
//! for any “slide” that may have occurred when the image was loaded. Use
|
||||
//! \a address to obtain the section’s actual load address.
|
||||
//! \note Unlike MachOImageSegmentReader::GetSectionAtIndex(), this method
|
||||
//! accepts out-of-range values for \a index, and returns `NULL` instead
|
||||
//! of aborting execution upon encountering an out-of-range value. This is
|
||||
//! because a Mach-O image file’s symbol table refers to this per-module
|
||||
//! section index, and an out-of-range index in that case should be
|
||||
//! treated as a data error (where the data is beyond this code’s control)
|
||||
//! and handled non-fatally by reporting the error to the caller.
|
||||
//! accepts out-of-range values for \a index, and returns `nullptr`
|
||||
//! instead of aborting execution upon encountering an out-of-range value.
|
||||
//! This is because a Mach-O image file’s symbol table refers to this
|
||||
//! per-module section index, and an out-of-range index in that case
|
||||
//! should be treated as a data error (where the data is beyond this
|
||||
//! code’s control) and handled non-fatally by reporting the error to the
|
||||
//! caller.
|
||||
const process_types::section* GetSectionAtIndex(
|
||||
size_t index,
|
||||
const MachOImageSegmentReader** containing_segment,
|
||||
@ -301,7 +302,7 @@ class MachOImageReader {
|
||||
// be logged.
|
||||
//
|
||||
// Note that if the object contains no symbol table, symbol_table_initialized_
|
||||
// will be set to the valid state, but symbol_table_ will be NULL.
|
||||
// will be set to the valid state, but symbol_table_ will be nullptr.
|
||||
void InitializeSymbolTable() const;
|
||||
|
||||
PointerVector<MachOImageSegmentReader> segments_;
|
||||
|
@ -159,7 +159,7 @@ void ExpectSegmentCommand(const SegmentCommand* expect_segment,
|
||||
for (size_t index = 0; index < actual_segment->nsects(); ++index) {
|
||||
const Section* expect_section = &expect_sections[index];
|
||||
const process_types::section* actual_section =
|
||||
actual_segment->GetSectionAtIndex(index, NULL);
|
||||
actual_segment->GetSectionAtIndex(index, nullptr);
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
ExpectSection(&expect_sections[index], actual_section));
|
||||
|
||||
@ -167,7 +167,7 @@ void ExpectSegmentCommand(const SegmentCommand* expect_segment,
|
||||
std::string section_name =
|
||||
MachOImageSegmentReader::SectionNameString(expect_section->sectname);
|
||||
const process_types::section* actual_section_by_name =
|
||||
actual_segment->GetSectionByName(section_name, NULL);
|
||||
actual_segment->GetSectionByName(section_name, nullptr);
|
||||
EXPECT_EQ(actual_section, actual_section_by_name);
|
||||
|
||||
// Make sure that the section is accessible by the parent MachOImageReader’s
|
||||
@ -207,7 +207,8 @@ void ExpectSegmentCommand(const SegmentCommand* expect_segment,
|
||||
EXPECT_EQ(actual_section_address, actual_section_address_at_index);
|
||||
}
|
||||
|
||||
EXPECT_EQ(NULL, actual_segment->GetSectionByName("NoSuchSection", NULL));
|
||||
EXPECT_EQ(nullptr,
|
||||
actual_segment->GetSectionByName("NoSuchSection", nullptr));
|
||||
}
|
||||
|
||||
// Walks through the load commands of |expect_image|, finding all of the
|
||||
@ -258,21 +259,23 @@ void ExpectSegmentCommands(const MachHeader* expect_image,
|
||||
if (test_section_index_bounds) {
|
||||
// GetSectionAtIndex uses a 1-based index. Make sure that the range is
|
||||
// correct.
|
||||
EXPECT_EQ(NULL, actual_image->GetSectionAtIndex(0, NULL, NULL));
|
||||
EXPECT_EQ(NULL,
|
||||
actual_image->GetSectionAtIndex(section_index + 1, NULL, NULL));
|
||||
EXPECT_EQ(nullptr, actual_image->GetSectionAtIndex(0, nullptr, nullptr));
|
||||
EXPECT_EQ(
|
||||
nullptr,
|
||||
actual_image->GetSectionAtIndex(section_index + 1, nullptr, nullptr));
|
||||
}
|
||||
|
||||
// Make sure that by-name lookups for names that don’t exist work properly:
|
||||
// they should return NULL.
|
||||
// they should return nullptr.
|
||||
EXPECT_FALSE(actual_image->GetSegmentByName("NoSuchSegment"));
|
||||
EXPECT_FALSE(
|
||||
actual_image->GetSectionByName("NoSuchSegment", "NoSuchSection", NULL));
|
||||
EXPECT_FALSE(actual_image->GetSectionByName(
|
||||
"NoSuchSegment", "NoSuchSection", nullptr));
|
||||
|
||||
// Make sure that there’s a __TEXT segment so that this can do a valid test of
|
||||
// a section that doesn’t exist within a segment that does.
|
||||
EXPECT_TRUE(actual_image->GetSegmentByName(SEG_TEXT));
|
||||
EXPECT_FALSE(actual_image->GetSectionByName(SEG_TEXT, "NoSuchSection", NULL));
|
||||
EXPECT_FALSE(
|
||||
actual_image->GetSectionByName(SEG_TEXT, "NoSuchSection", nullptr));
|
||||
|
||||
// Similarly, make sure that a section name that exists in one segment isn’t
|
||||
// accidentally found during a lookup for that section in a different segment.
|
||||
@ -284,7 +287,7 @@ void ExpectSegmentCommands(const MachHeader* expect_image,
|
||||
std::string test_section = SECT_TEXT;
|
||||
|
||||
const process_types::section* section =
|
||||
actual_image->GetSectionAtIndex(1, NULL, NULL);
|
||||
actual_image->GetSectionAtIndex(1, nullptr, nullptr);
|
||||
if (section) {
|
||||
// Use the name of the first section in the image as the section that
|
||||
// shouldn’t appear in a different segment. If the first section is in the
|
||||
@ -303,17 +306,18 @@ void ExpectSegmentCommands(const MachHeader* expect_image,
|
||||
// It should be possible to look up the first section by name.
|
||||
EXPECT_EQ(section,
|
||||
actual_image->GetSectionByName(
|
||||
section->segname, section->sectname, NULL));
|
||||
section->segname, section->sectname, nullptr));
|
||||
}
|
||||
EXPECT_FALSE(
|
||||
actual_image->GetSectionByName("NoSuchSegment", test_section, NULL));
|
||||
actual_image->GetSectionByName("NoSuchSegment", test_section, nullptr));
|
||||
EXPECT_FALSE(
|
||||
actual_image->GetSectionByName(test_segment, test_section, NULL));
|
||||
actual_image->GetSectionByName(test_segment, test_section, nullptr));
|
||||
|
||||
// The __LINKEDIT segment normally does exist but doesn’t have any sections.
|
||||
EXPECT_FALSE(
|
||||
actual_image->GetSectionByName(SEG_LINKEDIT, "NoSuchSection", NULL));
|
||||
EXPECT_FALSE(actual_image->GetSectionByName(SEG_LINKEDIT, SECT_TEXT, NULL));
|
||||
actual_image->GetSectionByName(SEG_LINKEDIT, "NoSuchSection", nullptr));
|
||||
EXPECT_FALSE(
|
||||
actual_image->GetSectionByName(SEG_LINKEDIT, SECT_TEXT, nullptr));
|
||||
}
|
||||
|
||||
// In some cases, the expected slide value for an image is unknown, because no
|
||||
@ -443,8 +447,8 @@ void ExpectSymbolTable(const MachHeader* expect_image,
|
||||
// to expose bugs in that optimization rather than duplicate them.
|
||||
const char* commands_base = reinterpret_cast<const char*>(&expect_image[1]);
|
||||
uint32_t position = 0;
|
||||
const symtab_command* symtab = NULL;
|
||||
const SegmentCommand* linkedit = NULL;
|
||||
const symtab_command* symtab = nullptr;
|
||||
const SegmentCommand* linkedit = nullptr;
|
||||
for (uint32_t index = 0; index < expect_image->ncmds; ++index) {
|
||||
ASSERT_LT(position, expect_image->sizeofcmds);
|
||||
const load_command* command =
|
||||
@ -498,7 +502,7 @@ TEST(MachOImageReader, Self_MainExecutable) {
|
||||
|
||||
const MachHeader* mh_execute_header =
|
||||
reinterpret_cast<MachHeader*>(dlsym(RTLD_MAIN_ONLY, MH_EXECUTE_SYM));
|
||||
ASSERT_NE(static_cast<void*>(NULL), mh_execute_header);
|
||||
ASSERT_NE(nullptr, mh_execute_header);
|
||||
mach_vm_address_t mh_execute_header_address =
|
||||
reinterpret_cast<mach_vm_address_t>(mh_execute_header);
|
||||
|
||||
|
@ -199,7 +199,7 @@ const process_types::section* MachOImageSegmentReader::GetSectionByName(
|
||||
|
||||
const auto& iterator = section_map_.find(section_name);
|
||||
if (iterator == section_map_.end()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return GetSectionAtIndex(iterator->second, address);
|
||||
|
@ -141,11 +141,11 @@ class MachOImageSegmentReader {
|
||||
//! \param[out] address The actual address that the section was loaded at in
|
||||
//! memory, taking any “slide” into account if the section did not load at
|
||||
//! its preferred address as stored in the Mach-O image file. This
|
||||
//! parameter can be `NULL`.
|
||||
//! parameter can be `nullptr`.
|
||||
//!
|
||||
//! \return A pointer to the section information if it was found, or `NULL` if
|
||||
//! it was not found. The caller does not take ownership; the lifetime of
|
||||
//! the returned object is scoped to the lifetime of this
|
||||
//! \return A pointer to the section information if it was found, or `nullptr`
|
||||
//! if it was not found. The caller does not take ownership; the lifetime
|
||||
//! of the returned object is scoped to the lifetime of this
|
||||
//! MachOImageSegmentReader object.
|
||||
//!
|
||||
//! \note The process_types::section::addr field gives the section’s preferred
|
||||
@ -167,7 +167,7 @@ class MachOImageSegmentReader {
|
||||
//! \param[out] address The actual address that the section was loaded at in
|
||||
//! memory, taking any “slide” into account if the section did not load at
|
||||
//! its preferred address as stored in the Mach-O image file. This
|
||||
//! parameter can be `NULL`.
|
||||
//! parameter can be `nullptr`.
|
||||
//!
|
||||
//! \return A pointer to the section information. If \a index is out of range,
|
||||
//! execution is aborted. The caller does not take ownership; the
|
||||
@ -179,8 +179,8 @@ class MachOImageSegmentReader {
|
||||
//! for any “slide” that may have occurred when the image was loaded.
|
||||
//! \note Unlike MachOImageReader::GetSectionAtIndex(), this method does not
|
||||
//! accept out-of-range values for \a index, and aborts execution instead
|
||||
//! of returning `NULL` upon encountering an out-of-range value. This is
|
||||
//! because this method is expected to be used in a loop that can be
|
||||
//! of returning `nullptr` upon encountering an out-of-range value. This
|
||||
//! is because this method is expected to be used in a loop that can be
|
||||
//! limited to nsects() iterations, so an out-of-range error can be
|
||||
//! treated more harshly as a logic error, as opposed to a data error.
|
||||
//!
|
||||
|
@ -266,7 +266,7 @@ MachOImageSymbolTableReader::LookUpExternalDefinedSymbol(
|
||||
|
||||
const auto& iterator = external_defined_symbols_.find(name);
|
||||
if (iterator == external_defined_symbols_.end()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return &iterator->second;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class MachOImageSymbolTableReader {
|
||||
//! the symbol table.
|
||||
//! \param[in] dysymtab_command The `LC_DYSYMTAB` load command that identifies
|
||||
//! dynamic symbol information within the symbol table. This load command
|
||||
//! is not present in all modules, and this parameter may be `NULL` for
|
||||
//! is not present in all modules, and this parameter may be `nullptr` for
|
||||
//! modules that do not have this information. When present, \a
|
||||
//! dysymtab_command is an optimization that allows the symbol table
|
||||
//! reader to only examine symbol table entries known to be relevant for
|
||||
@ -112,7 +112,7 @@ class MachOImageSymbolTableReader {
|
||||
//! the symbol for the C++ `Func()` function.
|
||||
//!
|
||||
//! \return A SymbolInformation* object with information about the symbol if
|
||||
//! it was found, or `NULL` if the symbol was not found or if an error
|
||||
//! it was found, or `nullptr` if the symbol was not found or if an error
|
||||
//! occurred. On error, a warning message will also be logged. The caller
|
||||
//! does not take ownership; the lifetime of the returned object is scoped
|
||||
//! to the lifetime of this MachOImageSymbolTableReader object.
|
||||
|
@ -83,7 +83,7 @@ ProcessReader::Thread::Thread()
|
||||
priority(0) {
|
||||
}
|
||||
|
||||
ProcessReader::Module::Module() : name(), reader(NULL), timestamp(0) {
|
||||
ProcessReader::Module::Module() : name(), reader(nullptr), timestamp(0) {
|
||||
}
|
||||
|
||||
ProcessReader::Module::~Module() {
|
||||
@ -121,7 +121,7 @@ bool ProcessReader::Initialize(task_t task) {
|
||||
|
||||
int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid};
|
||||
size_t len = sizeof(kern_proc_info_);
|
||||
if (sysctl(mib, arraysize(mib), &kern_proc_info_, &len, NULL, 0) != 0) {
|
||||
if (sysctl(mib, arraysize(mib), &kern_proc_info_, &len, nullptr, 0) != 0) {
|
||||
PLOG(ERROR) << "sysctl for pid " << pid;
|
||||
return false;
|
||||
}
|
||||
@ -395,8 +395,8 @@ void ProcessReader::InitializeModules() {
|
||||
|
||||
// Note that all_image_infos.infoArrayCount may be 0 if a crash occurred while
|
||||
// dyld was loading the executable. This can happen if a required dynamic
|
||||
// library was not found. Similarly, all_image_infos.infoArray may be NULL if
|
||||
// a crash occurred while dyld was updating it.
|
||||
// library was not found. Similarly, all_image_infos.infoArray may be nullptr
|
||||
// if a crash occurred while dyld was updating it.
|
||||
//
|
||||
// TODO(mark): It may be possible to recover from these situations by looking
|
||||
// through memory mappings for Mach-O images.
|
||||
@ -405,7 +405,7 @@ void ProcessReader::InitializeModules() {
|
||||
return;
|
||||
}
|
||||
if (!all_image_infos.infoArray) {
|
||||
LOG(WARNING) << "all_image_infos.infoArray is NULL";
|
||||
LOG(WARNING) << "all_image_infos.infoArray is nullptr";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ class TestThreadPool {
|
||||
}
|
||||
|
||||
for (const ThreadInfo* thread_info : thread_infos_) {
|
||||
int rv = pthread_join(thread_info->pthread, NULL);
|
||||
int rv = pthread_join(thread_info->pthread, nullptr);
|
||||
CHECK_EQ(0, rv);
|
||||
}
|
||||
}
|
||||
@ -190,7 +190,7 @@ class TestThreadPool {
|
||||
thread_infos_.push_back(thread_info);
|
||||
|
||||
int rv = pthread_create(&thread_info->pthread,
|
||||
NULL,
|
||||
nullptr,
|
||||
ThreadMain,
|
||||
thread_info);
|
||||
ASSERT_EQ(0, rv);
|
||||
@ -233,7 +233,7 @@ class TestThreadPool {
|
||||
private:
|
||||
struct ThreadInfo {
|
||||
ThreadInfo()
|
||||
: pthread(NULL),
|
||||
: pthread(nullptr),
|
||||
stack_address(0),
|
||||
ready_semaphore(0),
|
||||
exit_semaphore(0),
|
||||
@ -279,7 +279,7 @@ class TestThreadPool {
|
||||
// it.
|
||||
CHECK_EQ(pthread_self(), thread_info->pthread);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// This is a PointerVector because the address of a ThreadInfo object is
|
||||
|
@ -31,7 +31,7 @@ launch_data_t LaunchDataDictionaryForJob(const std::string& label) {
|
||||
|
||||
base::mac::ScopedLaunchData response(launch_msg(request));
|
||||
if (launch_data_get_type(response) != LAUNCH_DATA_DICTIONARY) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return response.release();
|
||||
|
@ -42,7 +42,7 @@ kern_return_t UniversalExceptionRaise(exception_behavior_t behavior,
|
||||
// needed.
|
||||
|
||||
std::vector<exception_data_type_t> small_code_vector;
|
||||
exception_data_t small_code = NULL;
|
||||
exception_data_t small_code = nullptr;
|
||||
if ((behavior & MACH_EXCEPTION_CODES) == 0 && code_count) {
|
||||
small_code_vector.reserve(code_count);
|
||||
for (size_t code_index = 0; code_index < code_count; ++code_index) {
|
||||
|
@ -51,7 +51,7 @@ namespace crashpad {
|
||||
//! message will carry thread state information, when it has the value
|
||||
//! `EXCEPTION_STATE` or `EXCEPTION_STATE_IDENTITY`, possibly with
|
||||
//! `MACH_EXCEPTION_CODES` also set. In other cases, these parameters are unused
|
||||
//! and may be set to `0` (\a old_state_count) or `NULL` (the remaining
|
||||
//! and may be set to `0` (\a old_state_count) or `nullptr` (the remaining
|
||||
//! parameters).
|
||||
//!
|
||||
//! \param[in] behavior The exception behavior, which dictates which function
|
||||
|
@ -100,10 +100,10 @@ class TestExcClientVariants : public UniversalMachExcServer,
|
||||
if (HasState()) {
|
||||
EXPECT_EQ(exception_ + 10, *flavor);
|
||||
EXPECT_EQ(MACHINE_THREAD_STATE_COUNT, old_state_count);
|
||||
EXPECT_NE(static_cast<const natural_t*>(NULL), old_state);
|
||||
EXPECT_NE(nullptr, old_state);
|
||||
EXPECT_EQ(static_cast<mach_msg_type_number_t>(THREAD_STATE_MAX),
|
||||
*new_state_count);
|
||||
EXPECT_NE(static_cast<natural_t*>(NULL), new_state);
|
||||
EXPECT_NE(nullptr, new_state);
|
||||
|
||||
for (size_t index = 0; index < old_state_count; ++index) {
|
||||
EXPECT_EQ(index, old_state[index]);
|
||||
@ -122,9 +122,9 @@ class TestExcClientVariants : public UniversalMachExcServer,
|
||||
} else {
|
||||
EXPECT_EQ(THREAD_STATE_NONE, *flavor);
|
||||
EXPECT_EQ(0u, old_state_count);
|
||||
EXPECT_EQ(NULL, old_state);
|
||||
EXPECT_EQ(nullptr, old_state);
|
||||
EXPECT_EQ(0u, *new_state_count);
|
||||
EXPECT_EQ(NULL, new_state);
|
||||
EXPECT_EQ(nullptr, new_state);
|
||||
}
|
||||
|
||||
return KERN_SUCCESS;
|
||||
@ -161,14 +161,14 @@ class TestExcClientVariants : public UniversalMachExcServer,
|
||||
}
|
||||
|
||||
thread_state_flavor_t flavor;
|
||||
thread_state_flavor_t* flavor_p = NULL;
|
||||
thread_state_flavor_t* flavor_p = nullptr;
|
||||
natural_t old_state[MACHINE_THREAD_STATE_COUNT];
|
||||
thread_state_t old_state_p = NULL;
|
||||
thread_state_t old_state_p = nullptr;
|
||||
mach_msg_type_number_t old_state_count = 0;
|
||||
natural_t new_state[THREAD_STATE_MAX];
|
||||
thread_state_t new_state_p = NULL;
|
||||
thread_state_t new_state_p = nullptr;
|
||||
mach_msg_type_number_t new_state_count;
|
||||
mach_msg_type_number_t* new_state_count_p = NULL;
|
||||
mach_msg_type_number_t* new_state_count_p = nullptr;
|
||||
if (all_fields_ || HasState()) {
|
||||
// Pick a different flavor each time based on the value of exception_.
|
||||
// These aren’t real flavors, it’s just for testing.
|
||||
|
@ -495,9 +495,9 @@ kern_return_t SimplifiedExcServer::CatchExceptionRaise(
|
||||
code,
|
||||
code_count,
|
||||
&flavor,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
&new_state_count,
|
||||
destroy_request);
|
||||
}
|
||||
@ -582,9 +582,9 @@ kern_return_t SimplifiedMachExcServer::CatchMachExceptionRaise(
|
||||
code,
|
||||
code_count,
|
||||
&flavor,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
&new_state_count,
|
||||
destroy_request);
|
||||
}
|
||||
@ -713,7 +713,7 @@ kern_return_t UniversalMachExcServer::CatchException(
|
||||
thread,
|
||||
task,
|
||||
exception,
|
||||
code_count ? &mach_codes[0] : NULL,
|
||||
code_count ? &mach_codes[0] : nullptr,
|
||||
code_count,
|
||||
flavor,
|
||||
old_state,
|
||||
|
@ -450,9 +450,9 @@ class UniversalMachExcServer
|
||||
//! generation of a POSIX signal that caused process termination. If the
|
||||
//! signal that caused termination was not sent as a result of a hardware
|
||||
//! exception, this will be `0`. Callers that do not need this value may
|
||||
//! pass `NULL`.
|
||||
//! pass `nullptr`.
|
||||
//! \param[out] signal The POSIX signal that caused process termination. Callers
|
||||
//! that do not need this value may pass `NULL`.
|
||||
//! that do not need this value may pass `nullptr`.
|
||||
//!
|
||||
//! \return The original exception for a hardware exception that resulted in the
|
||||
//! generation of a POSIX signal that caused process termination. If the
|
||||
|
@ -506,13 +506,14 @@ MATCHER_P2(AreExceptionCodes, code_0, code_1, "") {
|
||||
|
||||
// Matcher for ThreadState and ConstThreadState, testing that *state_count is
|
||||
// present and matches the specified value. If 0 is specified for the count,
|
||||
// state must be NULL (not present), otherwise state must be non-NULL (present).
|
||||
// |state| must be nullptr (not present), otherwise |state| must not be nullptr
|
||||
// (present).
|
||||
MATCHER_P(IsThreadStateCount, state_count, "") {
|
||||
if (!arg) {
|
||||
return false;
|
||||
}
|
||||
if (!arg->state_count) {
|
||||
*result_listener << "state_count NULL";
|
||||
*result_listener << "state_count nullptr";
|
||||
return false;
|
||||
}
|
||||
if (*(arg->state_count) != state_count) {
|
||||
@ -521,12 +522,12 @@ MATCHER_P(IsThreadStateCount, state_count, "") {
|
||||
}
|
||||
if (state_count) {
|
||||
if (!arg->state) {
|
||||
*result_listener << "*state_count " << state_count << ", state NULL";
|
||||
*result_listener << "*state_count " << state_count << ", state nullptr";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (arg->state) {
|
||||
*result_listener << "*state_count 0, state non-NULL (" << arg->state
|
||||
*result_listener << "*state_count 0, state non-nullptr (" << arg->state
|
||||
<< ")";
|
||||
return false;
|
||||
}
|
||||
@ -913,7 +914,7 @@ class TestExcServerVariants : public UniversalMachExcServer,
|
||||
// function returning type void, and the interface dictates otherwise here.
|
||||
if (exception == EXC_CRASH && code_count >= 1) {
|
||||
int signal;
|
||||
ExcCrashRecoverOriginalException(code[0], NULL, &signal);
|
||||
ExcCrashRecoverOriginalException(code[0], nullptr, &signal);
|
||||
SetExpectedChildTermination(kTerminationSignal, signal);
|
||||
}
|
||||
|
||||
@ -921,16 +922,16 @@ class TestExcServerVariants : public UniversalMachExcServer,
|
||||
if (has_state) {
|
||||
EXPECT_EQ(flavor_, *flavor);
|
||||
EXPECT_EQ(state_count_, old_state_count);
|
||||
EXPECT_NE(static_cast<const natural_t*>(NULL), old_state);
|
||||
EXPECT_NE(nullptr, old_state);
|
||||
EXPECT_EQ(static_cast<mach_msg_type_number_t>(THREAD_STATE_MAX),
|
||||
*new_state_count);
|
||||
EXPECT_NE(static_cast<natural_t*>(NULL), new_state);
|
||||
EXPECT_NE(nullptr, new_state);
|
||||
} else {
|
||||
EXPECT_EQ(THREAD_STATE_NONE, *flavor);
|
||||
EXPECT_EQ(0u, old_state_count);
|
||||
EXPECT_EQ(NULL, old_state);
|
||||
EXPECT_EQ(nullptr, old_state);
|
||||
EXPECT_EQ(0u, *new_state_count);
|
||||
EXPECT_EQ(NULL, new_state);
|
||||
EXPECT_EQ(nullptr, new_state);
|
||||
}
|
||||
|
||||
return ExcServerSuccessfulReturnValue(behavior, false);
|
||||
@ -1022,43 +1023,43 @@ TEST(ExcServerVariants, ThreadStates) {
|
||||
};
|
||||
const TestData test_data[] = {
|
||||
#if defined(ARCH_CPU_X86_FAMILY)
|
||||
// For the x86 family, exception handlers can only properly receive the
|
||||
// thread, float, and exception state flavors. There’s a bug in the kernel
|
||||
// that causes it to call thread_getstatus() (a wrapper for the more
|
||||
// familiar thread_get_state()) with an incorrect state buffer size
|
||||
// parameter when delivering an exception. 10.9.4
|
||||
// xnu-2422.110.17/osfmk/kern/exception.c exception_deliver() uses the
|
||||
// _MachineStateCount[] array indexed by the flavor number to obtain the
|
||||
// buffer size. 10.9.4 xnu-2422.110.17/osfmk/i386/pcb.c contains the
|
||||
// definition of this array for the x86 family. The slots corresponding to
|
||||
// thread, float, and exception state flavors in both native-width (32- and
|
||||
// 64-bit) and universal are correct, but the remaining elements in the
|
||||
// array are not. This includes elements that would correspond to debug and
|
||||
// AVX state flavors, so these cannot be tested here.
|
||||
//
|
||||
// When machine_thread_get_state() (the machine-specific implementation of
|
||||
// thread_get_state()) encounters an undersized buffer as reported by the
|
||||
// buffer size parameter, it returns KERN_INVALID_ARGUMENT, which causes
|
||||
// exception_deliver() to not actually deliver the exception and instead
|
||||
// return that error code to exception_triage() as well.
|
||||
//
|
||||
// This bug is filed as radar 18312067.
|
||||
//
|
||||
// Additionaly, the AVX state flavors are also not tested because they’re
|
||||
// not available on all CPUs and OS versions.
|
||||
// For the x86 family, exception handlers can only properly receive the
|
||||
// thread, float, and exception state flavors. There’s a bug in the kernel
|
||||
// that causes it to call thread_getstatus() (a wrapper for the more
|
||||
// familiar thread_get_state()) with an incorrect state buffer size
|
||||
// parameter when delivering an exception. 10.9.4
|
||||
// xnu-2422.110.17/osfmk/kern/exception.c exception_deliver() uses the
|
||||
// _MachineStateCount[] array indexed by the flavor number to obtain the
|
||||
// buffer size. 10.9.4 xnu-2422.110.17/osfmk/i386/pcb.c contains the
|
||||
// definition of this array for the x86 family. The slots corresponding to
|
||||
// thread, float, and exception state flavors in both native-width (32-
|
||||
// and 64-bit) and universal are correct, but the remaining elements in
|
||||
// the array are not. This includes elements that would correspond to
|
||||
// debug and AVX state flavors, so these cannot be tested here.
|
||||
//
|
||||
// When machine_thread_get_state() (the machine-specific implementation of
|
||||
// thread_get_state()) encounters an undersized buffer as reported by the
|
||||
// buffer size parameter, it returns KERN_INVALID_ARGUMENT, which causes
|
||||
// exception_deliver() to not actually deliver the exception and instead
|
||||
// return that error code to exception_triage() as well.
|
||||
//
|
||||
// This bug is filed as radar 18312067.
|
||||
//
|
||||
// Additionaly, the AVX state flavors are also not tested because they’re
|
||||
// not available on all CPUs and OS versions.
|
||||
#if defined(ARCH_CPU_X86)
|
||||
{x86_THREAD_STATE32, x86_THREAD_STATE32_COUNT},
|
||||
{x86_FLOAT_STATE32, x86_FLOAT_STATE32_COUNT},
|
||||
{x86_EXCEPTION_STATE32, x86_EXCEPTION_STATE32_COUNT},
|
||||
{x86_THREAD_STATE32, x86_THREAD_STATE32_COUNT},
|
||||
{x86_FLOAT_STATE32, x86_FLOAT_STATE32_COUNT},
|
||||
{x86_EXCEPTION_STATE32, x86_EXCEPTION_STATE32_COUNT},
|
||||
#endif
|
||||
#if defined(ARCH_CPU_X86_64)
|
||||
{x86_THREAD_STATE64, x86_THREAD_STATE64_COUNT},
|
||||
{x86_FLOAT_STATE64, x86_FLOAT_STATE64_COUNT},
|
||||
{x86_EXCEPTION_STATE64, x86_EXCEPTION_STATE64_COUNT},
|
||||
{x86_THREAD_STATE64, x86_THREAD_STATE64_COUNT},
|
||||
{x86_FLOAT_STATE64, x86_FLOAT_STATE64_COUNT},
|
||||
{x86_EXCEPTION_STATE64, x86_EXCEPTION_STATE64_COUNT},
|
||||
#endif
|
||||
{x86_THREAD_STATE, x86_THREAD_STATE_COUNT},
|
||||
{x86_FLOAT_STATE, x86_FLOAT_STATE_COUNT},
|
||||
{x86_EXCEPTION_STATE, x86_EXCEPTION_STATE_COUNT},
|
||||
{x86_THREAD_STATE, x86_THREAD_STATE_COUNT},
|
||||
{x86_FLOAT_STATE, x86_FLOAT_STATE_COUNT},
|
||||
{x86_EXCEPTION_STATE, x86_EXCEPTION_STATE_COUNT},
|
||||
#else
|
||||
#error Port this test to your CPU architecture.
|
||||
#endif
|
||||
@ -1085,30 +1086,27 @@ TEST(ExcServerVariants, ExcCrashRecoverOriginalException) {
|
||||
int signal;
|
||||
};
|
||||
const TestData kTestData[] = {
|
||||
{0xb100001, EXC_BAD_ACCESS, KERN_INVALID_ADDRESS, SIGSEGV},
|
||||
{0xb100002, EXC_BAD_ACCESS, KERN_PROTECTION_FAILURE, SIGSEGV},
|
||||
{0xa100002, EXC_BAD_ACCESS, KERN_PROTECTION_FAILURE, SIGBUS},
|
||||
{0x4200001, EXC_BAD_INSTRUCTION, 1, SIGILL},
|
||||
{0x8300001, EXC_ARITHMETIC, 1, SIGFPE},
|
||||
{0x5600002, EXC_BREAKPOINT, 2, SIGTRAP},
|
||||
{0x3000000, 0, 0, SIGQUIT},
|
||||
{0x6000000, 0, 0, SIGABRT},
|
||||
{0xc000000, 0, 0, SIGSYS},
|
||||
{0, 0, 0, 0},
|
||||
{0xb100001, EXC_BAD_ACCESS, KERN_INVALID_ADDRESS, SIGSEGV},
|
||||
{0xb100002, EXC_BAD_ACCESS, KERN_PROTECTION_FAILURE, SIGSEGV},
|
||||
{0xa100002, EXC_BAD_ACCESS, KERN_PROTECTION_FAILURE, SIGBUS},
|
||||
{0x4200001, EXC_BAD_INSTRUCTION, 1, SIGILL},
|
||||
{0x8300001, EXC_ARITHMETIC, 1, SIGFPE},
|
||||
{0x5600002, EXC_BREAKPOINT, 2, SIGTRAP},
|
||||
{0x3000000, 0, 0, SIGQUIT},
|
||||
{0x6000000, 0, 0, SIGABRT},
|
||||
{0xc000000, 0, 0, SIGSYS},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
for (size_t index = 0; index < arraysize(kTestData); ++index) {
|
||||
const TestData& test_data = kTestData[index];
|
||||
SCOPED_TRACE(base::StringPrintf("index %zu, code_0 0x%llx",
|
||||
index,
|
||||
test_data.code_0));
|
||||
SCOPED_TRACE(base::StringPrintf(
|
||||
"index %zu, code_0 0x%llx", index, test_data.code_0));
|
||||
|
||||
mach_exception_code_t original_code_0;
|
||||
int signal;
|
||||
exception_type_t exception =
|
||||
ExcCrashRecoverOriginalException(test_data.code_0,
|
||||
&original_code_0,
|
||||
&signal);
|
||||
exception_type_t exception = ExcCrashRecoverOriginalException(
|
||||
test_data.code_0, &original_code_0, &signal);
|
||||
|
||||
EXPECT_EQ(test_data.exception, exception);
|
||||
EXPECT_EQ(test_data.original_code_0, original_code_0);
|
||||
@ -1119,18 +1117,20 @@ TEST(ExcServerVariants, ExcCrashRecoverOriginalException) {
|
||||
// optional arguments.
|
||||
static_assert(arraysize(kTestData) >= 1, "must have something to test");
|
||||
const TestData& test_data = kTestData[0];
|
||||
EXPECT_EQ(test_data.exception,
|
||||
ExcCrashRecoverOriginalException(test_data.code_0, NULL, NULL));
|
||||
EXPECT_EQ(
|
||||
test_data.exception,
|
||||
ExcCrashRecoverOriginalException(test_data.code_0, nullptr, nullptr));
|
||||
|
||||
mach_exception_code_t original_code_0;
|
||||
EXPECT_EQ(test_data.exception,
|
||||
ExcCrashRecoverOriginalException(
|
||||
test_data.code_0, &original_code_0, NULL));
|
||||
test_data.code_0, &original_code_0, nullptr));
|
||||
EXPECT_EQ(test_data.original_code_0, original_code_0);
|
||||
|
||||
int signal;
|
||||
EXPECT_EQ(test_data.exception,
|
||||
ExcCrashRecoverOriginalException(test_data.code_0, NULL, &signal));
|
||||
EXPECT_EQ(
|
||||
test_data.exception,
|
||||
ExcCrashRecoverOriginalException(test_data.code_0, nullptr, &signal));
|
||||
EXPECT_EQ(test_data.signal, signal);
|
||||
}
|
||||
|
||||
|
@ -54,9 +54,9 @@ ExceptionPorts::ExceptionPorts(TargetType target_type, mach_port_t target_port)
|
||||
|
||||
default:
|
||||
NOTREACHED();
|
||||
get_exception_ports_ = NULL;
|
||||
set_exception_ports_ = NULL;
|
||||
target_name_ = NULL;
|
||||
get_exception_ports_ = nullptr;
|
||||
set_exception_ports_ = nullptr;
|
||||
target_name_ = nullptr;
|
||||
target_port_ = MACH_PORT_NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ class TestExceptionPorts : public UniversalMachExcServer,
|
||||
// function returning type void, and the interface dictates otherwise here.
|
||||
if (exception == EXC_CRASH && code_count >= 1) {
|
||||
int signal;
|
||||
ExcCrashRecoverOriginalException(code[0], NULL, &signal);
|
||||
ExcCrashRecoverOriginalException(code[0], nullptr, &signal);
|
||||
|
||||
// The child crashed with a division by zero, which shows up as SIGFPE.
|
||||
// This was chosen because it’s unlikely to be generated by testing or
|
||||
@ -231,7 +231,7 @@ class TestExceptionPorts : public UniversalMachExcServer,
|
||||
}
|
||||
}
|
||||
|
||||
int rv_int = pthread_create(&thread_, NULL, ThreadMainThunk, this);
|
||||
int rv_int = pthread_create(&thread_, nullptr, ThreadMainThunk, this);
|
||||
ASSERT_EQ(0, rv_int);
|
||||
|
||||
// Wait for the new thread to be ready.
|
||||
@ -271,7 +271,7 @@ class TestExceptionPorts : public UniversalMachExcServer,
|
||||
}
|
||||
|
||||
// Reap the other thread.
|
||||
rv_int = pthread_join(thread_, NULL);
|
||||
rv_int = pthread_join(thread_, nullptr);
|
||||
ASSERT_EQ(0, rv_int);
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ class TestExceptionPorts : public UniversalMachExcServer,
|
||||
Crash();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Crashes by performing a division by zero. The assignment is present to
|
||||
|
@ -120,7 +120,7 @@ mach_msg_return_t MachMessageServer::Run(Interface* interface,
|
||||
mach_msg_size_t this_request_size = request_size;
|
||||
|
||||
base::mac::ScopedMachVM request_scoper;
|
||||
mach_msg_header_t* request_header = NULL;
|
||||
mach_msg_header_t* request_header = nullptr;
|
||||
|
||||
while (!request_scoper.address()) {
|
||||
vm_address_t request_addr;
|
||||
|
@ -25,7 +25,7 @@
|
||||
namespace {
|
||||
|
||||
const char* kExceptionNames[] = {
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
// sed -Ene 's/^#define[[:space:]]EXC_([[:graph:]]+)[[:space:]]+[[:digit:]]{1,2}([[:space:]]|$).*/ "\1",/p'
|
||||
// /usr/include/mach/exception_types.h
|
||||
@ -49,7 +49,7 @@ const char kExcPrefix[] = "EXC_";
|
||||
const char kExcMaskPrefix[] = "EXC_MASK_";
|
||||
|
||||
const char* kBehaviorNames[] = {
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
// sed -Ene 's/^# define[[:space:]]EXCEPTION_([[:graph:]]+)[[:space:]]+[[:digit:]]{1,2}([[:space:]]|$).*/ "\1",/p'
|
||||
// /usr/include/mach/exception_types.h
|
||||
@ -110,12 +110,12 @@ const char* kFlavorNames[] = {
|
||||
"THREAD_STATE_NONE",
|
||||
"ARM_THREAD_STATE64",
|
||||
"ARM_EXCEPTION_STATE64",
|
||||
NULL,
|
||||
nullptr,
|
||||
"ARM_THREAD_STATE32",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
"ARM_DEBUG_STATE32",
|
||||
"ARM_DEBUG_STATE64",
|
||||
"ARM_NEON_STATE",
|
||||
@ -194,7 +194,7 @@ std::string ExceptionToString(exception_type_t exception,
|
||||
const char* exception_name =
|
||||
static_cast<size_t>(exception) < arraysize(kExceptionNames)
|
||||
? kExceptionNames[exception]
|
||||
: NULL;
|
||||
: nullptr;
|
||||
if (!exception_name) {
|
||||
if (options & kUnknownIsNumeric) {
|
||||
return base::StringPrintf("%d", exception);
|
||||
@ -363,7 +363,7 @@ std::string ExceptionBehaviorToString(exception_behavior_t behavior,
|
||||
const char* behavior_name =
|
||||
static_cast<size_t>(basic_behavior) < arraysize(kBehaviorNames)
|
||||
? kBehaviorNames[basic_behavior]
|
||||
: NULL;
|
||||
: nullptr;
|
||||
if (!behavior_name) {
|
||||
if (options & kUnknownIsNumeric) {
|
||||
return base::StringPrintf("%#x", behavior);
|
||||
@ -465,7 +465,7 @@ std::string ThreadStateFlavorToString(thread_state_flavor_t flavor,
|
||||
const char* flavor_name =
|
||||
static_cast<size_t>(flavor) < arraysize(kFlavorNames)
|
||||
? kFlavorNames[flavor]
|
||||
: NULL;
|
||||
: nullptr;
|
||||
|
||||
if (!flavor_name) {
|
||||
for (size_t generic_flavor_index = 0;
|
||||
|
@ -41,7 +41,7 @@ const StringToSymbolicConstantOptions kNormalOptions[] = {
|
||||
kAllowFullName | kAllowShortName | kAllowNumber,
|
||||
};
|
||||
|
||||
// If |expect| is NULL, the conversion is expected to fail. If |expect| is
|
||||
// If |expect| is nullptr, the conversion is expected to fail. If |expect| is
|
||||
// empty, the conversion is expected to succeed, but the precise returned string
|
||||
// value is unknown. Otherwise, the conversion is expected to succeed, and
|
||||
// |expect| contains the precise expected string value to be returned. If
|
||||
@ -171,7 +171,7 @@ TEST(SymbolicConstantsMach, ExceptionToString) {
|
||||
if (exception > 0 && exception < EXC_TYPES_COUNT) {
|
||||
TestExceptionToString(exception, "", "");
|
||||
} else {
|
||||
TestExceptionToString(exception, NULL, NULL);
|
||||
TestExceptionToString(exception, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -591,8 +591,8 @@ TEST(SymbolicConstantsMach, ExceptionBehaviorToString) {
|
||||
TestExceptionBehaviorToString(behavior, "", "");
|
||||
TestExceptionBehaviorToString(behavior_mach, "", "");
|
||||
} else {
|
||||
TestExceptionBehaviorToString(behavior, NULL, NULL);
|
||||
TestExceptionBehaviorToString(behavior_mach, NULL, NULL);
|
||||
TestExceptionBehaviorToString(behavior, nullptr, nullptr);
|
||||
TestExceptionBehaviorToString(behavior_mach, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -867,7 +867,7 @@ TEST(SymbolicConstantsMach, ThreadStateFlavorToString) {
|
||||
flavor == THREAD_STATE_FLAVOR_LIST_10_9) {
|
||||
TestThreadStateFlavorToString(flavor, "", "");
|
||||
} else {
|
||||
TestThreadStateFlavorToString(flavor, NULL, NULL);
|
||||
TestThreadStateFlavorToString(flavor, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class TaskMemory {
|
||||
//! \param[in] size The size, in bytes, of the memory region to map.
|
||||
//!
|
||||
//! \return On success, a MappedMemory object that provides access to the data
|
||||
//! requested. On faliure, `NULL`, with a warning logged. Failures can
|
||||
//! requested. On faliure, `nullptr`, with a warning logged. Failures can
|
||||
//! occur, for example, when encountering unmapped or unreadable pages.
|
||||
scoped_ptr<MappedMemory> ReadMapped(mach_vm_address_t address, size_t size);
|
||||
|
||||
|
@ -43,14 +43,15 @@ bool ProcessArgumentsForPID(pid_t pid, std::vector<std::string>* argv) {
|
||||
int tries = 3;
|
||||
do {
|
||||
int mib[] = {CTL_KERN, KERN_PROCARGS2, pid};
|
||||
int rv = sysctl(mib, arraysize(mib), NULL, &args_size_estimate, NULL, 0);
|
||||
int rv =
|
||||
sysctl(mib, arraysize(mib), nullptr, &args_size_estimate, nullptr, 0);
|
||||
if (rv != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
args_size = args_size_estimate + 1;
|
||||
args.resize(args_size);
|
||||
rv = sysctl(mib, arraysize(mib), &args[0], &args_size, NULL, 0);
|
||||
rv = sysctl(mib, arraysize(mib), &args[0], &args_size, nullptr, 0);
|
||||
if (rv != 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
namespace {
|
||||
|
||||
const char* kSignalNames[] = {
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
// sed -Ene 's/^#define[[:space:]]SIG([[:alnum:]]+)[[:space:]]+[[:digit:]]{1,2}([[:space:]]|$).*/ "\1",/p'
|
||||
@ -115,7 +115,7 @@ std::string SignalToString(int signal,
|
||||
const char* signal_name =
|
||||
static_cast<size_t>(signal) < arraysize(kSignalNames)
|
||||
? kSignalNames[signal]
|
||||
: NULL;
|
||||
: nullptr;
|
||||
if (!signal_name) {
|
||||
if (options & kUnknownIsNumeric) {
|
||||
return base::StringPrintf("%d", signal);
|
||||
|
@ -69,7 +69,7 @@ const struct {
|
||||
#endif
|
||||
};
|
||||
|
||||
// If |expect| is NULL, the conversion is expected to fail. If |expect| is
|
||||
// If |expect| is nullptr, the conversion is expected to fail. If |expect| is
|
||||
// empty, the conversion is expected to succeed, but the precise returned string
|
||||
// value is unknown. Otherwise, the conversion is expected to succeed, and
|
||||
// |expect| contains the precise expected string value to be returned.
|
||||
@ -130,7 +130,7 @@ TEST(SymbolicConstantsPOSIX, SignalToString) {
|
||||
if (signal > 0 && signal < kSignalCount) {
|
||||
TestSignalToString(signal, "", "");
|
||||
} else {
|
||||
TestSignalToString(signal, NULL, NULL);
|
||||
TestSignalToString(signal, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ void* ThreadMain(void* argument) {
|
||||
for (size_t iteration = 0; iteration < info->iterations; ++iteration) {
|
||||
info->semaphore->Wait();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TEST(Semaphore, Threaded) {
|
||||
@ -48,12 +48,12 @@ TEST(Semaphore, Threaded) {
|
||||
info.semaphore = &semaphore;
|
||||
info.iterations = 1;
|
||||
|
||||
int rv = pthread_create(&info.pthread, NULL, ThreadMain, &info);
|
||||
int rv = pthread_create(&info.pthread, nullptr, ThreadMain, &info);
|
||||
ASSERT_EQ(0, rv) << "pthread_create";
|
||||
|
||||
semaphore.Signal();
|
||||
|
||||
rv = pthread_join(info.pthread, NULL);
|
||||
rv = pthread_join(info.pthread, nullptr);
|
||||
ASSERT_EQ(0, rv) << "pthread_join";
|
||||
}
|
||||
|
||||
@ -71,7 +71,8 @@ TEST(Semaphore, TenThreaded) {
|
||||
info[index].iterations = index;
|
||||
iterations += info[index].iterations;
|
||||
|
||||
rv = pthread_create(&info[index].pthread, NULL, ThreadMain, &info[index]);
|
||||
rv =
|
||||
pthread_create(&info[index].pthread, nullptr, ThreadMain, &info[index]);
|
||||
ASSERT_EQ(0, rv) << "pthread_create";
|
||||
}
|
||||
|
||||
@ -80,7 +81,7 @@ TEST(Semaphore, TenThreaded) {
|
||||
}
|
||||
|
||||
for (size_t index = 0; index < kThreads; ++index) {
|
||||
rv = pthread_join(info[index].pthread, NULL);
|
||||
rv = pthread_join(info[index].pthread, nullptr);
|
||||
ASSERT_EQ(0, rv) << "pthread_join";
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace test {
|
||||
|
||||
base::FilePath ExecutablePath() {
|
||||
uint32_t executable_length = 0;
|
||||
_NSGetExecutablePath(NULL, &executable_length);
|
||||
_NSGetExecutablePath(nullptr, &executable_length);
|
||||
DCHECK_GT(executable_length, 1u);
|
||||
std::string executable_path(executable_length, std::string::value_type());
|
||||
int rv = _NSGetExecutablePath(&executable_path[0], &executable_length);
|
||||
|
@ -66,11 +66,11 @@ struct MachMultiprocessInfo {
|
||||
|
||||
} // namespace internal
|
||||
|
||||
MachMultiprocess::MachMultiprocess() : Multiprocess(), info_(NULL) {
|
||||
MachMultiprocess::MachMultiprocess() : Multiprocess(), info_(nullptr) {
|
||||
}
|
||||
|
||||
void MachMultiprocess::Run() {
|
||||
ASSERT_EQ(NULL, info_);
|
||||
ASSERT_EQ(nullptr, info_);
|
||||
scoped_ptr<internal::MachMultiprocessInfo> info(
|
||||
new internal::MachMultiprocessInfo);
|
||||
base::AutoReset<internal::MachMultiprocessInfo*> reset_info(&info_,
|
||||
@ -170,7 +170,7 @@ void MachMultiprocess::MultiprocessParent() {
|
||||
&audit_rgid,
|
||||
&audit_pid,
|
||||
&audit_asid,
|
||||
NULL);
|
||||
nullptr);
|
||||
#else
|
||||
uid_t audit_auid = audit_token_to_auid(message.audit_trailer.msgh_audit);
|
||||
uid_t audit_euid = audit_token_to_euid(message.audit_trailer.msgh_audit);
|
||||
|
@ -53,13 +53,13 @@ struct MultiprocessInfo {
|
||||
} // namespace internal
|
||||
|
||||
Multiprocess::Multiprocess()
|
||||
: info_(NULL),
|
||||
: info_(nullptr),
|
||||
code_(EXIT_SUCCESS),
|
||||
reason_(kTerminationNormal) {
|
||||
}
|
||||
|
||||
void Multiprocess::Run() {
|
||||
ASSERT_EQ(NULL, info_);
|
||||
ASSERT_EQ(nullptr, info_);
|
||||
scoped_ptr<internal::MultiprocessInfo> info(new internal::MultiprocessInfo);
|
||||
base::AutoReset<internal::MultiprocessInfo*> reset_info(&info_, info.get());
|
||||
|
||||
@ -84,7 +84,7 @@ void Multiprocess::Run() {
|
||||
// done, the child might hang while waiting for a parent that has already
|
||||
// triggered a fatal assertion failure to do something.
|
||||
info.reset();
|
||||
info_ = NULL;
|
||||
info_ = nullptr;
|
||||
|
||||
int status;
|
||||
pid_t wait_pid = HANDLE_EINTR(waitpid(pid, &status, 0));
|
||||
|
@ -61,7 +61,7 @@ void MultiprocessExec::PreFork() {
|
||||
for (const std::string& argument : arguments_) {
|
||||
argv_.push_back(argument.c_str());
|
||||
}
|
||||
argv_.push_back(NULL);
|
||||
argv_.push_back(nullptr);
|
||||
}
|
||||
|
||||
void MultiprocessExec::MultiprocessChild() {
|
||||
|
@ -46,7 +46,7 @@ class MultiprocessExec : public Multiprocess {
|
||||
//! \param[in] arguments The command-line arguments to pass to the child
|
||||
//! process in its `argv[]` vector. This vector must begin at `argv[1]`,
|
||||
//! as \a command is implicitly used as `argv[0]`. This argument may be
|
||||
//! `NULL` if no command-line arguments are to be passed.
|
||||
//! `nullptr` if no command-line arguments are to be passed.
|
||||
void SetChildCommand(const std::string& command,
|
||||
const std::vector<std::string>* arguments);
|
||||
|
||||
|
@ -48,7 +48,7 @@ TEST(MultiprocessExec, MultiprocessExec) {
|
||||
base::FilePath test_executable = ExecutablePath();
|
||||
std::string child_test_executable =
|
||||
test_executable.value() + "_multiprocess_exec_test_child";
|
||||
multiprocess_exec.SetChildCommand(child_test_executable, NULL);
|
||||
multiprocess_exec.SetChildCommand(child_test_executable, nullptr);
|
||||
multiprocess_exec.Run();
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ bool CloseMultipleNowOrOnExecUsingFDDir(int fd, int preserve_fd) {
|
||||
dirent entry;
|
||||
dirent* result;
|
||||
int rv;
|
||||
while ((rv = readdir_r(dir, &entry, &result)) == 0 && result != NULL) {
|
||||
while ((rv = readdir_r(dir, &entry, &result)) == 0 && result != nullptr) {
|
||||
const char* entry_name = &(*result->d_name);
|
||||
if (strcmp(entry_name, ".") == 0 || strcmp(entry_name, "..") == 0) {
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user