From ec7d7835a24884ed0e18317dc07af2fed2a50e64 Mon Sep 17 00:00:00 2001 From: Ben Chan Date: Mon, 9 Jan 2012 10:29:58 -0800 Subject: [PATCH] crash-reporter: Read core from stdin even if proc files are unsuable. This CL fixes commit c7c7914f49fbdef0d1f06c13854daabe176621ed such that UserCollector continues to read the core file from stdin even if the proc files are unusable. BUG=chromium-os:24820 TEST=Tested the following: 1. Build crash-reporter and run unit tests. 2. Run the following autotest tests on a Cr48: - logging_CrashSender - logging_UserCrash Change-Id: I04d09b15a80344b47f0512196c40e94384c5c323 Reviewed-on: https://gerrit.chromium.org/gerrit/13872 Reviewed-by: Ken Mixter Tested-by: Ben Chan Commit-Ready: Ben Chan --- crash_reporter/user_collector.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/crash_reporter/user_collector.cc b/crash_reporter/user_collector.cc index dffca9d37..308fe9ac9 100644 --- a/crash_reporter/user_collector.cc +++ b/crash_reporter/user_collector.cc @@ -265,7 +265,7 @@ bool UserCollector::CopyOffProcFiles(pid_t pid, return false; } } - return ValidateProcFiles(container_dir); + return true; } bool UserCollector::ValidateProcFiles(const FilePath &container_dir) { @@ -377,11 +377,19 @@ bool UserCollector::ConvertCoreToMinidump(pid_t pid, const FilePath &container_dir, const FilePath &core_path, const FilePath &minidump_path) { - if (!CopyOffProcFiles(pid, container_dir)) { + // If proc files are unuable, we continue to read the core file from stdin, + // but only skip the core-to-minidump conversion, so that we may still use + // the core file for debugging. + bool proc_files_usable = + CopyOffProcFiles(pid, container_dir) && ValidateProcFiles(container_dir); + + if (!CopyStdinToCoreFile(core_path)) { return false; } - if (!CopyStdinToCoreFile(core_path)) { + if (!proc_files_usable) { + LOG(INFO) << "Skipped converting core file to minidump due to " + << "unusable proc files"; return false; }