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_CRASH_COLLECTOR_H_ | 5 #ifndef _CRASH_REPORTER_CRASH_COLLECTOR_H_ |
6 #define _CRASH_REPORTER_CRASH_COLLECTOR_H_ | 6 #define _CRASH_REPORTER_CRASH_COLLECTOR_H_ |
7 | 7 |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 22 matching lines...) Expand all Loading... |
33 SystemLogging *logger); | 33 SystemLogging *logger); |
34 | 34 |
35 protected: | 35 protected: |
36 friend class CrashCollectorTest; | 36 friend class CrashCollectorTest; |
37 FRIEND_TEST(CrashCollectorTest, CheckHasCapacityCorrectBasename); | 37 FRIEND_TEST(CrashCollectorTest, CheckHasCapacityCorrectBasename); |
38 FRIEND_TEST(CrashCollectorTest, CheckHasCapacityStrangeNames); | 38 FRIEND_TEST(CrashCollectorTest, CheckHasCapacityStrangeNames); |
39 FRIEND_TEST(CrashCollectorTest, CheckHasCapacityUsual); | 39 FRIEND_TEST(CrashCollectorTest, CheckHasCapacityUsual); |
40 FRIEND_TEST(CrashCollectorTest, GetCrashDirectoryInfo); | 40 FRIEND_TEST(CrashCollectorTest, GetCrashDirectoryInfo); |
41 FRIEND_TEST(CrashCollectorTest, FormatDumpBasename); | 41 FRIEND_TEST(CrashCollectorTest, FormatDumpBasename); |
42 FRIEND_TEST(CrashCollectorTest, Initialize); | 42 FRIEND_TEST(CrashCollectorTest, Initialize); |
| 43 FRIEND_TEST(CrashCollectorTest, MetaData); |
43 FRIEND_TEST(CrashCollectorTest, ReadKeyValueFile); | 44 FRIEND_TEST(CrashCollectorTest, ReadKeyValueFile); |
44 FRIEND_TEST(CrashCollectorTest, Sanitize); | 45 FRIEND_TEST(CrashCollectorTest, Sanitize); |
45 | 46 |
46 // Set maximum enqueued crashes in a crash directory. | 47 // Set maximum enqueued crashes in a crash directory. |
47 static const int kMaxCrashDirectorySize; | 48 static const int kMaxCrashDirectorySize; |
48 | 49 |
49 // Return a filename that has only [a-z0-1_] characters by mapping | 50 // Return a filename that has only [a-z0-1_] characters by mapping |
50 // all others into '_'. | 51 // all others into '_'. |
51 std::string Sanitize(const std::string &name); | 52 std::string Sanitize(const std::string &name); |
52 | 53 |
(...skipping 27 matching lines...) Expand all Loading... |
80 // Check given crash directory still has remaining capacity for another | 81 // Check given crash directory still has remaining capacity for another |
81 // crash. | 82 // crash. |
82 bool CheckHasCapacity(const FilePath &crash_directory); | 83 bool CheckHasCapacity(const FilePath &crash_directory); |
83 | 84 |
84 // Read the given file of form [<key><separator><value>\n...] and return | 85 // Read the given file of form [<key><separator><value>\n...] and return |
85 // a map of its contents. | 86 // a map of its contents. |
86 bool ReadKeyValueFile(const FilePath &file, | 87 bool ReadKeyValueFile(const FilePath &file, |
87 char separator, | 88 char separator, |
88 std::map<std::string, std::string> *dictionary); | 89 std::map<std::string, std::string> *dictionary); |
89 | 90 |
| 91 // Add non-standard meta data to the crash metadata file. Call |
| 92 // before calling WriteCrashMetaData. Key must not contain "=" or |
| 93 // "\n" characters. Value must not contain "\n" characters. |
| 94 void AddCrashMetaData(const std::string &key, const std::string &value); |
| 95 |
90 // Write a file of metadata about crash. | 96 // Write a file of metadata about crash. |
91 void WriteCrashMetaData(const FilePath &meta_path, | 97 void WriteCrashMetaData(const FilePath &meta_path, |
92 const std::string &exec_name, | 98 const std::string &exec_name, |
93 const std::string &payload_path); | 99 const std::string &payload_path); |
94 | 100 |
95 CountCrashFunction count_crash_function_; | 101 CountCrashFunction count_crash_function_; |
96 IsFeedbackAllowedFunction is_feedback_allowed_function_; | 102 IsFeedbackAllowedFunction is_feedback_allowed_function_; |
97 SystemLogging *logger_; | 103 SystemLogging *logger_; |
| 104 std::string extra_metadata_; |
98 const char *forced_crash_directory_; | 105 const char *forced_crash_directory_; |
| 106 const char *lsb_release_; |
99 }; | 107 }; |
100 | 108 |
101 #endif // _CRASH_REPORTER_CRASH_COLLECTOR_H_ | 109 #endif // _CRASH_REPORTER_CRASH_COLLECTOR_H_ |
OLD | NEW |