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

Unified Diff: crash_reporter.cc

Issue 4018008: crash-reporter: Generate kernel crash signatures for server-side grouping of similar crashes (Closed) Base URL: http://git.chromium.org/git/crash-reporter.git
Patch Set: Respond to petkov review Created 10 years, 2 months 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 | « crash_collector_test.cc ('k') | crash_sender » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crash_reporter.cc
diff --git a/crash_reporter.cc b/crash_reporter.cc
index 2f8e987dba4f37d40492837627d1bb4315637cd6..07dcd9c5c647b5120384ff9cac8e4cafd12bc0e9 100644
--- a/crash_reporter.cc
+++ b/crash_reporter.cc
@@ -18,6 +18,8 @@
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
DEFINE_bool(init, false, "Initialize crash logging");
DEFINE_bool(clean_shutdown, false, "Signal clean shutdown");
+DEFINE_string(generate_kernel_signature, "",
+ "Generate signature from given kcrash file");
DEFINE_bool(crash_test, false, "Crash test");
DEFINE_int32(pid, -1, "Crashing PID");
DEFINE_int32(signal, -1, "Signal causing crash");
@@ -146,6 +148,25 @@ static int HandleUserCrash(UserCollector *user_collector) {
return 0;
}
+// Interactive/diagnostics mode for generating kernel crash signatures.
+static int GenerateKernelSignature(KernelCollector *kernel_collector) {
+ std::string kcrash_contents;
+ std::string signature;
+ if (!file_util::ReadFileToString(FilePath(FLAGS_generate_kernel_signature),
+ &kcrash_contents)) {
+ fprintf(stderr, "Could not read file.\n");
+ return 1;
+ }
+ if (!kernel_collector->ComputeKernelStackSignature(
+ kcrash_contents,
+ &signature,
+ true)) {
+ fprintf(stderr, "Signature could not be generated.\n");
+ return 1;
+ }
+ printf("Kernel crash signature is \"%s\".\n", signature.c_str());
+ return 0;
+}
int main(int argc, char *argv[]) {
google::ParseCommandLineFlags(&argc, &argv, true);
@@ -185,5 +206,9 @@ int main(int argc, char *argv[]) {
return 0;
}
+ if (!FLAGS_generate_kernel_signature.empty()) {
+ return GenerateKernelSignature(&kernel_collector);
+ }
+
return HandleUserCrash(&user_collector);
}
« no previous file with comments | « crash_collector_test.cc ('k') | crash_sender » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698