OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |