Skip to content

Commit

Permalink
Merge contiguous mappings from the same file.
Browse files Browse the repository at this point in the history
This allows symbolization to work if different parts of a binary's text are mapped differently, e.g. if they're mlock()ed or mapped onto huge pages.

PiperOrigin-RevId: 456600880
Change-Id: I069264f94cf834df9201968275a00828f5eb077e
  • Loading branch information
Abseil Team authored and copybara-github committed Jun 22, 2022
1 parent e7cbb2a commit 4dc63ba
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions absl/debugging/symbolize_elf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,14 @@ bool Symbolizer::RegisterObjFile(const char *filename,
reinterpret_cast<uintptr_t>(old->end_addr), old->filename);
}
return true;
} else if (old->end_addr == start_addr &&
reinterpret_cast<uintptr_t>(old->start_addr) - old->offset ==
reinterpret_cast<uintptr_t>(start_addr) - offset &&
strcmp(old->filename, filename) == 0) {
// Two contiguous map entries that span a contiguous region of the file,
// perhaps because some part of the file was mlock()ed. Combine them.
old->end_addr = end_addr;
return true;
}
}
ObjFile *obj = impl->addr_map_.Add();
Expand Down

0 comments on commit 4dc63ba

Please sign in to comment.