Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: util/mac/mach_o_image_segment_reader.h

Issue 535343004: Add MachOImageReader and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « util/mac/mach_o_image_reader_test.cc ('k') | util/mac/mach_o_image_segment_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « util/mac/mach_o_image_reader_test.cc ('k') | util/mac/mach_o_image_segment_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698