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

Unified Diff: util/mac/mach_o_image_segment_reader.cc

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_segment_reader.h ('k') | util/mac/process_types_test.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.cc
diff --git a/util/mac/mach_o_image_segment_reader.cc b/util/mac/mach_o_image_segment_reader.cc
index 7469497fe4ff681dbb6c977d8e172762a5a36ef4..ceb9a90d0ad10f574c5cd9eea3d12d0706dc5daf 100644
--- a/util/mac/mach_o_image_segment_reader.cc
+++ b/util/mac/mach_o_image_segment_reader.cc
@@ -194,6 +194,17 @@ const process_types::section* MachOImageSegmentReader::GetSectionAtIndex(
return &sections_[index];
}
+bool MachOImageSegmentReader::SegmentSlides() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+
+ // These are the same rules that the kernel uses to identify __PAGEZERO. See
+ // 10.9.4 xnu-2422.110.17/bsd/kern/mach_loader.c load_segment().
+ return !(segment_command_.vmaddr == 0 && segment_command_.filesize == 0 &&
+ segment_command_.vmsize != 0 &&
+ (segment_command_.initprot & VM_PROT_ALL) == VM_PROT_NONE &&
+ (segment_command_.maxprot & VM_PROT_ALL) == VM_PROT_NONE);
+}
+
// static
std::string MachOImageSegmentReader::SegmentNameString(
const char* segment_name_c) {
« no previous file with comments | « util/mac/mach_o_image_segment_reader.h ('k') | util/mac/process_types_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698