OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (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 |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 |
| 15 #ifndef CRASHPAD_SNAPSHOT_MAC_MODULE_SNAPSHOT_MAC_H_ |
| 16 #define CRASHPAD_SNAPSHOT_MAC_MODULE_SNAPSHOT_MAC_H_ |
| 17 |
| 18 #include <stdint.h> |
| 19 #include <sys/types.h> |
| 20 |
| 21 #include <map> |
| 22 #include <string> |
| 23 #include <vector> |
| 24 |
| 25 #include "base/basictypes.h" |
| 26 #include "snapshot/mac/process_reader.h" |
| 27 #include "snapshot/module_snapshot.h" |
| 28 #include "util/misc/initialization_state_dcheck.h" |
| 29 |
| 30 namespace crashpad { |
| 31 |
| 32 class MachOImageReader; |
| 33 struct UUID; |
| 34 |
| 35 namespace internal { |
| 36 |
| 37 //! \brief A ModuleSnapshot of a code module (binary image) loaded into a |
| 38 //! running (or crashed) process on a Mac OS X system. |
| 39 class ModuleSnapshotMac final : public ModuleSnapshot { |
| 40 public: |
| 41 ModuleSnapshotMac(); |
| 42 ~ModuleSnapshotMac(); |
| 43 |
| 44 //! \brief Initializes the object. |
| 45 //! |
| 46 //! \param[in] process_reader A ProcessReader for the task containing the |
| 47 //! module. |
| 48 //! \param[in] process_reader_module The module within the ProcessReader for |
| 49 //! which the snapshot should be created. |
| 50 //! |
| 51 //! \return `true` if the snapshot could be created, `false` otherwise with |
| 52 //! an appropriate message logged. |
| 53 bool Initialize(ProcessReader* process_reader, |
| 54 const ProcessReader::Module& process_reader_module); |
| 55 |
| 56 // ModuleSnapshot: |
| 57 |
| 58 std::string Name() const override; |
| 59 uint64_t Address() const override; |
| 60 uint64_t Size() const override; |
| 61 time_t Timestamp() const override; |
| 62 void FileVersion(uint16_t* version_0, |
| 63 uint16_t* version_1, |
| 64 uint16_t* version_2, |
| 65 uint16_t* version_3) const override; |
| 66 void SourceVersion(uint16_t* version_0, |
| 67 uint16_t* version_1, |
| 68 uint16_t* version_2, |
| 69 uint16_t* version_3) const override; |
| 70 ModuleType GetModuleType() const override; |
| 71 void UUID(crashpad::UUID* uuid) const override; |
| 72 std::vector<std::string> AnnotationsVector() const override; |
| 73 std::map<std::string, std::string> AnnotationsSimpleMap() const override; |
| 74 |
| 75 private: |
| 76 std::string name_; |
| 77 time_t timestamp_; |
| 78 const MachOImageReader* mach_o_image_reader_; // weak |
| 79 ProcessReader* process_reader_; // weak |
| 80 InitializationStateDcheck initialized_; |
| 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(ModuleSnapshotMac); |
| 83 }; |
| 84 |
| 85 } // namespace internal |
| 86 } // namespace crashpad |
| 87 |
| 88 #endif // CRASHPAD_SNAPSHOT_MAC_MODULE_SNAPSHOT_MAC_H_ |
OLD | NEW |