summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-06-22 13:55:21 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-06-22 13:56:07 -0700
commit4dc63bade3ef2c099f328f2e08f6d4bf6658f0cf (patch)
tree0c68fc4f11a4268e6ef8bb0725f5911297c8288b
parente7cbb2acd34b45e469f7a46c3f9da3be1311d8c7 (diff)
Merge contiguous mappings from the same file.
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
-rw-r--r--absl/debugging/symbolize_elf.inc8
1 files changed, 8 insertions, 0 deletions
diff --git a/absl/debugging/symbolize_elf.inc b/absl/debugging/symbolize_elf.inc
index ddccd590..9bfdd915 100644
--- a/absl/debugging/symbolize_elf.inc
+++ b/absl/debugging/symbolize_elf.inc
@@ -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();