perf: Fix profile reading to correctly take segments into account.
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.