[perf2bolt] Improve heuristic to map in-process addresses to specific… (#109397)
… segments in Elf binary. The heuristic is improved by also taking into account that only executable segments should contain instructions. Fixes #109384.
This commit is contained in:
@@ -2021,6 +2021,9 @@ BinaryContext::getBaseAddressForMapping(uint64_t MMapAddress,
|
||||
// Find a segment with a matching file offset.
|
||||
for (auto &KV : SegmentMapInfo) {
|
||||
const SegmentInfo &SegInfo = KV.second;
|
||||
// Only consider executable segments.
|
||||
if (!SegInfo.IsExecutable)
|
||||
continue;
|
||||
// FileOffset is got from perf event,
|
||||
// and it is equal to alignDown(SegInfo.FileOffset, pagesize).
|
||||
// If the pagesize is not equal to SegInfo.Alignment.
|
||||
|
||||
Reference in New Issue
Block a user