Index: handler/mac/crash_report_exception_handler.cc |
diff --git a/handler/mac/crash_report_exception_handler.cc b/handler/mac/crash_report_exception_handler.cc |
index 5fe76507750be58bd229d0609c1d410160360e82..93685d8aa7617ebe32612145e5c1ba3d1e3ae87a 100644 |
--- a/handler/mac/crash_report_exception_handler.cc |
+++ b/handler/mac/crash_report_exception_handler.cc |
@@ -116,49 +116,57 @@ kern_return_t CrashReportExceptionHandler::CatchMachException( |
return KERN_FAILURE; |
} |
- if (!process_snapshot.InitializeException(thread, |
- exception, |
- code, |
- code_count, |
- *flavor, |
- old_state, |
- old_state_count)) { |
- return KERN_FAILURE; |
- } |
+ CrashpadInfo::TriState enable_crashpad_handler; |
+ CrashpadInfo::TriState enable_native_crash_reporter_forwarding; |
+ process_snapshot.GetCrashpadOptions(&enable_crashpad_handler, |
+ &enable_native_crash_reporter_forwarding); |
+ |
+ if (enable_crashpad_handler != CrashpadInfo::kDisabled) { |
+ if (!process_snapshot.InitializeException(thread, |
+ exception, |
+ code, |
+ code_count, |
+ *flavor, |
+ old_state, |
+ old_state_count)) { |
+ return KERN_FAILURE; |
+ } |
- process_snapshot.SetAnnotationsSimpleMap(*process_annotations_); |
+ process_snapshot.SetAnnotationsSimpleMap(*process_annotations_); |
- CrashReportDatabase::NewReport* new_report; |
- CrashReportDatabase::OperationStatus database_status = |
- database_->PrepareNewCrashReport(&new_report); |
- if (database_status != CrashReportDatabase::kNoError) { |
- return KERN_FAILURE; |
- } |
+ CrashReportDatabase::NewReport* new_report; |
+ CrashReportDatabase::OperationStatus database_status = |
+ database_->PrepareNewCrashReport(&new_report); |
+ if (database_status != CrashReportDatabase::kNoError) { |
+ return KERN_FAILURE; |
+ } |
- CallErrorWritingCrashReport call_error_writing_crash_report(database_, |
- new_report); |
+ CallErrorWritingCrashReport call_error_writing_crash_report(database_, |
+ new_report); |
- WeakFileHandleFileWriter file_writer(new_report->handle); |
+ WeakFileHandleFileWriter file_writer(new_report->handle); |
- MinidumpFileWriter minidump; |
- minidump.InitializeFromSnapshot(&process_snapshot); |
- if (!minidump.WriteEverything(&file_writer)) { |
- return KERN_FAILURE; |
- } |
+ MinidumpFileWriter minidump; |
+ minidump.InitializeFromSnapshot(&process_snapshot); |
+ if (!minidump.WriteEverything(&file_writer)) { |
+ return KERN_FAILURE; |
+ } |
- call_error_writing_crash_report.Disarm(); |
+ call_error_writing_crash_report.Disarm(); |
- UUID uuid; |
- database_status = database_->FinishedWritingCrashReport(new_report, &uuid); |
- if (database_status != CrashReportDatabase::kNoError) { |
- return KERN_FAILURE; |
- } |
+ UUID uuid; |
+ database_status = database_->FinishedWritingCrashReport(new_report, &uuid); |
+ if (database_status != CrashReportDatabase::kNoError) { |
+ return KERN_FAILURE; |
+ } |
- upload_thread_->ReportPending(); |
+ upload_thread_->ReportPending(); |
+ } |
- if (exception == EXC_CRASH || |
- exception == EXC_RESOURCE || |
- exception == EXC_GUARD) { |
+ if (enable_native_crash_reporter_forwarding != CrashpadInfo::kDisabled && |
+ (exception == EXC_CRASH || |
+ exception == EXC_RESOURCE || |
+ exception == EXC_GUARD)) { |
// Don’t forward simulated exceptions such as kMachExceptionSimulated to the |
// system crash reporter. Only forward the types of exceptions that it would |
// receive under normal conditions. Although the system crash reporter is |