OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 #include "base/basictypes.h" | 24 #include "base/basictypes.h" |
25 #include "base/memory/scoped_ptr.h" | 25 #include "base/memory/scoped_ptr.h" |
26 #include "minidump/minidump_extensions.h" | 26 #include "minidump/minidump_extensions.h" |
27 #include "minidump/minidump_stream_writer.h" | 27 #include "minidump/minidump_stream_writer.h" |
28 #include "minidump/minidump_writable.h" | 28 #include "minidump/minidump_writable.h" |
29 #include "util/stdlib/pointer_container.h" | 29 #include "util/stdlib/pointer_container.h" |
30 | 30 |
31 namespace crashpad { | 31 namespace crashpad { |
32 | 32 |
| 33 class ProcessSnapshot; |
| 34 |
33 //! \brief The root-level object in a minidump file. | 35 //! \brief The root-level object in a minidump file. |
34 //! | 36 //! |
35 //! This object writes a MINIDUMP_HEADER and list of MINIDUMP_DIRECTORY entries | 37 //! This object writes a MINIDUMP_HEADER and list of MINIDUMP_DIRECTORY entries |
36 //! to a minidump file. | 38 //! to a minidump file. |
37 class MinidumpFileWriter final : public internal::MinidumpWritable { | 39 class MinidumpFileWriter final : public internal::MinidumpWritable { |
38 public: | 40 public: |
39 MinidumpFileWriter(); | 41 MinidumpFileWriter(); |
40 ~MinidumpFileWriter() override; | 42 ~MinidumpFileWriter() override; |
41 | 43 |
| 44 //! \brief Initializes the MinidumpFileWriter and populates it with |
| 45 //! appropriate child streams based on \a process_snapshot. |
| 46 //! |
| 47 //! This method will add additional streams to the minidump file as children |
| 48 //! of the MinidumpFileWriter object and as pointees of the top-level |
| 49 //! MINIDUMP_DIRECTORY. To do so, it will obtain other snapshot information |
| 50 //! from \a process_snapshot, such as a SystemSnapshot, lists of |
| 51 //! ThreadSnapshot and ModuleSnapshot objects, and, if available, an |
| 52 //! ExceptionSnapshot. |
| 53 //! |
| 54 //! The streams are added in the order that they are expected to be most |
| 55 //! useful to minidump readers, to improve data locality and minimize seeking. |
| 56 //! The streams are added in this order: |
| 57 //! - kMinidumpStreamTypeSystemInfo |
| 58 //! - kMinidumpStreamTypeMiscInfo |
| 59 //! - kMinidumpStreamTypeThreadList |
| 60 //! - kMinidumpStreamTypeException (if present) |
| 61 //! - kMinidumpStreamTypeModuleList |
| 62 //! - kMinidumpStreamTypeCrashpadInfo (if present) |
| 63 //! - kMinidumpStreamTypeMemoryList |
| 64 //! |
| 65 //! \param[in] process_snapshot The process snapshot to use as source data. |
| 66 //! |
| 67 //! \note Valid in #kStateMutable. No mutator methods may be called before |
| 68 //! this method, and it is not normally necessary to call any mutator |
| 69 //! methods after this method. |
| 70 void InitializeFromSnapshot(const ProcessSnapshot* process_snapshot); |
| 71 |
42 //! \brief Sets MINIDUMP_HEADER::Timestamp. | 72 //! \brief Sets MINIDUMP_HEADER::Timestamp. |
43 //! | 73 //! |
44 //! \note Valid in #kStateMutable. | 74 //! \note Valid in #kStateMutable. |
45 void SetTimestamp(time_t timestamp); | 75 void SetTimestamp(time_t timestamp); |
46 | 76 |
47 //! \brief Adds a stream to the minidump file and arranges for a | 77 //! \brief Adds a stream to the minidump file and arranges for a |
48 //! MINIDUMP_DIRECTORY entry to point to it. | 78 //! MINIDUMP_DIRECTORY entry to point to it. |
49 //! | 79 //! |
50 //! This object takes ownership of \a stream and becomes its parent in the | 80 //! This object takes ownership of \a stream and becomes its parent in the |
51 //! overall tree of internal::MinidumpWritable objects. | 81 //! overall tree of internal::MinidumpWritable objects. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 113 |
84 // Protects against multiple streams with the same ID being added. | 114 // Protects against multiple streams with the same ID being added. |
85 std::set<MinidumpStreamType> stream_types_; | 115 std::set<MinidumpStreamType> stream_types_; |
86 | 116 |
87 DISALLOW_COPY_AND_ASSIGN(MinidumpFileWriter); | 117 DISALLOW_COPY_AND_ASSIGN(MinidumpFileWriter); |
88 }; | 118 }; |
89 | 119 |
90 } // namespace crashpad | 120 } // namespace crashpad |
91 | 121 |
92 #endif // CRASHPAD_MINIDUMP_MINIDUMP_WRITER_H_ | 122 #endif // CRASHPAD_MINIDUMP_MINIDUMP_WRITER_H_ |
OLD | NEW |