for (unsigned int i = 0U; i < mh->ncmds; ++i) {
if (lc->cmd == LC_SEGMENT_CMD) {
const struct SEGMENT_COMMAND* sc = (const struct SEGMENT_COMMAND*)lc;
- if (sc->initprot == 3) {
- ++*rw_loads;
+ if (sc->initprot == 3 && sc->filesize) {
+ ++*rw_loads;
}
}
const char* tmp = (const char*)lc + lc->cmdsize;
vmsize = VG_PGROUNDUP(segcmd->vmsize);
if (filesize > 0) {
addr = slided_addr;
- VG_(debugLog)(2, "ume", "mmap fixed (file) (%#lx, %lu)\n", addr, filesize);
+ VG_(debugLog)(2, "ume", "mmap fixed (file) (%#lx, %lu, %x)\n", addr, filesize, prot);
res = VG_(am_mmap_named_file_fixed_client)(addr, filesize, prot, fd,
offset + segcmd->fileoff,
filename);
// page-aligned part
SizeT length = vmsize - filesize;
addr = (Addr)(filesize + slided_addr);
- VG_(debugLog)(2, "ume", "mmap fixed (anon) (%#lx, %lu)\n", addr, length);
+ VG_(debugLog)(2, "ume", "mmap fixed (anon) (%#lx, %lu, %u)\n", addr, length, prot);
res = VG_(am_mmap_anon_fixed_client)(addr, length, prot);
check_mmap(res, addr, length, "load_segment2");
}