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 #ifndef _CRASH_REPORTER_KERNEL_COLLECTOR_H_ | 5 #ifndef _CRASH_REPORTER_KERNEL_COLLECTOR_H_ |
6 #define _CRASH_REPORTER_KERNEL_COLLECTOR_H_ | 6 #define _CRASH_REPORTER_KERNEL_COLLECTOR_H_ |
7 | 7 |
| 8 #include <pcrecpp.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/file_path.h" | 12 #include "base/file_path.h" |
11 #include "crash-reporter/crash_collector.h" | 13 #include "crash-reporter/crash_collector.h" |
12 #include "gtest/gtest_prod.h" // for FRIEND_TEST | 14 #include "gtest/gtest_prod.h" // for FRIEND_TEST |
13 | 15 |
14 class FilePath; | 16 class FilePath; |
15 | 17 |
16 // Kernel crash collector. | 18 // Kernel crash collector. |
17 class KernelCollector : public CrashCollector { | 19 class KernelCollector : public CrashCollector { |
18 public: | 20 public: |
19 KernelCollector(); | 21 KernelCollector(); |
20 | 22 |
21 virtual ~KernelCollector(); | 23 virtual ~KernelCollector(); |
22 | 24 |
23 void OverridePreservedDumpPath(const FilePath &file_path); | 25 void OverridePreservedDumpPath(const FilePath &file_path); |
24 | 26 |
25 // Enable collection. | 27 // Enable collection. |
26 bool Enable(); | 28 bool Enable(); |
27 | 29 |
28 // Returns true if the kernel collection currently enabled. | 30 // Returns true if the kernel collection currently enabled. |
29 bool IsEnabled() { | 31 bool IsEnabled() { |
30 return is_enabled_; | 32 return is_enabled_; |
31 } | 33 } |
32 | 34 |
33 // Collect any preserved kernel crash dump. Returns true if there was | 35 // Collect any preserved kernel crash dump. Returns true if there was |
34 // a dump (even if there were problems storing the dump), false otherwise. | 36 // a dump (even if there were problems storing the dump), false otherwise. |
35 bool Collect(); | 37 bool Collect(); |
36 | 38 |
| 39 // Compute a stack signature string from a kernel dump. |
| 40 bool ComputeKernelStackSignature(const std::string &kernel_dump, |
| 41 std::string *kernel_signature, |
| 42 bool print_diagnostics); |
| 43 |
37 private: | 44 private: |
38 friend class KernelCollectorTest; | 45 friend class KernelCollectorTest; |
39 FRIEND_TEST(KernelCollectorTest, ClearPreservedDump); | 46 FRIEND_TEST(KernelCollectorTest, ClearPreservedDump); |
40 FRIEND_TEST(KernelCollectorTest, LoadPreservedDump); | 47 FRIEND_TEST(KernelCollectorTest, LoadPreservedDump); |
41 FRIEND_TEST(KernelCollectorTest, CollectOK); | 48 FRIEND_TEST(KernelCollectorTest, CollectOK); |
42 | 49 |
43 bool LoadPreservedDump(std::string *contents); | 50 bool LoadPreservedDump(std::string *contents); |
44 bool ClearPreservedDump(); | 51 bool ClearPreservedDump(); |
45 | 52 |
| 53 void ProcessStackTrace(pcrecpp::StringPiece kernel_dump, |
| 54 bool print_diagnostics, |
| 55 unsigned *hash, |
| 56 float *last_stack_timestamp); |
| 57 bool FindCrashingFunction(pcrecpp::StringPiece kernel_dump, |
| 58 bool print_diagnostics, |
| 59 float stack_trace_timestamp, |
| 60 std::string *crashing_function); |
| 61 bool FindPanicMessage(pcrecpp::StringPiece kernel_dump, |
| 62 bool print_diagnostics, |
| 63 std::string *panic_message); |
| 64 |
46 bool is_enabled_; | 65 bool is_enabled_; |
47 FilePath preserved_dump_path_; | 66 FilePath preserved_dump_path_; |
48 static const char kClearingSequence[]; | 67 static const char kClearingSequence[]; |
49 }; | 68 }; |
50 | 69 |
51 #endif // _CRASH_REPORTER_KERNEL_COLLECTOR_H_ | 70 #endif // _CRASH_REPORTER_KERNEL_COLLECTOR_H_ |
OLD | NEW |