| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 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, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 #ifndef CRASHPAD_SNAPSHOT_MAC_MODULE_SNAPSHOT_MAC_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_WIN_MODULE_SNAPSHOT_WIN_H_ |
| 16 #define CRASHPAD_SNAPSHOT_MAC_MODULE_SNAPSHOT_MAC_H_ | 16 #define CRASHPAD_SNAPSHOT_WIN_MODULE_SNAPSHOT_WIN_H_ |
| 17 | 17 |
| 18 #include <stdint.h> | 18 #include <stdint.h> |
| 19 #include <sys/types.h> | 19 #include <sys/types.h> |
| 20 | 20 |
| 21 #include <map> | 21 #include <map> |
| 22 #include <string> | 22 #include <string> |
| 23 #include <vector> | 23 #include <vector> |
| 24 | 24 |
| 25 #include "base/basictypes.h" | 25 #include "base/basictypes.h" |
| 26 #include "client/crashpad_info.h" | 26 #include "base/memory/scoped_ptr.h" |
| 27 #include "snapshot/mac/crashpad_info_client_options.h" | 27 #include "snapshot/crashpad_info_client_options.h" |
| 28 #include "snapshot/mac/process_reader.h" | |
| 29 #include "snapshot/module_snapshot.h" | 28 #include "snapshot/module_snapshot.h" |
| 29 #include "snapshot/win/process_reader_win.h" |
| 30 #include "util/misc/initialization_state_dcheck.h" | 30 #include "util/misc/initialization_state_dcheck.h" |
| 31 #include "util/win/process_info.h" |
| 31 | 32 |
| 32 namespace crashpad { | 33 namespace crashpad { |
| 33 | 34 |
| 34 class MachOImageReader; | 35 class PEImageReader; |
| 35 struct UUID; | 36 struct UUID; |
| 36 | 37 |
| 37 namespace internal { | 38 namespace internal { |
| 38 | 39 |
| 39 //! \brief A ModuleSnapshot of a code module (binary image) loaded into a | 40 //! \brief A ModuleSnapshot of a code module (binary image) loaded into a |
| 40 //! running (or crashed) process on a Mac OS X system. | 41 //! running (or crashed) process on a Windows system. |
| 41 class ModuleSnapshotMac final : public ModuleSnapshot { | 42 class ModuleSnapshotWin final : public ModuleSnapshot { |
| 42 public: | 43 public: |
| 43 ModuleSnapshotMac(); | 44 ModuleSnapshotWin(); |
| 44 ~ModuleSnapshotMac() override; | 45 ~ModuleSnapshotWin() override; |
| 45 | 46 |
| 46 //! \brief Initializes the object. | 47 //! \brief Initializes the object. |
| 47 //! | 48 //! |
| 48 //! \param[in] process_reader A ProcessReader for the task containing the | 49 //! \param[in] process_reader A ProcessReader for the task containing the |
| 49 //! module. | 50 //! module. |
| 50 //! \param[in] process_reader_module The module within the ProcessReader for | 51 //! \param[in] process_reader_module The module within the ProcessReader for |
| 51 //! which the snapshot should be created. | 52 //! which the snapshot should be created. |
| 52 //! | 53 //! |
| 53 //! \return `true` if the snapshot could be created, `false` otherwise with | 54 //! \return `true` if the snapshot could be created, `false` otherwise with |
| 54 //! an appropriate message logged. | 55 //! an appropriate message logged. |
| 55 bool Initialize(ProcessReader* process_reader, | 56 bool Initialize(ProcessReaderWin* process_reader, |
| 56 const ProcessReader::Module& process_reader_module); | 57 const ProcessInfo::Module& process_reader_module); |
| 57 | 58 |
| 58 //! \brief Returns options from the module’s CrashpadInfo structure. | 59 //! \brief Returns options from the module's CrashpadInfo structure. |
| 59 //! | 60 //! |
| 60 //! \param[out] options Options set in the module’s CrashpadInfo structure. | 61 //! \param[out] options Options set in the module's CrashpadInfo structure. |
| 61 void GetCrashpadOptions(CrashpadInfoClientOptions* options); | 62 void GetCrashpadOptions(CrashpadInfoClientOptions* options); |
| 62 | 63 |
| 63 // ModuleSnapshot: | 64 // ModuleSnapshot: |
| 64 | 65 |
| 65 std::string Name() const override; | 66 std::string Name() const override; |
| 66 uint64_t Address() const override; | 67 uint64_t Address() const override; |
| 67 uint64_t Size() const override; | 68 uint64_t Size() const override; |
| 68 time_t Timestamp() const override; | 69 time_t Timestamp() const override; |
| 69 void FileVersion(uint16_t* version_0, | 70 void FileVersion(uint16_t* version_0, |
| 70 uint16_t* version_1, | 71 uint16_t* version_1, |
| 71 uint16_t* version_2, | 72 uint16_t* version_2, |
| 72 uint16_t* version_3) const override; | 73 uint16_t* version_3) const override; |
| 73 void SourceVersion(uint16_t* version_0, | 74 void SourceVersion(uint16_t* version_0, |
| 74 uint16_t* version_1, | 75 uint16_t* version_1, |
| 75 uint16_t* version_2, | 76 uint16_t* version_2, |
| 76 uint16_t* version_3) const override; | 77 uint16_t* version_3) const override; |
| 77 ModuleType GetModuleType() const override; | 78 ModuleType GetModuleType() const override; |
| 78 void UUID(crashpad::UUID* uuid) const override; | 79 void UUID(crashpad::UUID* uuid) const override; |
| 79 std::vector<std::string> AnnotationsVector() const override; | 80 std::vector<std::string> AnnotationsVector() const override; |
| 80 std::map<std::string, std::string> AnnotationsSimpleMap() const override; | 81 std::map<std::string, std::string> AnnotationsSimpleMap() const override; |
| 81 | 82 |
| 82 private: | 83 private: |
| 83 std::string name_; | 84 std::string name_; |
| 84 time_t timestamp_; | 85 time_t timestamp_; |
| 85 const MachOImageReader* mach_o_image_reader_; // weak | 86 scoped_ptr<PEImageReader> pe_image_reader_; |
| 86 ProcessReader* process_reader_; // weak | 87 ProcessReaderWin* process_reader_; // weak |
| 87 InitializationStateDcheck initialized_; | 88 InitializationStateDcheck initialized_; |
| 88 | 89 |
| 89 DISALLOW_COPY_AND_ASSIGN(ModuleSnapshotMac); | 90 DISALLOW_COPY_AND_ASSIGN(ModuleSnapshotWin); |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 } // namespace internal | 93 } // namespace internal |
| 93 } // namespace crashpad | 94 } // namespace crashpad |
| 94 | 95 |
| 95 #endif // CRASHPAD_SNAPSHOT_MAC_MODULE_SNAPSHOT_MAC_H_ | 96 #endif // CRASHPAD_SNAPSHOT_WIN_MODULE_SNAPSHOT_WIN_H_ |
| OLD | NEW |