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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 //! MachOImageReader::GetSectionAtIndex(), this is a 0-based index. This | 129 //! MachOImageReader::GetSectionAtIndex(), this is a 0-based index. This |
130 //! parameter must be in the range of valid indices aas reported by | 130 //! parameter must be in the range of valid indices aas reported by |
131 //! nsects(). | 131 //! nsects(). |
132 //! | 132 //! |
133 //! \return A pointer to the section information. If \a index is out of range, | 133 //! \return A pointer to the section information. If \a index is out of range, |
134 //! execution is aborted. | 134 //! execution is aborted. |
135 //! | 135 //! |
136 //! \note The process_types::section::addr field gives the section’s preferred | 136 //! \note The process_types::section::addr field gives the section’s preferred |
137 //! load address as stored in the Mach-O image file, and is not adjusted | 137 //! load address as stored in the Mach-O image file, and is not adjusted |
138 //! for any “slide” that may have occurred when the image was loaded. | 138 //! for any “slide” that may have occurred when the image was loaded. |
| 139 //! \note Unlike MachOImageReader::GetSectionAtIndex(), this method does not |
| 140 //! accept out-of-range values for \a index, and aborts execution instead |
| 141 //! of returning `NULL` upon encountering an out-of-range value. This is |
| 142 //! because this method is expected to be used in a loop that can be |
| 143 //! limited to nsects() iterations, so an out-of-range error can be |
| 144 //! treated more harshly as a logic error, as opposed to a data error. |
139 //! | 145 //! |
140 //! \sa MachOImageReader::GetSectionAtIndex() | 146 //! \sa MachOImageReader::GetSectionAtIndex() |
141 const process_types::section* GetSectionAtIndex(size_t index) const; | 147 const process_types::section* GetSectionAtIndex(size_t index) const; |
142 | 148 |
| 149 //! Returns whether the segment slides. |
| 150 //! |
| 151 //! Most segments slide, but the __PAGEZERO segment does not, it grows |
| 152 //! instead. This method identifies non-sliding segments in the same way that |
| 153 //! the kernel does. |
| 154 bool SegmentSlides() const; |
| 155 |
143 //! \brief Returns a segment name string. | 156 //! \brief Returns a segment name string. |
144 //! | 157 //! |
145 //! Segment names may be 16 characters long, and are not necessarily | 158 //! Segment names may be 16 characters long, and are not necessarily |
146 //! `NUL`-terminated. This function will return a segment name based on up to | 159 //! `NUL`-terminated. This function will return a segment name based on up to |
147 //! the first 16 characters found at \a segment_name_c. | 160 //! the first 16 characters found at \a segment_name_c. |
148 static std::string SegmentNameString(const char* segment_name_c); | 161 static std::string SegmentNameString(const char* segment_name_c); |
149 | 162 |
150 //! \brief Returns a section name string. | 163 //! \brief Returns a section name string. |
151 //! | 164 //! |
152 //! Section names may be 16 characters long, and are not necessarily | 165 //! Section names may be 16 characters long, and are not necessarily |
(...skipping 30 matching lines...) Expand all Loading... |
183 std::map<std::string, size_t> section_map_; | 196 std::map<std::string, size_t> section_map_; |
184 | 197 |
185 InitializationStateDcheck initialized_; | 198 InitializationStateDcheck initialized_; |
186 | 199 |
187 DISALLOW_COPY_AND_ASSIGN(MachOImageSegmentReader); | 200 DISALLOW_COPY_AND_ASSIGN(MachOImageSegmentReader); |
188 }; | 201 }; |
189 | 202 |
190 } // namespace crashpad | 203 } // namespace crashpad |
191 | 204 |
192 #endif // CRASHPAD_UTIL_MAC_MACH_O_IMAGE_SEGMENT_READER_H_ | 205 #endif // CRASHPAD_UTIL_MAC_MACH_O_IMAGE_SEGMENT_READER_H_ |
OLD | NEW |