Page MenuHomeFreeBSD

pmcannotate: Don't increment end address passed to objdump -d.
ClosedPublic

Authored by jhb on Jun 3 2022, 10:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sep 29 2024, 8:05 PM
Unknown Object (File)
Sep 7 2024, 6:40 AM
Unknown Object (File)
Sep 4 2024, 8:06 PM
Unknown Object (File)
Sep 3 2024, 8:24 AM
Unknown Object (File)
Aug 25 2024, 5:16 AM
Unknown Object (File)
Aug 25 2024, 3:16 AM
Unknown Object (File)
Aug 2 2024, 8:18 AM
Unknown Object (File)
Aug 2 2024, 7:16 AM
Subscribers

Details

Summary

libpmc already returns an end address that is after the end of the
last instruction of a function (on both amd64 and arm64) as the end
address written to the annotate map file is computed as the start
address of the symbol plus the size.

Adding one could result in a curious failure where an entire
function's contents in assembly was reduced instead to only the first
instruction. The reason is that when the end instruction is bumped by
one, objdump -d can append the first instruction of the next function
in its output. However, since pmcannotate concatenates all of the
objdump -d output from various functions into a single file which it
then searches to find the assembly for a given file, if this
additional trailer was earlier in the file than the full function, the
trailer was chosen to represent the entire function resulting in the
truncated listing of the function.

Sponsored by: University of Cambridge, Google, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Jun 3 2022, 10:00 PM

I am not familiar with this code, but looking now I do see in the output in my profiles meaningless extra line at the end of each function.

This revision was not accepted when it landed; it landed in state Needs Review.Jun 14 2022, 5:53 PM
This revision was automatically updated to reflect the committed changes.