| Index: third_party/crashpad/crashpad/handler/win/crash_report_exception_handler.cc
|
| diff --git a/third_party/crashpad/crashpad/handler/win/crash_report_exception_handler.cc b/third_party/crashpad/crashpad/handler/win/crash_report_exception_handler.cc
|
| index b9c6d1118d13c532e0405870b1129c69ea80cf7b..a58c5ab9fc525b296775efc00a0c1dc4123a3575 100644
|
| --- a/third_party/crashpad/crashpad/handler/win/crash_report_exception_handler.cc
|
| +++ b/third_party/crashpad/crashpad/handler/win/crash_report_exception_handler.cc
|
| @@ -14,12 +14,15 @@
|
|
|
| #include "handler/win/crash_report_exception_handler.h"
|
|
|
| +#include <type_traits>
|
| +
|
| #include "client/crash_report_database.h"
|
| #include "client/settings.h"
|
| #include "handler/crash_report_upload_thread.h"
|
| #include "minidump/minidump_file_writer.h"
|
| #include "snapshot/win/process_snapshot_win.h"
|
| #include "util/file/file_writer.h"
|
| +#include "util/misc/metrics.h"
|
| #include "util/win/registration_protocol_win.h"
|
| #include "util/win/scoped_process_suspend.h"
|
|
|
| @@ -46,6 +49,8 @@ unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException(
|
| WinVMAddress debug_critical_section_address) {
|
| const unsigned int kFailedTerminationCode = 0xffff7002;
|
|
|
| + Metrics::ExceptionEncountered();
|
| +
|
| ScopedProcessSuspend suspend(process);
|
|
|
| ProcessSnapshotWin process_snapshot;
|
| @@ -54,6 +59,7 @@ unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException(
|
| exception_information_address,
|
| debug_critical_section_address)) {
|
| LOG(WARNING) << "ProcessSnapshotWin::Initialize failed";
|
| + Metrics::ExceptionCaptureResult(Metrics::CaptureResult::kSnapshotFailed);
|
| return kFailedTerminationCode;
|
| }
|
|
|
| @@ -61,6 +67,12 @@ unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException(
|
| // can terminate the process with the correct exit code.
|
| const unsigned int termination_code =
|
| process_snapshot.Exception()->Exception();
|
| + static_assert(
|
| + std::is_same<std::remove_const<decltype(termination_code)>::type,
|
| + decltype(process_snapshot.Exception()->Exception())>::value,
|
| + "expected ExceptionCode() and process termination code to match");
|
| +
|
| + Metrics::ExceptionCode(termination_code);
|
|
|
| CrashpadInfoClientOptions client_options;
|
| process_snapshot.GetCrashpadOptions(&client_options);
|
| @@ -82,6 +94,8 @@ unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException(
|
| database_->PrepareNewCrashReport(&new_report);
|
| if (database_status != CrashReportDatabase::kNoError) {
|
| LOG(ERROR) << "PrepareNewCrashReport failed";
|
| + Metrics::ExceptionCaptureResult(
|
| + Metrics::CaptureResult::kPrepareNewCrashReportFailed);
|
| return termination_code;
|
| }
|
|
|
| @@ -96,6 +110,8 @@ unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException(
|
| minidump.InitializeFromSnapshot(&process_snapshot);
|
| if (!minidump.WriteEverything(&file_writer)) {
|
| LOG(ERROR) << "WriteEverything failed";
|
| + Metrics::ExceptionCaptureResult(
|
| + Metrics::CaptureResult::kMinidumpWriteFailed);
|
| return termination_code;
|
| }
|
|
|
| @@ -105,12 +121,15 @@ unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException(
|
| database_status = database_->FinishedWritingCrashReport(new_report, &uuid);
|
| if (database_status != CrashReportDatabase::kNoError) {
|
| LOG(ERROR) << "FinishedWritingCrashReport failed";
|
| + Metrics::ExceptionCaptureResult(
|
| + Metrics::CaptureResult::kFinishedWritingCrashReportFailed);
|
| return termination_code;
|
| }
|
|
|
| upload_thread_->ReportPending();
|
| }
|
|
|
| + Metrics::ExceptionCaptureResult(Metrics::CaptureResult::kSuccess);
|
| return termination_code;
|
| }
|
|
|
|
|