[PATCH] D124088: perf: Fix profile reading to correctly take segments into account.
Tamar Christina via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 20 06:11:47 PDT 2022
tnfchris created this revision.
tnfchris added reviewers: thopre, cmatthews.
Herald added a subscriber: dkolesnichenko.
Herald added a project: All.
tnfchris requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
LNT's perf parsing implementation has a very subtle bug horrible bug:
It's assuming that the text segment starts at the same address that
the program was loaded at. Or rather, it assumes the text segment is
at address 0.
This is usually not the case (and indeed LLD itself puts many non-exec
Segments before the first exec one)
Because of this no event is matched for certain binaries. Also the
code can wrongly try to attribute an event to the wrong MMAP because
it only checks the starting address. This means that the order of the
MMAPs matters and again as of a few days ago the order coming out of
LLD places the binary itself after most SOs including ld.so.
By checking only the start address we can attribute an event to an SO
instead of to the program since trivially shared libraries are
loaded before the program itself in the virtual memory space. This
would later fail to resolve but we'd lose the event.
This patch changes it to also check for the ending position.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124088
Files:
lnt/testing/profile/cPerf.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124088.423884.patch
Type: text/x-patch
Size: 3842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220420/299e7754/attachment.bin>
More information about the llvm-commits
mailing list