Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: util/mac/process_reader.cc

Issue 656703002: Convert NULL to nullptr (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Fix 80-column violations Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « util/mac/mach_o_image_symbol_table_reader.cc ('k') | util/mac/process_reader_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 debug_context(), 76 debug_context(),
77 id(0), 77 id(0),
78 stack_region_address(0), 78 stack_region_address(0),
79 stack_region_size(0), 79 stack_region_size(0),
80 thread_specific_data_address(0), 80 thread_specific_data_address(0),
81 port(THREAD_NULL), 81 port(THREAD_NULL),
82 suspend_count(0), 82 suspend_count(0),
83 priority(0) { 83 priority(0) {
84 } 84 }
85 85
86 ProcessReader::Module::Module() : name(), reader(NULL), timestamp(0) { 86 ProcessReader::Module::Module() : name(), reader(nullptr), timestamp(0) {
87 } 87 }
88 88
89 ProcessReader::Module::~Module() { 89 ProcessReader::Module::~Module() {
90 } 90 }
91 91
92 ProcessReader::ProcessReader() 92 ProcessReader::ProcessReader()
93 : kern_proc_info_(), 93 : kern_proc_info_(),
94 threads_(), 94 threads_(),
95 modules_(), 95 modules_(),
96 module_readers_(), 96 module_readers_(),
(...skipping 17 matching lines...) Expand all
114 114
115 pid_t pid; 115 pid_t pid;
116 kern_return_t kr = pid_for_task(task, &pid); 116 kern_return_t kr = pid_for_task(task, &pid);
117 if (kr != KERN_SUCCESS) { 117 if (kr != KERN_SUCCESS) {
118 MACH_LOG(ERROR, kr) << "pid_for_task"; 118 MACH_LOG(ERROR, kr) << "pid_for_task";
119 return false; 119 return false;
120 } 120 }
121 121
122 int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid}; 122 int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid};
123 size_t len = sizeof(kern_proc_info_); 123 size_t len = sizeof(kern_proc_info_);
124 if (sysctl(mib, arraysize(mib), &kern_proc_info_, &len, NULL, 0) != 0) { 124 if (sysctl(mib, arraysize(mib), &kern_proc_info_, &len, nullptr, 0) != 0) {
125 PLOG(ERROR) << "sysctl for pid " << pid; 125 PLOG(ERROR) << "sysctl for pid " << pid;
126 return false; 126 return false;
127 } 127 }
128 128
129 DCHECK_EQ(kern_proc_info_.kp_proc.p_pid, pid); 129 DCHECK_EQ(kern_proc_info_.kp_proc.p_pid, pid);
130 130
131 is_64_bit_ = kern_proc_info_.kp_proc.p_flag & P_LP64; 131 is_64_bit_ = kern_proc_info_.kp_proc.p_flag & P_LP64;
132 132
133 task_memory_.reset(new TaskMemory(task)); 133 task_memory_.reset(new TaskMemory(task));
134 task_ = task; 134 task_ = task;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 process_types::dyld_all_image_infos all_image_infos; 388 process_types::dyld_all_image_infos all_image_infos;
389 if (!all_image_infos.Read(this, dyld_info.all_image_info_addr)) { 389 if (!all_image_infos.Read(this, dyld_info.all_image_info_addr)) {
390 LOG(WARNING) << "could not read dyld_all_image_infos"; 390 LOG(WARNING) << "could not read dyld_all_image_infos";
391 return; 391 return;
392 } 392 }
393 393
394 DCHECK_GE(all_image_infos.version, 1u); 394 DCHECK_GE(all_image_infos.version, 1u);
395 395
396 // Note that all_image_infos.infoArrayCount may be 0 if a crash occurred while 396 // Note that all_image_infos.infoArrayCount may be 0 if a crash occurred while
397 // dyld was loading the executable. This can happen if a required dynamic 397 // dyld was loading the executable. This can happen if a required dynamic
398 // library was not found. Similarly, all_image_infos.infoArray may be NULL if 398 // library was not found. Similarly, all_image_infos.infoArray may be nullptr
399 // a crash occurred while dyld was updating it. 399 // if a crash occurred while dyld was updating it.
400 // 400 //
401 // TODO(mark): It may be possible to recover from these situations by looking 401 // TODO(mark): It may be possible to recover from these situations by looking
402 // through memory mappings for Mach-O images. 402 // through memory mappings for Mach-O images.
403 if (all_image_infos.infoArrayCount == 0) { 403 if (all_image_infos.infoArrayCount == 0) {
404 LOG(WARNING) << "all_image_infos.infoArrayCount is zero"; 404 LOG(WARNING) << "all_image_infos.infoArrayCount is zero";
405 return; 405 return;
406 } 406 }
407 if (!all_image_infos.infoArray) { 407 if (!all_image_infos.infoArray) {
408 LOG(WARNING) << "all_image_infos.infoArray is NULL"; 408 LOG(WARNING) << "all_image_infos.infoArray is nullptr";
409 return; 409 return;
410 } 410 }
411 411
412 std::vector<process_types::dyld_image_info> image_info_vector( 412 std::vector<process_types::dyld_image_info> image_info_vector(
413 all_image_infos.infoArrayCount); 413 all_image_infos.infoArrayCount);
414 if (!process_types::dyld_image_info::ReadArrayInto(this, 414 if (!process_types::dyld_image_info::ReadArrayInto(this,
415 all_image_infos.infoArray, 415 all_image_infos.infoArray,
416 image_info_vector.size(), 416 image_info_vector.size(),
417 &image_info_vector[0])) { 417 &image_info_vector[0])) {
418 LOG(WARNING) << "could not read dyld_image_info array"; 418 LOG(WARNING) << "could not read dyld_image_info array";
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 // The red zone would go lower into another region in memory, but no 707 // The red zone would go lower into another region in memory, but no
708 // region was found. Memory can only be captured to an address as low as 708 // region was found. Memory can only be captured to an address as low as
709 // the base address of the region already found. 709 // the base address of the region already found.
710 *start_address = *region_base; 710 *start_address = *region_base;
711 } 711 }
712 } 712 }
713 #endif 713 #endif
714 } 714 }
715 715
716 } // namespace crashpad 716 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/mac/mach_o_image_symbol_table_reader.cc ('k') | util/mac/process_reader_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698