OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | |
Robert Sesek
2015/03/04 01:52:25
2015
| |
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_MINIDUMP_MODULE_SNAPSHOT_MINIDUMP_H_ | |
16 #define CRASHPAD_SNAPSHOT_MINIDUMP_MODULE_SNAPSHOT_MINIDUMP_H_ | |
17 | |
18 #include <windows.h> | |
19 #include <dbghelp.h> | |
20 #include <stdint.h> | |
21 #include <sys/types.h> | |
22 | |
23 #include <map> | |
24 #include <string> | |
25 #include <vector> | |
26 | |
27 #include "base/basictypes.h" | |
28 #include "snapshot/module_snapshot.h" | |
29 #include "util/file/file_reader.h" | |
30 #include "util/misc/initialization_state_dcheck.h" | |
31 | |
32 namespace crashpad { | |
33 namespace internal { | |
34 | |
35 //! \brief A ModuleSnapshot based on a module in a minidump file. | |
36 class ModuleSnapshotMinidump final : public ModuleSnapshot { | |
37 public: | |
38 ModuleSnapshotMinidump(); | |
39 ~ModuleSnapshotMinidump() override; | |
40 | |
41 //! \brief Initializes the object. | |
42 //! | |
43 //! \param[in] file_reader A file reader corresponding to a minidump file. | |
44 //! The file reader must support seeking. | |
Robert Sesek
2015/03/04 01:52:25
Optional and out of scope: Go does a nice thing wh
| |
45 //! \param[in] minidump_module_rva The file offset in \a file_reader at which | |
46 //! the module’s MINIDUMP_MODULE structure is located. | |
47 //! \param[in] minidump_crashpad_module_info_location The location in \a | |
48 //! file_reader at which the module’s corresponding | |
49 //! MinidumpModuleCrashpadInfo structure is located. If no such | |
50 //! corresponding structure is available for a module, this may be | |
51 //! `nullptr`. | |
52 //! | |
53 //! \return `true` if the snapshot could be created, `false` otherwise with | |
54 //! an appropriate message logged. A failure to read | |
55 //! MinidumpModuleCrashpadInfo is not considered a failure, although | |
56 //! a message will be logged in this case. | |
57 bool Initialize(FileReaderInterface* file_reader, | |
58 RVA minidump_module_rva, | |
59 const MINIDUMP_LOCATION_DESCRIPTOR* | |
60 minidump_crashpad_module_info_location); | |
61 | |
62 // ModuleSnapshot: | |
63 | |
64 std::string Name() const override; | |
65 uint64_t Address() const override; | |
66 uint64_t Size() const override; | |
67 time_t Timestamp() const override; | |
68 void FileVersion(uint16_t* version_0, | |
69 uint16_t* version_1, | |
70 uint16_t* version_2, | |
71 uint16_t* version_3) const override; | |
72 void SourceVersion(uint16_t* version_0, | |
73 uint16_t* version_1, | |
74 uint16_t* version_2, | |
75 uint16_t* version_3) const override; | |
76 ModuleType GetModuleType() const override; | |
77 void UUID(crashpad::UUID* uuid) const override; | |
78 std::vector<std::string> AnnotationsVector() const override; | |
79 std::map<std::string, std::string> AnnotationsSimpleMap() const override; | |
80 | |
81 private: | |
82 // Initializes data carried in a MinidumpModuleCrashpadInfo structure on | |
83 // behalf of Initialize(). | |
84 void InitializeModuleCrashpadInfo(FileReaderInterface* file_reader, | |
85 const MINIDUMP_LOCATION_DESCRIPTOR* | |
86 minidump_module_crashpad_info_location); | |
87 | |
88 MINIDUMP_MODULE minidump_module_; | |
89 std::vector<std::string> annotations_vector_; | |
90 std::map<std::string, std::string> annotations_simple_map_; | |
91 InitializationStateDcheck initialized_; | |
92 | |
93 DISALLOW_COPY_AND_ASSIGN(ModuleSnapshotMinidump); | |
94 }; | |
95 | |
96 } // namespace internal | |
97 } // namespace crashpad | |
98 | |
99 #endif // CRASHPAD_SNAPSHOT_MINIDUMP_MODULE_SNAPSHOT_MINIDUMP_H_ | |
OLD | NEW |