OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "crash/system_logging.h" | 10 #include "crash/system_logging.h" |
11 #include "crash/user_collector.h" | 11 #include "crash/user_collector.h" |
12 #include "gflags/gflags.h" | 12 #include "gflags/gflags.h" |
13 #include "metrics/metrics_library.h" | 13 #include "metrics/metrics_library.h" |
14 | 14 |
| 15 #pragma GCC diagnostic ignored "-Wstrict-aliasing" |
15 DEFINE_bool(init, false, "Initialize crash logging"); | 16 DEFINE_bool(init, false, "Initialize crash logging"); |
16 DEFINE_bool(clean_shutdown, false, "Signal clean shutdown"); | 17 DEFINE_bool(clean_shutdown, false, "Signal clean shutdown"); |
17 DEFINE_string(exec, "", "Executable name crashed"); | 18 DEFINE_string(exec, "", "Executable name crashed"); |
18 DEFINE_int32(pid, -1, "Crashing PID"); | 19 DEFINE_int32(pid, -1, "Crashing PID"); |
19 DEFINE_int32(signal, -1, "Signal causing crash"); | 20 DEFINE_int32(signal, -1, "Signal causing crash"); |
20 DEFINE_bool(unclean_check, true, "Check for unclean shutdown"); | 21 DEFINE_bool(unclean_check, true, "Check for unclean shutdown"); |
| 22 #pragma GCC diagnostic error "-Wstrict-aliasing" |
21 | 23 |
22 static const char kCrashCounterHistogram[] = "Logging.CrashCounter"; | 24 static const char kCrashCounterHistogram[] = "Logging.CrashCounter"; |
23 static const char kUncleanShutdownFile[] = | 25 static const char kUncleanShutdownFile[] = |
24 "/var/lib/crash_reporter/pending_clean_shutdown"; | 26 "/var/lib/crash_reporter/pending_clean_shutdown"; |
25 | 27 |
26 // Enumeration of kinds of crashes to be used in the CrashCounter histogram. | 28 // Enumeration of kinds of crashes to be used in the CrashCounter histogram. |
27 enum CrashKinds { | 29 enum CrashKinds { |
28 CRASH_KIND_KERNEL = 1, | 30 CRASH_KIND_KERNEL = 1, |
29 CRASH_KIND_USER = 2, | 31 CRASH_KIND_USER = 2, |
30 CRASH_KIND_MAX | 32 CRASH_KIND_MAX |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 110 |
109 // Handle a specific user space crash. | 111 // Handle a specific user space crash. |
110 CHECK(FLAGS_signal != -1) << "Signal must be set"; | 112 CHECK(FLAGS_signal != -1) << "Signal must be set"; |
111 CHECK(FLAGS_pid != -1) << "PID must be set"; | 113 CHECK(FLAGS_pid != -1) << "PID must be set"; |
112 CHECK(FLAGS_exec != "") << "Executable name must be set"; | 114 CHECK(FLAGS_exec != "") << "Executable name must be set"; |
113 | 115 |
114 user_collector.HandleCrash(FLAGS_signal, FLAGS_pid, FLAGS_exec); | 116 user_collector.HandleCrash(FLAGS_signal, FLAGS_pid, FLAGS_exec); |
115 | 117 |
116 return 0; | 118 return 0; |
117 } | 119 } |
OLD | NEW |