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

Unified Diff: snapshot/mac/mach_o_image_annotations_reader.cc

Issue 997713002: Allow exception forwarding to the system’s native crash reporter to be disabled (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: snapshot/mac/mach_o_image_annotations_reader.cc
diff --git a/snapshot/mac/mach_o_image_annotations_reader.cc b/snapshot/mac/mach_o_image_annotations_reader.cc
index b95e8559263d4bb85ef450e770b1d666a87a27b1..12550937fb1c54f6eda9f1f6e4250c55b23d4d4e 100644
--- a/snapshot/mac/mach_o_image_annotations_reader.cc
+++ b/snapshot/mac/mach_o_image_annotations_reader.cc
@@ -22,7 +22,6 @@
#include "client/simple_string_dictionary.h"
#include "snapshot/mac/mach_o_image_reader.h"
#include "snapshot/mac/process_reader.h"
-#include "snapshot/mac/process_types.h"
#include "util/mach/task_memory.h"
#include "util/stdlib/strnlen.h"
@@ -55,6 +54,38 @@ std::map<std::string, std::string> MachOImageAnnotationsReader::SimpleMap()
return simple_map_annotations;
}
+bool MachOImageAnnotationsReader::GetCrashpadInfo(
+ process_types::CrashpadInfo* crashpad_info) const {
+ mach_vm_address_t crashpad_info_address;
+ const process_types::section* crashpad_info_section =
+ image_reader_->GetSectionByName(
+ SEG_DATA, "__crashpad_info", &crashpad_info_address);
+ if (!crashpad_info_section) {
+ return false;
+ }
+
+ if (crashpad_info_section->size <
+ crashpad_info->ExpectedSize(process_reader_)) {
+ LOG(WARNING) << "small crashpad info section size "
+ << crashpad_info_section->size << " in " << name_;
+ return false;
+ }
+
+ if (!crashpad_info->Read(process_reader_, crashpad_info_address)) {
+ LOG(WARNING) << "could not read crashpad info from " << name_;
+ return false;
+ }
+
+ if (crashpad_info->signature != CrashpadInfo::kSignature ||
+ crashpad_info->size != crashpad_info_section->size ||
+ crashpad_info->version < 1) {
+ LOG(WARNING) << "unexpected crashpad info data in " << name_;
+ return false;
+ }
+
+ return true;
+}
+
void MachOImageAnnotationsReader::ReadCrashReporterClientAnnotations(
std::vector<std::string>* vector_annotations) const {
mach_vm_address_t crash_info_address;
@@ -138,31 +169,8 @@ void MachOImageAnnotationsReader::ReadDyldErrorStringAnnotation(
void MachOImageAnnotationsReader::ReadCrashpadSimpleAnnotations(
std::map<std::string, std::string>* simple_map_annotations) const {
- mach_vm_address_t crashpad_info_address;
- const process_types::section* crashpad_info_section =
- image_reader_->GetSectionByName(
- SEG_DATA, "__crashpad_info", &crashpad_info_address);
- if (!crashpad_info_section) {
- return;
- }
-
process_types::CrashpadInfo crashpad_info;
- if (crashpad_info_section->size <
- crashpad_info.ExpectedSize(process_reader_)) {
- LOG(WARNING) << "small crashpad info section size "
- << crashpad_info_section->size << " in " << name_;
- return;
- }
-
- if (!crashpad_info.Read(process_reader_, crashpad_info_address)) {
- LOG(WARNING) << "could not read crashpad info from " << name_;
- return;
- }
-
- if (crashpad_info.signature != CrashpadInfo::kSignature ||
- crashpad_info.size != crashpad_info_section->size ||
- crashpad_info.version < 1) {
- LOG(WARNING) << "unexpected crashpad info data in " << name_;
+ if (!GetCrashpadInfo(&crashpad_info)) {
return;
}

Powered by Google App Engine
This is Rietveld 408576698