Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Unified Diff: user_collector.cc

Issue 5814001: crash-reporter: Capture and send recent update_engine logs when it crashes (Closed) Base URL: http://git.chromium.org/git/crash-reporter.git@master
Patch Set: Respond to petkov review Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « user_collector.h ('k') | user_collector_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: user_collector.cc
diff --git a/user_collector.cc b/user_collector.cc
index f15c5783d130e040fd6d7b030195ef7b015b37d9..59b460bdca6ae261cfa8bfe2890170a5fc91c2f5 100644
--- a/user_collector.cc
+++ b/user_collector.cc
@@ -30,15 +30,22 @@ static const char kCollectionErrorSignature[] =
// instead pipe the core file into a user space process. See
// core(5) man page.
static const char kCorePatternFile[] = "/proc/sys/kernel/core_pattern";
+static const char kCorePipeLimitFile[] = "/proc/sys/kernel/core_pipe_limit";
+// Set core_pipe_limit to 4 so that we can catch a few unrelated concurrent
+// crashes, but finite to avoid infinitely recursing on crash handling.
+static const char kCorePipeLimit[] = "4";
petkov 2010/12/14 18:58:58 the CL description says more than 2 crashes.
static const char kCoreToMinidumpConverterPath[] = "/usr/bin/core2md";
static const char kLeaveCoreFile[] = "/root/.leave_core";
+static const char kDefaultLogConfig[] = "/etc/crash_reporter_logs.conf";
+
const char *UserCollector::kUserId = "Uid:\t";
const char *UserCollector::kGroupId = "Gid:\t";
UserCollector::UserCollector()
: generate_diagnostics_(false),
core_pattern_file_(kCorePatternFile),
+ core_pipe_limit_file_(kCorePipeLimitFile),
initialized_(false) {
}
@@ -71,6 +78,13 @@ bool UserCollector::SetUpInternal(bool enabled) {
CHECK(initialized_);
logger_->LogInfo("%s user crash handling",
enabled ? "Enabling" : "Disabling");
+ if (file_util::WriteFile(FilePath(core_pipe_limit_file_),
+ kCorePipeLimit,
+ strlen(kCorePipeLimit)) !=
+ static_cast<int>(strlen(kCorePipeLimit))) {
+ logger_->LogError("Unable to write %s", core_pipe_limit_file_.c_str());
+ return false;
+ }
std::string pattern = GetPattern(enabled);
if (file_util::WriteFile(FilePath(core_pattern_file_),
pattern.c_str(),
@@ -332,6 +346,10 @@ bool UserCollector::ConvertAndEnqueueCrash(int pid,
FilePath core_path = GetCrashPath(crash_path, dump_basename, "core");
FilePath meta_path = GetCrashPath(crash_path, dump_basename, "meta");
FilePath minidump_path = GetCrashPath(crash_path, dump_basename, "dmp");
+ FilePath log_path = GetCrashPath(crash_path, dump_basename, "log");
+
+ if (GetLogContents(FilePath(kDefaultLogConfig), exec, log_path))
+ AddCrashMetaData("log", log_path.value());
if (!ConvertCoreToMinidump(pid, container_dir, core_path,
minidump_path)) {
« no previous file with comments | « user_collector.h ('k') | user_collector_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698