summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sanitizer_common/sanitizer_procmaps_mac.cpp')
-rw-r--r--lib/sanitizer_common/sanitizer_procmaps_mac.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/sanitizer_common/sanitizer_procmaps_mac.cpp b/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
index ea72a57bf..2f86843c2 100644
--- a/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
+++ b/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
@@ -181,13 +181,14 @@ const mach_header *get_dyld_hdr() {
// Note that the segment addresses are not necessarily sorted.
template <u32 kLCSegment, typename SegmentCommand>
static bool NextSegmentLoad(MemoryMappedSegment *segment,
-MemoryMappedSegmentData *seg_data, MemoryMappingLayoutData &layout_data) {
+ MemoryMappedSegmentData *seg_data,
+ MemoryMappingLayoutData *layout_data) {
const char *lc = layout_data.current_load_cmd_addr;
- layout_data.current_load_cmd_addr += ((const load_command *)lc)->cmdsize;
+ layout_data->current_load_cmd_addr += ((const load_command *)lc)->cmdsize;
if (((const load_command *)lc)->cmd == kLCSegment) {
const SegmentCommand* sc = (const SegmentCommand *)lc;
uptr base_virt_addr, addr_mask;
- if (layout_data.current_image == kDyldImageIdx) {
+ if (layout_data->current_image == kDyldImageIdx) {
base_virt_addr = (uptr)get_dyld_hdr();
// vmaddr is masked with 0xfffff because on macOS versions < 10.12,
// it contains an absolute address rather than an offset for dyld.
@@ -198,7 +199,7 @@ MemoryMappedSegmentData *seg_data, MemoryMappingLayoutData &layout_data) {
addr_mask = 0xfffff;
} else {
base_virt_addr =
- (uptr)_dyld_get_image_vmaddr_slide(layout_data.current_image);
+ (uptr)_dyld_get_image_vmaddr_slide(layout_data->current_image);
addr_mask = ~0;
}
@@ -219,12 +220,12 @@ MemoryMappedSegmentData *seg_data, MemoryMappingLayoutData &layout_data) {
// Return the initial protection.
segment->protection = sc->initprot;
- segment->offset = (layout_data.current_filetype ==
+ segment->offset = (layout_data->current_filetype ==
/*MH_EXECUTE*/ 0x2)
? sc->vmaddr
: sc->fileoff;
if (segment->filename) {
- const char *src = (layout_data.current_image == kDyldImageIdx)
+ const char *src = (layout_data->current_image == kDyldImageIdx)
? kDyldPath
: _dyld_get_image_name(layout_data.current_image);
internal_strncpy(segment->filename, src, segment->filename_size);
@@ -331,14 +332,14 @@ bool MemoryMappingLayout::Next(MemoryMappedSegment *segment) {
#ifdef MH_MAGIC_64
case MH_MAGIC_64: {
if (NextSegmentLoad<LC_SEGMENT_64, struct segment_command_64>(
- segment, segment->data_, data_))
+ segment, segment->data_, &data_))
return true;
break;
}
#endif
case MH_MAGIC: {
if (NextSegmentLoad<LC_SEGMENT, struct segment_command>(
- segment, segment->data_, data_))
+ segment, segment->data_, &data_))
return true;
break;
}