mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-10 06:36:02 +00:00
[fuchsia] early return in handler on disable
Tested:CQ Change-Id: Ifd742a7bfb213e4286bad582c81963e2fb383551 Reviewed-on: https://chromium-review.googlesource.com/c/1309156 Reviewed-by: Scott Graham <scottmg@chromium.org> Commit-Queue: Francois Rousseau <frousseau@google.com>
This commit is contained in:
parent
5dd094381c
commit
96391cb80f
@ -109,85 +109,87 @@ bool CrashReportExceptionHandler::HandleExceptionHandles(
|
|||||||
CrashpadInfoClientOptions client_options;
|
CrashpadInfoClientOptions client_options;
|
||||||
process_snapshot.GetCrashpadOptions(&client_options);
|
process_snapshot.GetCrashpadOptions(&client_options);
|
||||||
|
|
||||||
if (client_options.crashpad_handler_behavior != TriState::kDisabled) {
|
if (client_options.crashpad_handler_behavior == TriState::kDisabled) {
|
||||||
zx_exception_report_t report;
|
return true;
|
||||||
zx_status_t status = thread.get_info(ZX_INFO_THREAD_EXCEPTION_REPORT,
|
}
|
||||||
&report,
|
|
||||||
sizeof(report),
|
|
||||||
nullptr,
|
|
||||||
nullptr);
|
|
||||||
if (status != ZX_OK) {
|
|
||||||
ZX_LOG(ERROR, status)
|
|
||||||
<< "zx_object_get_info ZX_INFO_THREAD_EXCEPTION_REPORT";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
zx_koid_t thread_id = GetKoidForHandle(thread);
|
zx_exception_report_t report;
|
||||||
if (!process_snapshot.InitializeException(thread_id, report)) {
|
zx_status_t status = thread.get_info(ZX_INFO_THREAD_EXCEPTION_REPORT,
|
||||||
return false;
|
&report,
|
||||||
}
|
sizeof(report),
|
||||||
|
nullptr,
|
||||||
|
nullptr);
|
||||||
|
if (status != ZX_OK) {
|
||||||
|
ZX_LOG(ERROR, status)
|
||||||
|
<< "zx_object_get_info ZX_INFO_THREAD_EXCEPTION_REPORT";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
UUID client_id;
|
zx_koid_t thread_id = GetKoidForHandle(thread);
|
||||||
Settings* const settings = database_->GetSettings();
|
if (!process_snapshot.InitializeException(thread_id, report)) {
|
||||||
if (settings) {
|
return false;
|
||||||
// If GetSettings() or GetClientID() fails, something else will log a
|
}
|
||||||
// message and client_id will be left at its default value, all zeroes,
|
|
||||||
// which is appropriate.
|
|
||||||
settings->GetClientID(&client_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
process_snapshot.SetClientID(client_id);
|
UUID client_id;
|
||||||
process_snapshot.SetAnnotationsSimpleMap(*process_annotations_);
|
Settings* const settings = database_->GetSettings();
|
||||||
|
if (settings) {
|
||||||
|
// If GetSettings() or GetClientID() fails, something else will log a
|
||||||
|
// message and client_id will be left at its default value, all zeroes,
|
||||||
|
// which is appropriate.
|
||||||
|
settings->GetClientID(&client_id);
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<CrashReportDatabase::NewReport> new_report;
|
process_snapshot.SetClientID(client_id);
|
||||||
CrashReportDatabase::OperationStatus database_status =
|
process_snapshot.SetAnnotationsSimpleMap(*process_annotations_);
|
||||||
database_->PrepareNewCrashReport(&new_report);
|
|
||||||
if (database_status != CrashReportDatabase::kNoError) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
process_snapshot.SetReportID(new_report->ReportID());
|
std::unique_ptr<CrashReportDatabase::NewReport> new_report;
|
||||||
|
CrashReportDatabase::OperationStatus database_status =
|
||||||
|
database_->PrepareNewCrashReport(&new_report);
|
||||||
|
if (database_status != CrashReportDatabase::kNoError) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
MinidumpFileWriter minidump;
|
process_snapshot.SetReportID(new_report->ReportID());
|
||||||
minidump.InitializeFromSnapshot(&process_snapshot);
|
|
||||||
AddUserExtensionStreams(
|
|
||||||
user_stream_data_sources_, &process_snapshot, &minidump);
|
|
||||||
|
|
||||||
if (!minidump.WriteEverything(new_report->Writer())) {
|
MinidumpFileWriter minidump;
|
||||||
return false;
|
minidump.InitializeFromSnapshot(&process_snapshot);
|
||||||
}
|
AddUserExtensionStreams(
|
||||||
|
user_stream_data_sources_, &process_snapshot, &minidump);
|
||||||
|
|
||||||
if (process_attachments_) {
|
if (!minidump.WriteEverything(new_report->Writer())) {
|
||||||
// Note that attachments are read at this point each time rather than once
|
return false;
|
||||||
// so that if the contents of the file has changed it will be re-read for
|
}
|
||||||
// each upload (e.g. in the case of a log file).
|
|
||||||
for (const auto& it : *process_attachments_) {
|
if (process_attachments_) {
|
||||||
FileWriter* writer = new_report->AddAttachment(it.first);
|
// Note that attachments are read at this point each time rather than once
|
||||||
if (writer) {
|
// so that if the contents of the file has changed it will be re-read for
|
||||||
std::string contents;
|
// each upload (e.g. in the case of a log file).
|
||||||
if (!LoggingReadEntireFile(it.second, &contents)) {
|
for (const auto& it : *process_attachments_) {
|
||||||
// Not being able to read the file isn't considered fatal, and
|
FileWriter* writer = new_report->AddAttachment(it.first);
|
||||||
// should not prevent the report from being processed.
|
if (writer) {
|
||||||
continue;
|
std::string contents;
|
||||||
}
|
if (!LoggingReadEntireFile(it.second, &contents)) {
|
||||||
writer->Write(contents.data(), contents.size());
|
// Not being able to read the file isn't considered fatal, and
|
||||||
|
// should not prevent the report from being processed.
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
writer->Write(contents.data(), contents.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
database_status =
|
database_status =
|
||||||
database_->FinishedWritingCrashReport(std::move(new_report), &uuid);
|
database_->FinishedWritingCrashReport(std::move(new_report), &uuid);
|
||||||
if (database_status != CrashReportDatabase::kNoError) {
|
if (database_status != CrashReportDatabase::kNoError) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (local_report_id != nullptr) {
|
if (local_report_id != nullptr) {
|
||||||
*local_report_id = uuid;
|
*local_report_id = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upload_thread_) {
|
if (upload_thread_) {
|
||||||
upload_thread_->ReportPending(uuid);
|
upload_thread_->ReportPending(uuid);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user