| 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 #include <psapi.h> | 8 #include <psapi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 // any kind of failure. | 472 // any kind of failure. |
| 473 base::File dump_file(dump_file_path, base::File::FLAG_OPEN | | 473 base::File dump_file(dump_file_path, base::File::FLAG_OPEN | |
| 474 base::File::FLAG_READ | | 474 base::File::FLAG_READ | |
| 475 base::File::FLAG_WRITE | | 475 base::File::FLAG_WRITE | |
| 476 base::File::FLAG_DELETE_ON_CLOSE); | 476 base::File::FLAG_DELETE_ON_CLOSE); |
| 477 if (!dump_file.IsValid()) | 477 if (!dump_file.IsValid()) |
| 478 return false; | 478 return false; |
| 479 | 479 |
| 480 uint32_t minidump_type = MiniDumpWithUnloadedModules | | 480 uint32_t minidump_type = MiniDumpWithUnloadedModules | |
| 481 MiniDumpWithProcessThreadData | | 481 MiniDumpWithProcessThreadData | |
| 482 MiniDumpWithFullMemoryInfo | |
| 482 MiniDumpWithThreadInfo; | 483 MiniDumpWithThreadInfo; |
| 483 | 484 |
| 484 // Capture more detail for canary and dev channels. The prefix search caters | 485 // Capture more detail for canary and dev channels. The prefix search caters |
| 485 // for the soon to be outdated "-m" suffixed multi-install channels. | 486 // for the soon to be outdated "-m" suffixed multi-install channels. |
| 486 if (channel.find("canary") == 0 || channel.find("dev") == 0) | 487 if (channel.find("canary") == 0 || channel.find("dev") == 0) |
| 487 minidump_type |= MiniDumpWithIndirectlyReferencedMemory; | 488 minidump_type |= MiniDumpWithIndirectlyReferencedMemory; |
| 488 | 489 |
| 489 // Write the minidump to the temp file, and then copy the data to the | 490 // Write the minidump to the temp file, and then copy the data to the |
| 490 // Crashpad-provided handle, as the latter is only open for write. | 491 // Crashpad-provided handle, as the latter is only open for write. |
| 491 if (!MiniDumpWriteDumpWithCrashpadInfo(process_, minidump_type, &exc_info, | 492 if (!MiniDumpWriteDumpWithCrashpadInfo(process_, minidump_type, &exc_info, |
| 492 crash_keys, client_id, report->uuid, | 493 crash_keys, client_id, report->uuid, |
| 493 &dump_file) || | 494 &dump_file) || |
| 494 !AppendFileContents(&dump_file, report->handle)) { | 495 !AppendFileContents(&dump_file, report->handle)) { |
| 495 return false; | 496 return false; |
| 496 } | 497 } |
| 497 | 498 |
| 498 on_error.Disarm(); | 499 on_error.Disarm(); |
| 499 | 500 |
| 500 crashpad::UUID report_id = {}; | 501 crashpad::UUID report_id = {}; |
| 501 status = database->FinishedWritingCrashReport(report, &report_id); | 502 status = database->FinishedWritingCrashReport(report, &report_id); |
| 502 if (status != crashpad::CrashReportDatabase::kNoError) | 503 if (status != crashpad::CrashReportDatabase::kNoError) |
| 503 return false; | 504 return false; |
| 504 | 505 |
| 505 return true; | 506 return true; |
| 506 } | 507 } |
| 507 | 508 |
| 508 } // namespace crash_reporter | 509 } // namespace crash_reporter |
| OLD | NEW |