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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 //! | 75 //! |
76 //! On some platforms, loadable modules are distinguished from shared | 76 //! On some platforms, loadable modules are distinguished from shared |
77 //! libraries. On these platforms, a shared library is a module that another | 77 //! libraries. On these platforms, a shared library is a module that another |
78 //! module links against directly, and a loadable module is not. Loadable | 78 //! module links against directly, and a loadable module is not. Loadable |
79 //! modules tend to be binary plug-ins. | 79 //! modules tend to be binary plug-ins. |
80 kModuleTypeLoadableModule, | 80 kModuleTypeLoadableModule, |
81 | 81 |
82 //! \brief The module is a dynamic loader. | 82 //! \brief The module is a dynamic loader. |
83 //! | 83 //! |
84 //! This is the module responsible for loading other modules. This is | 84 //! This is the module responsible for loading other modules. This is |
85 //! normally `dyld` for Mac OS X and `ld.so` for Linux and other systems | 85 //! normally `dyld` for macOS and `ld.so` for Linux and other systems using |
86 //! using ELF. | 86 //! ELF. |
87 kModuleTypeDynamicLoader, | 87 kModuleTypeDynamicLoader, |
88 }; | 88 }; |
89 | 89 |
90 //! \brief Returns the module’s pathname. | 90 //! \brief Returns the module’s pathname. |
91 virtual std::string Name() const = 0; | 91 virtual std::string Name() const = 0; |
92 | 92 |
93 //! \brief Returns the base address that the module is loaded at in the | 93 //! \brief Returns the base address that the module is loaded at in the |
94 //! snapshot process. | 94 //! snapshot process. |
95 virtual uint64_t Address() const = 0; | 95 virtual uint64_t Address() const = 0; |
96 | 96 |
97 //! \brief Returns the size that the module occupies in the snapshot process’ | 97 //! \brief Returns the size that the module occupies in the snapshot process’ |
98 //! address space, starting at its base address. | 98 //! address space, starting at its base address. |
99 //! | 99 //! |
100 //! For Mac OS X snapshots, this method only reports the size of the `__TEXT` | 100 //! For macOS snapshots, this method only reports the size of the `__TEXT` |
101 //! segment, because segments may not be loaded contiguously. | 101 //! segment, because segments may not be loaded contiguously. |
102 virtual uint64_t Size() const = 0; | 102 virtual uint64_t Size() const = 0; |
103 | 103 |
104 //! \brief Returns the module’s timestamp, if known. | 104 //! \brief Returns the module’s timestamp, if known. |
105 //! | 105 //! |
106 //! The timestamp is typically the modification time of the file that provided | 106 //! The timestamp is typically the modification time of the file that provided |
107 //! the module in `time_t` format, seconds since the POSIX epoch. If the | 107 //! the module in `time_t` format, seconds since the POSIX epoch. If the |
108 //! module’s timestamp is unknown, this method returns `0`. | 108 //! module’s timestamp is unknown, this method returns `0`. |
109 virtual time_t Timestamp() const = 0; | 109 virtual time_t Timestamp() const = 0; |
110 | 110 |
111 //! \brief Returns the module’s file version in the \a version_* parameters. | 111 //! \brief Returns the module’s file version in the \a version_* parameters. |
112 //! | 112 //! |
113 //! If no file version can be determined, the \a version_* parameters are set | 113 //! If no file version can be determined, the \a version_* parameters are set |
114 //! to `0`. | 114 //! to `0`. |
115 //! | 115 //! |
116 //! For Mac OS X snapshots, this is taken from the module’s `LC_ID_DYLIB` load | 116 //! For macOS snapshots, this is taken from the module’s `LC_ID_DYLIB` load |
117 //! command for shared libraries, and is `0` for other module types. | 117 //! command for shared libraries, and is `0` for other module types. |
118 virtual void FileVersion(uint16_t* version_0, | 118 virtual void FileVersion(uint16_t* version_0, |
119 uint16_t* version_1, | 119 uint16_t* version_1, |
120 uint16_t* version_2, | 120 uint16_t* version_2, |
121 uint16_t* version_3) const = 0; | 121 uint16_t* version_3) const = 0; |
122 | 122 |
123 //! \brief Returns the module’s source version in the \a version_* parameters. | 123 //! \brief Returns the module’s source version in the \a version_* parameters. |
124 //! | 124 //! |
125 //! If no source version can be determined, the \a version_* parameters are | 125 //! If no source version can be determined, the \a version_* parameters are |
126 //! set to `0`. | 126 //! set to `0`. |
127 //! | 127 //! |
128 //! For Mac OS X snapshots, this is taken from the module’s | 128 //! For macOS snapshots, this is taken from the module’s `LC_SOURCE_VERSION` |
129 //! `LC_SOURCE_VERSION` load command. | 129 //! load command. |
130 virtual void SourceVersion(uint16_t* version_0, | 130 virtual void SourceVersion(uint16_t* version_0, |
131 uint16_t* version_1, | 131 uint16_t* version_1, |
132 uint16_t* version_2, | 132 uint16_t* version_2, |
133 uint16_t* version_3) const = 0; | 133 uint16_t* version_3) const = 0; |
134 | 134 |
135 //! \brief Returns the module’s type. | 135 //! \brief Returns the module’s type. |
136 virtual ModuleType GetModuleType() const = 0; | 136 virtual ModuleType GetModuleType() const = 0; |
137 | 137 |
138 //! \brief Returns the module’s UUID in the \a uuid parameter, and the age of | 138 //! \brief Returns the module’s UUID in the \a uuid parameter, and the age of |
139 //! that UUID in \a age. | 139 //! that UUID in \a age. |
(...skipping 17 matching lines...) Expand all Loading... |
157 //! | 157 //! |
158 //! \sa UUIDAndAge() | 158 //! \sa UUIDAndAge() |
159 virtual std::string DebugFileName() const = 0; | 159 virtual std::string DebugFileName() const = 0; |
160 | 160 |
161 //! \brief Returns string annotations recorded in the module. | 161 //! \brief Returns string annotations recorded in the module. |
162 //! | 162 //! |
163 //! This method retrieves annotations recorded in a module. These annotations | 163 //! This method retrieves annotations recorded in a module. These annotations |
164 //! are intended for diagnostic use, including crash analysis. A module may | 164 //! are intended for diagnostic use, including crash analysis. A module may |
165 //! contain multiple annotations, so they are returned in a vector. | 165 //! contain multiple annotations, so they are returned in a vector. |
166 //! | 166 //! |
167 //! For Mac OS X snapshots, these annotations are found by interpreting the | 167 //! For macOS snapshots, these annotations are found by interpreting the |
168 //! module’s `__DATA,__crash_info` section as `crashreporter_annotations_t`. | 168 //! module’s `__DATA,__crash_info` section as `crashreporter_annotations_t`. |
169 //! System libraries using the crash reporter client interface may reference | 169 //! System libraries using the crash reporter client interface may reference |
170 //! annotations in this structure. Additional annotations messages may be | 170 //! annotations in this structure. Additional annotations messages may be |
171 //! found in other locations, which may be module-specific. The dynamic linker | 171 //! found in other locations, which may be module-specific. The dynamic linker |
172 //! (`dyld`) can provide an annotation at its `_error_string` symbol. | 172 //! (`dyld`) can provide an annotation at its `_error_string` symbol. |
173 //! | 173 //! |
174 //! The annotations returned by this method do not duplicate those returned by | 174 //! The annotations returned by this method do not duplicate those returned by |
175 //! AnnotationsSimpleMap(). | 175 //! AnnotationsSimpleMap(). |
176 virtual std::vector<std::string> AnnotationsVector() const = 0; | 176 virtual std::vector<std::string> AnnotationsVector() const = 0; |
177 | 177 |
178 //! \brief Returns key-value string annotations recorded in the module. | 178 //! \brief Returns key-value string annotations recorded in the module. |
179 //! | 179 //! |
180 //! This method retrieves annotations recorded in a module. These annotations | 180 //! This method retrieves annotations recorded in a module. These annotations |
181 //! are intended for diagnostic use, including crash analysis. “Simple | 181 //! are intended for diagnostic use, including crash analysis. “Simple |
182 //! annotations” are structured as a sequence of key-value pairs, where all | 182 //! annotations” are structured as a sequence of key-value pairs, where all |
183 //! keys and values are strings. These are referred to in Chrome as “crash | 183 //! keys and values are strings. These are referred to in Chrome as “crash |
184 //! keys.” | 184 //! keys.” |
185 //! | 185 //! |
186 //! For Mac OS X snapshots, these annotations are found by interpreting the | 186 //! For macOS snapshots, these annotations are found by interpreting the |
187 //! `__DATA,crashpad_info` section as `CrashpadInfo`. Clients can use the | 187 //! `__DATA,crashpad_info` section as `CrashpadInfo`. Clients can use the |
188 //! Crashpad client interface to store annotations in this structure. Most | 188 //! Crashpad client interface to store annotations in this structure. Most |
189 //! annotations under the client’s direct control will be retrievable by this | 189 //! annotations under the client’s direct control will be retrievable by this |
190 //! method. For clients such as Chrome, this includes the process type. | 190 //! method. For clients such as Chrome, this includes the process type. |
191 //! | 191 //! |
192 //! The annotations returned by this method do not duplicate those returned by | 192 //! The annotations returned by this method do not duplicate those returned by |
193 //! AnnotationsVector(). Additional annotations related to the process, | 193 //! AnnotationsVector(). Additional annotations related to the process, |
194 //! system, or snapshot producer may be obtained by calling | 194 //! system, or snapshot producer may be obtained by calling |
195 //! ProcessSnapshot::AnnotationsSimpleMap(). | 195 //! ProcessSnapshot::AnnotationsSimpleMap(). |
196 virtual std::map<std::string, std::string> AnnotationsSimpleMap() const = 0; | 196 virtual std::map<std::string, std::string> AnnotationsSimpleMap() const = 0; |
197 | 197 |
198 //! \brief Returns a set of extra memory ranges specified in the module as | 198 //! \brief Returns a set of extra memory ranges specified in the module as |
199 //! being desirable to include in the crash dump. | 199 //! being desirable to include in the crash dump. |
200 virtual std::set<CheckedRange<uint64_t>> ExtraMemoryRanges() const = 0; | 200 virtual std::set<CheckedRange<uint64_t>> ExtraMemoryRanges() const = 0; |
201 | 201 |
202 //! \brief Returns a list of custom minidump stream specified in the module to | 202 //! \brief Returns a list of custom minidump stream specified in the module to |
203 //! be included in the crash dump. | 203 //! be included in the crash dump. |
204 //! | 204 //! |
205 //! \return The caller does not take ownership of the returned objects, they | 205 //! \return The caller does not take ownership of the returned objects, they |
206 //! are scoped to the lifetime of the ModuleSnapshot object that they were | 206 //! are scoped to the lifetime of the ModuleSnapshot object that they were |
207 //! obtained from. | 207 //! obtained from. |
208 virtual std::vector<const UserMinidumpStream*> CustomMinidumpStreams() | 208 virtual std::vector<const UserMinidumpStream*> CustomMinidumpStreams() |
209 const = 0; | 209 const = 0; |
210 }; | 210 }; |
211 | 211 |
212 } // namespace crashpad | 212 } // namespace crashpad |
213 | 213 |
214 #endif // CRASHPAD_SNAPSHOT_MODULE_SNAPSHOT_H_ | 214 #endif // CRASHPAD_SNAPSHOT_MODULE_SNAPSHOT_H_ |
OLD | NEW |