Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/crash/content/app/fallback_crash_handler_win.h" | 5 #include "components/crash/content/app/fallback_crash_handler_win.h" |
| 6 | 6 |
| 7 #include <dbghelp.h> | 7 #include <dbghelp.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 crashpad::CrashReportDatabase::NewReport* report = nullptr; | 385 crashpad::CrashReportDatabase::NewReport* report = nullptr; |
| 386 crashpad::CrashReportDatabase::OperationStatus status = | 386 crashpad::CrashReportDatabase::OperationStatus status = |
| 387 database->PrepareNewCrashReport(&report); | 387 database->PrepareNewCrashReport(&report); |
| 388 if (status != crashpad::CrashReportDatabase::kNoError) | 388 if (status != crashpad::CrashReportDatabase::kNoError) |
| 389 return false; | 389 return false; |
| 390 | 390 |
| 391 // Make sure we release the report on early exit. | 391 // Make sure we release the report on early exit. |
| 392 crashpad::CrashReportDatabase::CallErrorWritingCrashReport on_error( | 392 crashpad::CrashReportDatabase::CallErrorWritingCrashReport on_error( |
| 393 database.get(), report); | 393 database.get(), report); |
| 394 | 394 |
| 395 // TODO(siggi): Go big on the detail here for Canary/Dev channels. | |
| 396 const uint32_t kMinidumpType = MiniDumpWithUnloadedModules | | |
| 397 MiniDumpWithProcessThreadData | | |
| 398 MiniDumpWithThreadInfo; | |
| 399 | |
| 400 MINIDUMP_EXCEPTION_INFORMATION exc_info = {}; | 395 MINIDUMP_EXCEPTION_INFORMATION exc_info = {}; |
| 401 exc_info.ThreadId = thread_id_; | 396 exc_info.ThreadId = thread_id_; |
| 402 exc_info.ExceptionPointers = | 397 exc_info.ExceptionPointers = |
| 403 reinterpret_cast<EXCEPTION_POINTERS*>(exception_ptrs_); | 398 reinterpret_cast<EXCEPTION_POINTERS*>(exception_ptrs_); |
| 404 exc_info.ClientPointers = TRUE; // ExceptionPointers in client. | 399 exc_info.ClientPointers = TRUE; // ExceptionPointers in client. |
| 405 | 400 |
| 406 // Mandatory crash keys. These will be read by Crashpad and used as | 401 // Mandatory crash keys. These will be read by Crashpad and used as |
| 407 // http request parameters for the upload. Keys and values need to match | 402 // http request parameters for the upload. Keys and values need to match |
| 408 // server side configuration. | 403 // server side configuration. |
| 409 #if defined(ARCH_CPU_64_BITS) | 404 #if defined(ARCH_CPU_64_BITS) |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 431 | 426 |
| 432 // Open the file with delete on close, to try and ensure it's cleaned up on | 427 // Open the file with delete on close, to try and ensure it's cleaned up on |
| 433 // any kind of failure. | 428 // any kind of failure. |
| 434 base::File dump_file(dump_file_path, base::File::FLAG_OPEN | | 429 base::File dump_file(dump_file_path, base::File::FLAG_OPEN | |
| 435 base::File::FLAG_READ | | 430 base::File::FLAG_READ | |
| 436 base::File::FLAG_WRITE | | 431 base::File::FLAG_WRITE | |
| 437 base::File::FLAG_DELETE_ON_CLOSE); | 432 base::File::FLAG_DELETE_ON_CLOSE); |
| 438 if (!dump_file.IsValid()) | 433 if (!dump_file.IsValid()) |
| 439 return false; | 434 return false; |
| 440 | 435 |
| 436 uint32_t minidump_type = MiniDumpWithUnloadedModules | | |
| 437 MiniDumpWithProcessThreadData | | |
| 438 MiniDumpWithThreadInfo; | |
| 439 | |
| 440 // Capture more detail for canary and dev channels. The prefix search caters | |
| 441 // for the soon to be outdated "-m" suffixed multi-install channels. | |
| 442 if (channel.find("canary") == 0 || channel.find("dev") == 0) | |
| 443 minidump_type |= MiniDumpWithIndirectlyReferencedMemory; | |
| 444 | |
| 445 | |
|
scottmg
2017/01/17 17:39:48
Extra \n here.
Sigurður Ásgeirsson
2017/01/17 17:53:19
Done.
| |
| 441 // Write the minidump to the temp file, and then copy the data to the | 446 // Write the minidump to the temp file, and then copy the data to the |
| 442 // Crashpad-provided handle, as the latter is only open for write. | 447 // Crashpad-provided handle, as the latter is only open for write. |
| 443 if (!MiniDumpWriteDumpWithCrashpadInfo(process_, kMinidumpType, &exc_info, | 448 if (!MiniDumpWriteDumpWithCrashpadInfo(process_, minidump_type, &exc_info, |
| 444 crash_keys, client_id, report->uuid, | 449 crash_keys, client_id, report->uuid, |
| 445 &dump_file) || | 450 &dump_file) || |
| 446 !AppendFileContents(&dump_file, report->handle)) { | 451 !AppendFileContents(&dump_file, report->handle)) { |
| 447 return false; | 452 return false; |
| 448 } | 453 } |
| 449 | 454 |
| 450 on_error.Disarm(); | 455 on_error.Disarm(); |
| 451 | 456 |
| 452 crashpad::UUID report_id = {}; | 457 crashpad::UUID report_id = {}; |
| 453 status = database->FinishedWritingCrashReport(report, &report_id); | 458 status = database->FinishedWritingCrashReport(report, &report_id); |
| 454 if (status != crashpad::CrashReportDatabase::kNoError) | 459 if (status != crashpad::CrashReportDatabase::kNoError) |
| 455 return false; | 460 return false; |
| 456 | 461 |
| 457 return true; | 462 return true; |
| 458 } | 463 } |
| 459 | 464 |
| 460 } // namespace crash_reporter | 465 } // namespace crash_reporter |
| OLD | NEW |