| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 : public MinidumpModuleCodeViewRecordWriter { | 59 : public MinidumpModuleCodeViewRecordWriter { |
| 60 public: | 60 public: |
| 61 //! \brief Sets the name of the `.pdb` file being linked to. | 61 //! \brief Sets the name of the `.pdb` file being linked to. |
| 62 void SetPDBName(const std::string& pdb_name) { pdb_name_ = pdb_name; } | 62 void SetPDBName(const std::string& pdb_name) { pdb_name_ = pdb_name; } |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 MinidumpModuleCodeViewRecordPDBLinkWriter(); | 65 MinidumpModuleCodeViewRecordPDBLinkWriter(); |
| 66 virtual ~MinidumpModuleCodeViewRecordPDBLinkWriter(); | 66 virtual ~MinidumpModuleCodeViewRecordPDBLinkWriter(); |
| 67 | 67 |
| 68 // MinidumpWritable: | 68 // MinidumpWritable: |
| 69 virtual size_t SizeOfObject() override; | 69 size_t SizeOfObject() override; |
| 70 virtual bool WriteObject(FileWriterInterface* file_writer) override; | 70 bool WriteObject(FileWriterInterface* file_writer) override; |
| 71 | 71 |
| 72 //! \brief Returns a pointer to the raw CodeView record’s data. | 72 //! \brief Returns a pointer to the raw CodeView record’s data. |
| 73 //! | 73 //! |
| 74 //! Subclasses can use this to set fields in their codeview records other than | 74 //! Subclasses can use this to set fields in their codeview records other than |
| 75 //! the `pdb_name` field. | 75 //! the `pdb_name` field. |
| 76 CodeViewRecordType* codeview_record() { return &codeview_record_; } | 76 CodeViewRecordType* codeview_record() { return &codeview_record_; } |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 CodeViewRecordType codeview_record_; | 79 CodeViewRecordType codeview_record_; |
| 80 std::string pdb_name_; | 80 std::string pdb_name_; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 //! IMAGE_DEBUG_MISC::Unicode. | 147 //! IMAGE_DEBUG_MISC::Unicode. |
| 148 //! | 148 //! |
| 149 //! If \a utf16 is `true`, \a data will be treated as UTF-8 data and will be | 149 //! If \a utf16 is `true`, \a data will be treated as UTF-8 data and will be |
| 150 //! converted to UTF-16, and IMAGE_DEBUG_MISC::Unicode will be set to `1`. | 150 //! converted to UTF-16, and IMAGE_DEBUG_MISC::Unicode will be set to `1`. |
| 151 //! Otherwise, \a data will be used as-is and IMAGE_DEBUG_MISC::Unicode will | 151 //! Otherwise, \a data will be used as-is and IMAGE_DEBUG_MISC::Unicode will |
| 152 //! be set to `0`. | 152 //! be set to `0`. |
| 153 void SetData(const std::string& data, bool utf16); | 153 void SetData(const std::string& data, bool utf16); |
| 154 | 154 |
| 155 protected: | 155 protected: |
| 156 // MinidumpWritable: | 156 // MinidumpWritable: |
| 157 virtual bool Freeze() override; | 157 bool Freeze() override; |
| 158 virtual size_t SizeOfObject() override; | 158 size_t SizeOfObject() override; |
| 159 virtual bool WriteObject(FileWriterInterface* file_writer) override; | 159 bool WriteObject(FileWriterInterface* file_writer) override; |
| 160 | 160 |
| 161 private: | 161 private: |
| 162 IMAGE_DEBUG_MISC image_debug_misc_; | 162 IMAGE_DEBUG_MISC image_debug_misc_; |
| 163 std::string data_; | 163 std::string data_; |
| 164 string16 data_utf16_; | 164 string16 data_utf16_; |
| 165 | 165 |
| 166 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleMiscDebugRecordWriter); | 166 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleMiscDebugRecordWriter); |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 //! \brief The writer for a MINIDUMP_MODULE object in a minidump file. | 169 //! \brief The writer for a MINIDUMP_MODULE object in a minidump file. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 //! "IMAGE_DEBUG_MISC::VersionInfo::dwFileType" and \ref | 266 //! "IMAGE_DEBUG_MISC::VersionInfo::dwFileType" and \ref |
| 267 //! VS_FIXEDFILEINFO::dwFileSubtype | 267 //! VS_FIXEDFILEINFO::dwFileSubtype |
| 268 //! "IMAGE_DEBUG_MISC::VersionInfo::dwFileSubtype". | 268 //! "IMAGE_DEBUG_MISC::VersionInfo::dwFileSubtype". |
| 269 void SetFileTypeAndSubtype(uint32_t file_type, uint32_t file_subtype) { | 269 void SetFileTypeAndSubtype(uint32_t file_type, uint32_t file_subtype) { |
| 270 module_.VersionInfo.dwFileType = file_type; | 270 module_.VersionInfo.dwFileType = file_type; |
| 271 module_.VersionInfo.dwFileSubtype = file_subtype; | 271 module_.VersionInfo.dwFileSubtype = file_subtype; |
| 272 } | 272 } |
| 273 | 273 |
| 274 protected: | 274 protected: |
| 275 // MinidumpWritable: | 275 // MinidumpWritable: |
| 276 virtual bool Freeze() override; | 276 bool Freeze() override; |
| 277 virtual size_t SizeOfObject() override; | 277 size_t SizeOfObject() override; |
| 278 virtual std::vector<MinidumpWritable*> Children() override; | 278 std::vector<MinidumpWritable*> Children() override; |
| 279 virtual bool WriteObject(FileWriterInterface* file_writer) override; | 279 bool WriteObject(FileWriterInterface* file_writer) override; |
| 280 | 280 |
| 281 private: | 281 private: |
| 282 MINIDUMP_MODULE module_; | 282 MINIDUMP_MODULE module_; |
| 283 scoped_ptr<internal::MinidumpUTF16StringWriter> name_; | 283 scoped_ptr<internal::MinidumpUTF16StringWriter> name_; |
| 284 MinidumpModuleCodeViewRecordWriter* codeview_record_; // weak | 284 MinidumpModuleCodeViewRecordWriter* codeview_record_; // weak |
| 285 MinidumpModuleMiscDebugRecordWriter* misc_debug_record_; // weak | 285 MinidumpModuleMiscDebugRecordWriter* misc_debug_record_; // weak |
| 286 | 286 |
| 287 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleWriter); | 287 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleWriter); |
| 288 }; | 288 }; |
| 289 | 289 |
| 290 //! \brief The writer for a MINIDUMP_MODULE_LIST stream in a minidump file, | 290 //! \brief The writer for a MINIDUMP_MODULE_LIST stream in a minidump file, |
| 291 //! containing a list of MINIDUMP_MODULE objects. | 291 //! containing a list of MINIDUMP_MODULE objects. |
| 292 class MinidumpModuleListWriter final : public internal::MinidumpStreamWriter { | 292 class MinidumpModuleListWriter final : public internal::MinidumpStreamWriter { |
| 293 public: | 293 public: |
| 294 MinidumpModuleListWriter(); | 294 MinidumpModuleListWriter(); |
| 295 ~MinidumpModuleListWriter(); | 295 ~MinidumpModuleListWriter(); |
| 296 | 296 |
| 297 //! \brief Adds a MinidumpModuleWriter to the MINIDUMP_MODULE_LIST. | 297 //! \brief Adds a MinidumpModuleWriter to the MINIDUMP_MODULE_LIST. |
| 298 //! | 298 //! |
| 299 //! \a module will become a child of this object in the overall tree of | 299 //! \a module will become a child of this object in the overall tree of |
| 300 //! internal::MinidumpWritable objects. | 300 //! internal::MinidumpWritable objects. |
| 301 //! | 301 //! |
| 302 //! \note Valid in #kStateMutable. | 302 //! \note Valid in #kStateMutable. |
| 303 void AddModule(MinidumpModuleWriter* module); | 303 void AddModule(MinidumpModuleWriter* module); |
| 304 | 304 |
| 305 protected: | 305 protected: |
| 306 // MinidumpWritable: | 306 // MinidumpWritable: |
| 307 virtual bool Freeze() override; | 307 bool Freeze() override; |
| 308 virtual size_t SizeOfObject() override; | 308 size_t SizeOfObject() override; |
| 309 virtual std::vector<MinidumpWritable*> Children() override; | 309 std::vector<MinidumpWritable*> Children() override; |
| 310 virtual bool WriteObject(FileWriterInterface* file_writer) override; | 310 bool WriteObject(FileWriterInterface* file_writer) override; |
| 311 | 311 |
| 312 // MinidumpStreamWriter: | 312 // MinidumpStreamWriter: |
| 313 virtual MinidumpStreamType StreamType() const override; | 313 MinidumpStreamType StreamType() const override; |
| 314 | 314 |
| 315 private: | 315 private: |
| 316 MINIDUMP_MODULE_LIST module_list_base_; | 316 MINIDUMP_MODULE_LIST module_list_base_; |
| 317 std::vector<MinidumpModuleWriter*> modules_; // weak | 317 std::vector<MinidumpModuleWriter*> modules_; // weak |
| 318 | 318 |
| 319 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleListWriter); | 319 DISALLOW_COPY_AND_ASSIGN(MinidumpModuleListWriter); |
| 320 }; | 320 }; |
| 321 | 321 |
| 322 } // namespace crashpad | 322 } // namespace crashpad |
| 323 | 323 |
| 324 #endif // CRASHPAD_MINIDUMP_MINIDUMP_MODULE_WRITER_H_ | 324 #endif // CRASHPAD_MINIDUMP_MINIDUMP_MODULE_WRITER_H_ |
| OLD | NEW |