| 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 14 matching lines...) Expand all Loading... |
| 25 #include "base/basictypes.h" | 25 #include "base/basictypes.h" |
| 26 #include "base/memory/scoped_ptr.h" | 26 #include "base/memory/scoped_ptr.h" |
| 27 #include "base/strings/string16.h" | 27 #include "base/strings/string16.h" |
| 28 #include "minidump/minidump_extensions.h" | 28 #include "minidump/minidump_extensions.h" |
| 29 #include "minidump/minidump_stream_writer.h" | 29 #include "minidump/minidump_stream_writer.h" |
| 30 #include "minidump/minidump_writable.h" | 30 #include "minidump/minidump_writable.h" |
| 31 #include "util/stdlib/pointer_container.h" | 31 #include "util/stdlib/pointer_container.h" |
| 32 | 32 |
| 33 namespace crashpad { | 33 namespace crashpad { |
| 34 | 34 |
| 35 class ModuleSnapshot; |
| 36 |
| 35 namespace internal { | 37 namespace internal { |
| 36 class MinidumpUTF16StringWriter; | 38 class MinidumpUTF16StringWriter; |
| 37 } // namespace internal | 39 } // namespace internal |
| 38 | 40 |
| 39 //! \brief The base class for writers of CodeView records referenced by | 41 //! \brief The base class for writers of CodeView records referenced by |
| 40 //! MINIDUMP_MODULE::CvRecord in minidump files. | 42 //! MINIDUMP_MODULE::CvRecord in minidump files. |
| 41 class MinidumpModuleCodeViewRecordWriter : public internal::MinidumpWritable { | 43 class MinidumpModuleCodeViewRecordWriter : public internal::MinidumpWritable { |
| 42 public: | 44 public: |
| 43 ~MinidumpModuleCodeViewRecordWriter() override; | 45 ~MinidumpModuleCodeViewRecordWriter() override; |
| 44 | 46 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 class MinidumpModuleCodeViewRecordPDB70Writer final | 112 class MinidumpModuleCodeViewRecordPDB70Writer final |
| 111 : public internal::MinidumpModuleCodeViewRecordPDBLinkWriter< | 113 : public internal::MinidumpModuleCodeViewRecordPDBLinkWriter< |
| 112 MinidumpModuleCodeViewRecordPDB70> { | 114 MinidumpModuleCodeViewRecordPDB70> { |
| 113 public: | 115 public: |
| 114 MinidumpModuleCodeViewRecordPDB70Writer() | 116 MinidumpModuleCodeViewRecordPDB70Writer() |
| 115 : internal::MinidumpModuleCodeViewRecordPDBLinkWriter< | 117 : internal::MinidumpModuleCodeViewRecordPDBLinkWriter< |
| 116 MinidumpModuleCodeViewRecordPDB70>() {} | 118 MinidumpModuleCodeViewRecordPDB70>() {} |
| 117 | 119 |
| 118 ~MinidumpModuleCodeViewRecordPDB70Writer() override; | 120 ~MinidumpModuleCodeViewRecordPDB70Writer() override; |
| 119 | 121 |
| 122 //! \brief Initializes the MinidumpModuleCodeViewRecordPDB70 based on \a |
| 123 //! module_snapshot. |
| 124 //! |
| 125 //! \param[in] module_snapshot The module snapshot to use as source data. |
| 126 //! |
| 127 //! \note Valid in #kStateMutable. No mutator methods may be called before |
| 128 //! this method, and it is not normally necessary to call any mutator |
| 129 //! methods after this method. |
| 130 void InitializeFromSnapshot(const ModuleSnapshot* module_snapshot); |
| 131 |
| 120 //! \brief Sets MinidumpModuleCodeViewRecordPDB70::uuid and | 132 //! \brief Sets MinidumpModuleCodeViewRecordPDB70::uuid and |
| 121 //! MinidumpModuleCodeViewRecordPDB70::age. | 133 //! MinidumpModuleCodeViewRecordPDB70::age. |
| 122 void SetUUIDAndAge(const UUID& uuid, uint32_t age) { | 134 void SetUUIDAndAge(const UUID& uuid, uint32_t age) { |
| 123 codeview_record()->uuid = uuid; | 135 codeview_record()->uuid = uuid; |
| 124 codeview_record()->age = age; | 136 codeview_record()->age = age; |
| 125 } | 137 } |
| 126 | 138 |
| 127 private: | 139 private: |
| 128 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCodeViewRecordPDB70Writer); | 140 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCodeViewRecordPDB70Writer); |
| 129 }; | 141 }; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 //! | 181 //! |
| 170 //! Because MINIDUMP_MODULE objects only appear as elements of | 182 //! Because MINIDUMP_MODULE objects only appear as elements of |
| 171 //! MINIDUMP_MODULE_LIST objects, this class does not write any data on its own. | 183 //! MINIDUMP_MODULE_LIST objects, this class does not write any data on its own. |
| 172 //! It makes its MINIDUMP_MODULE data available to its MinidumpModuleListWriter | 184 //! It makes its MINIDUMP_MODULE data available to its MinidumpModuleListWriter |
| 173 //! parent, which writes it as part of a MINIDUMP_MODULE_LIST. | 185 //! parent, which writes it as part of a MINIDUMP_MODULE_LIST. |
| 174 class MinidumpModuleWriter final : public internal::MinidumpWritable { | 186 class MinidumpModuleWriter final : public internal::MinidumpWritable { |
| 175 public: | 187 public: |
| 176 MinidumpModuleWriter(); | 188 MinidumpModuleWriter(); |
| 177 ~MinidumpModuleWriter() override; | 189 ~MinidumpModuleWriter() override; |
| 178 | 190 |
| 191 //! \brief Initializes the MINIDUMP_MODULE based on \a module_snapshot. |
| 192 //! |
| 193 //! \param[in] module_snapshot The module snapshot to use as source data. |
| 194 //! |
| 195 //! \note Valid in #kStateMutable. No mutator methods may be called before |
| 196 //! this method, and it is not normally necessary to call any mutator |
| 197 //! methods after this method. |
| 198 void InitializeFromSnapshot(const ModuleSnapshot* module_snapshot); |
| 199 |
| 179 //! \brief Returns a MINIDUMP_MODULE referencing this object’s data. | 200 //! \brief Returns a MINIDUMP_MODULE referencing this object’s data. |
| 180 //! | 201 //! |
| 181 //! This method is expected to be called by a MinidumpModuleListWriter in | 202 //! This method is expected to be called by a MinidumpModuleListWriter in |
| 182 //! order to obtain a MINIDUMP_MODULE to include in its list. | 203 //! order to obtain a MINIDUMP_MODULE to include in its list. |
| 183 //! | 204 //! |
| 184 //! \note Valid in #kStateWritable. | 205 //! \note Valid in #kStateWritable. |
| 185 const MINIDUMP_MODULE* MinidumpModule() const; | 206 const MINIDUMP_MODULE* MinidumpModule() const; |
| 186 | 207 |
| 187 //! \brief Arranges for MINIDUMP_MODULE::ModuleNameRva to point to a | 208 //! \brief Arranges for MINIDUMP_MODULE::ModuleNameRva to point to a |
| 188 //! MINIDUMP_STRING containing \a name. | 209 //! MINIDUMP_STRING containing \a name. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleWriter); | 308 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleWriter); |
| 288 }; | 309 }; |
| 289 | 310 |
| 290 //! \brief The writer for a MINIDUMP_MODULE_LIST stream in a minidump file, | 311 //! \brief The writer for a MINIDUMP_MODULE_LIST stream in a minidump file, |
| 291 //! containing a list of MINIDUMP_MODULE objects. | 312 //! containing a list of MINIDUMP_MODULE objects. |
| 292 class MinidumpModuleListWriter final : public internal::MinidumpStreamWriter { | 313 class MinidumpModuleListWriter final : public internal::MinidumpStreamWriter { |
| 293 public: | 314 public: |
| 294 MinidumpModuleListWriter(); | 315 MinidumpModuleListWriter(); |
| 295 ~MinidumpModuleListWriter() override; | 316 ~MinidumpModuleListWriter() override; |
| 296 | 317 |
| 318 //! \brief Adds an initialized MINIDUMP_MODULE for each module in \a |
| 319 //! module_snapshots to the MINIDUMP_MODULE_LIST. |
| 320 //! |
| 321 //! \param[in] module_snapshots The module snapshots to use as source data. |
| 322 //! |
| 323 //! \note Valid in #kStateMutable. No mutator methods may be called before |
| 324 //! this method, and it is not normally necessary to call any mutator |
| 325 //! methods after this method. |
| 326 void InitializeFromSnapshot( |
| 327 const std::vector<const ModuleSnapshot*>& module_snapshots); |
| 328 |
| 297 //! \brief Adds a MinidumpModuleWriter to the MINIDUMP_MODULE_LIST. | 329 //! \brief Adds a MinidumpModuleWriter to the MINIDUMP_MODULE_LIST. |
| 298 //! | 330 //! |
| 299 //! This object takes ownership of \a module and becomes its parent in the | 331 //! This object takes ownership of \a module and becomes its parent in the |
| 300 //! overall tree of internal::MinidumpWritable objects. | 332 //! overall tree of internal::MinidumpWritable objects. |
| 301 //! | 333 //! |
| 302 //! \note Valid in #kStateMutable. | 334 //! \note Valid in #kStateMutable. |
| 303 void AddModule(scoped_ptr<MinidumpModuleWriter> module); | 335 void AddModule(scoped_ptr<MinidumpModuleWriter> module); |
| 304 | 336 |
| 305 protected: | 337 protected: |
| 306 // MinidumpWritable: | 338 // MinidumpWritable: |
| 307 bool Freeze() override; | 339 bool Freeze() override; |
| 308 size_t SizeOfObject() override; | 340 size_t SizeOfObject() override; |
| 309 std::vector<MinidumpWritable*> Children() override; | 341 std::vector<MinidumpWritable*> Children() override; |
| 310 bool WriteObject(FileWriterInterface* file_writer) override; | 342 bool WriteObject(FileWriterInterface* file_writer) override; |
| 311 | 343 |
| 312 // MinidumpStreamWriter: | 344 // MinidumpStreamWriter: |
| 313 MinidumpStreamType StreamType() const override; | 345 MinidumpStreamType StreamType() const override; |
| 314 | 346 |
| 315 private: | 347 private: |
| 316 MINIDUMP_MODULE_LIST module_list_base_; | 348 MINIDUMP_MODULE_LIST module_list_base_; |
| 317 PointerVector<MinidumpModuleWriter> modules_; | 349 PointerVector<MinidumpModuleWriter> modules_; |
| 318 | 350 |
| 319 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleListWriter); | 351 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleListWriter); |
| 320 }; | 352 }; |
| 321 | 353 |
| 322 } // namespace crashpad | 354 } // namespace crashpad |
| 323 | 355 |
| 324 #endif // CRASHPAD_MINIDUMP_MINIDUMP_MODULE_WRITER_H_ | 356 #endif // CRASHPAD_MINIDUMP_MINIDUMP_MODULE_WRITER_H_ |
| OLD | NEW |