| Index: components/browser_watcher/postmortem_report_collector.cc
|
| diff --git a/components/browser_watcher/postmortem_report_collector.cc b/components/browser_watcher/postmortem_report_collector.cc
|
| index 2b3d9d5a18509828040620859bca530d0d05397d..aa3845f22c3f01d7bd274b8e771745ba460045bd 100644
|
| --- a/components/browser_watcher/postmortem_report_collector.cc
|
| +++ b/components/browser_watcher/postmortem_report_collector.cc
|
| @@ -25,6 +25,7 @@ namespace browser_watcher {
|
| using ActivitySnapshot = base::debug::ThreadActivityAnalyzer::Snapshot;
|
| using base::debug::ActivityUserData;
|
| using base::debug::GlobalActivityAnalyzer;
|
| +using base::debug::GlobalActivityTracker;
|
| using base::debug::ThreadActivityAnalyzer;
|
| using crashpad::CrashReportDatabase;
|
|
|
| @@ -89,6 +90,39 @@ void CollectUserData(
|
| }
|
| }
|
|
|
| +void CollectModuleInformation(
|
| + const std::vector<GlobalActivityTracker::ModuleInfo>& modules,
|
| + ProcessState* process_state) {
|
| + DCHECK(process_state);
|
| +
|
| + char code_identifier[17];
|
| + char debug_identifier[41];
|
| +
|
| + for (const GlobalActivityTracker::ModuleInfo& recorded : modules) {
|
| + CodeModule* collected = process_state->add_modules();
|
| + collected->set_base_address(recorded.address);
|
| + collected->set_size(recorded.size);
|
| + collected->set_code_file(recorded.file);
|
| +
|
| + // Compute the code identifier using the required format.
|
| + snprintf(code_identifier, sizeof(code_identifier), "%08X%zx",
|
| + recorded.timestamp, recorded.size);
|
| + collected->set_code_identifier(code_identifier);
|
| + collected->set_debug_file(recorded.debug_file);
|
| +
|
| + // Compute the debug identifier using the required format.
|
| + const crashpad::UUID* uuid =
|
| + reinterpret_cast<const crashpad::UUID*>(recorded.identifier);
|
| + snprintf(debug_identifier, sizeof(debug_identifier),
|
| + "%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X%x", uuid->data_1,
|
| + uuid->data_2, uuid->data_3, uuid->data_4[0], uuid->data_4[1],
|
| + uuid->data_5[0], uuid->data_5[1], uuid->data_5[2], uuid->data_5[3],
|
| + uuid->data_5[4], uuid->data_5[5], recorded.age);
|
| + collected->set_debug_identifier(debug_identifier);
|
| + collected->set_is_unloaded(!recorded.is_loaded);
|
| + }
|
| +}
|
| +
|
| } // namespace
|
|
|
| PostmortemReportCollector::PostmortemReportCollector(
|
| @@ -273,6 +307,9 @@ PostmortemReportCollector::CollectionStatus PostmortemReportCollector::Collect(
|
| CollectThread(thread_analyzer->activity_snapshot(), thread_state);
|
| }
|
|
|
| + // Collect module information.
|
| + CollectModuleInformation(global_analyzer->GetModules(), process_state);
|
| +
|
| return SUCCESS;
|
| }
|
|
|
|
|