OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROMECAST_CRASH_LINUX_DUMP_INFO_H_ |
| 6 #define CHROMECAST_CRASH_LINUX_DUMP_INFO_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "chromecast/crash/linux/minidump_params.h" |
| 12 |
| 13 namespace chromecast { |
| 14 |
| 15 // Class that encapsulates the construction and parsing of dump entries |
| 16 // in the log file. |
| 17 class DumpInfo { |
| 18 public: |
| 19 // Attempt to construct a DumpInfo object by parsing the given entry string |
| 20 // and extracting the contained information and populate the relevant |
| 21 // fields. |
| 22 explicit DumpInfo(const std::string& entry); |
| 23 |
| 24 // Attempt to construct a DumpInfo object that has the following info: |
| 25 // |
| 26 // -crashed_process_dump: the full path of the dump written |
| 27 // -crashed_process_logfile: the full path of the logfile written |
| 28 // -dump_time: the time of the dump written |
| 29 // -params: a structure containing other useful crash information |
| 30 // |
| 31 // As a result of construction, the |entry_| will be filled with the |
| 32 // appropriate string to add to the log file. |
| 33 DumpInfo(const std::string& crashed_process_dump, |
| 34 const std::string& crashed_process_logfile, |
| 35 const time_t& dump_time, |
| 36 const MinidumpParams& params); |
| 37 |
| 38 ~DumpInfo(); |
| 39 |
| 40 const std::string& crashed_process_dump() const { |
| 41 return crashed_process_dump_; |
| 42 } |
| 43 const std::string& logfile() const { return logfile_; } |
| 44 const time_t& dump_time() const { return dump_time_; } |
| 45 const std::string& entry() const { return entry_; } |
| 46 const MinidumpParams& params() const { return params_; } |
| 47 const bool valid() const { return valid_; } |
| 48 |
| 49 private: |
| 50 bool ParseEntry(const std::string& entry); |
| 51 bool SetDumpTimeFromString(const std::string& timestr); |
| 52 std::string GetEntryAsString(); |
| 53 |
| 54 std::string crashed_process_dump_; |
| 55 std::string logfile_; |
| 56 time_t dump_time_; |
| 57 std::string entry_; |
| 58 MinidumpParams params_; |
| 59 bool valid_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(DumpInfo); |
| 62 }; |
| 63 |
| 64 } // namespace chromecast |
| 65 |
| 66 #endif // CHROMECAST_CRASH_LINUX_DUMP_INFO_H_ |
OLD | NEW |