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

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

Issue 651283003: Add crashpad_info, MachOImageAnnotationsReader, and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Rebase onto master 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 | « snapshot/mac/mach_o_image_reader.h ('k') | snapshot/mac/process_types/all.proctype » ('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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 nullptr 398 // library was not found. Similarly, all_image_infos.infoArray may be nullptr
399 // if 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 //
404 // Continue along when this situation is detected, because even without any
405 // images in infoArray, dyldImageLoadAddress may be set, and it may be
406 // possible to recover some information from dyld.
403 if (all_image_infos.infoArrayCount == 0) { 407 if (all_image_infos.infoArrayCount == 0) {
404 LOG(WARNING) << "all_image_infos.infoArrayCount is zero"; 408 LOG(WARNING) << "all_image_infos.infoArrayCount is zero";
405 return; 409 } else if (!all_image_infos.infoArray) {
406 }
407 if (!all_image_infos.infoArray) {
408 LOG(WARNING) << "all_image_infos.infoArray is nullptr"; 410 LOG(WARNING) << "all_image_infos.infoArray is nullptr";
409 return;
410 } 411 }
411 412
412 std::vector<process_types::dyld_image_info> image_info_vector( 413 std::vector<process_types::dyld_image_info> image_info_vector(
413 all_image_infos.infoArrayCount); 414 all_image_infos.infoArrayCount);
414 if (!process_types::dyld_image_info::ReadArrayInto(this, 415 if (!process_types::dyld_image_info::ReadArrayInto(this,
415 all_image_infos.infoArray, 416 all_image_infos.infoArray,
416 image_info_vector.size(), 417 image_info_vector.size(),
417 &image_info_vector[0])) { 418 &image_info_vector[0])) {
418 LOG(WARNING) << "could not read dyld_image_info array"; 419 LOG(WARNING) << "could not read dyld_image_info array";
419 return; 420 return;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 // The red zone would go lower into another region in memory, but no 708 // 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 709 // region was found. Memory can only be captured to an address as low as
709 // the base address of the region already found. 710 // the base address of the region already found.
710 *start_address = *region_base; 711 *start_address = *region_base;
711 } 712 }
712 } 713 }
713 #endif 714 #endif
714 } 715 }
715 716
716 } // namespace crashpad 717 } // namespace crashpad
OLDNEW
« no previous file with comments | « snapshot/mac/mach_o_image_reader.h ('k') | snapshot/mac/process_types/all.proctype » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698