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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mac/mach_o_image_segment_reader.h
diff --git a/util/mac/mach_o_image_segment_reader.h b/util/mac/mach_o_image_segment_reader.h
index 66fab9a832aa59e2ca6cdada3d3c03ee2f51c0a6..1a97d2ff544af296687ed5989c1e268e83bfa18a 100644
--- a/util/mac/mach_o_image_segment_reader.h
+++ b/util/mac/mach_o_image_segment_reader.h
@@ -136,10 +136,23 @@ class MachOImageSegmentReader {
//! \note The process_types::section::addr field gives the section’s preferred
//! load address as stored in the Mach-O image file, and is not adjusted
//! for any “slide” that may have occurred when the image was loaded.
+ //! \note Unlike MachOImageReader::GetSectionAtIndex(), this method does not
+ //! accept out-of-range values for \a index, and aborts execution instead
+ //! of returning `NULL` upon encountering an out-of-range value. This is
+ //! because this method is expected to be used in a loop that can be
+ //! limited to nsects() iterations, so an out-of-range error can be
+ //! treated more harshly as a logic error, as opposed to a data error.
//!
//! \sa MachOImageReader::GetSectionAtIndex()
const process_types::section* GetSectionAtIndex(size_t index) const;
+ //! Returns whether the segment slides.
+ //!
+ //! Most segments slide, but the __PAGEZERO segment does not, it grows
+ //! instead. This method identifies non-sliding segments in the same way that
+ //! the kernel does.
+ bool SegmentSlides() const;
+
//! \brief Returns a segment name string.
//!
//! Segment names may be 16 characters long, and are not necessarily
« 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