Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jul 2022 16:47:44 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 041857e57b3d - stable/13 - pmcannotate: Don't increment end address passed to objdump -d.
Message-ID:  <202207131647.26DGli2T052328@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=041857e57b3d0831b5bdf583f684a7ed3816999c

commit 041857e57b3d0831b5bdf583f684a7ed3816999c
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-06-14 17:52:54 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-07-13 16:20:45 +0000

    pmcannotate: Don't increment end address passed to objdump -d.
    
    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.
    Differential Revision:  https://reviews.freebsd.org/D35399
    
    (cherry picked from commit 73702c398046d8e01e6a0f5860b7e75cd37a9518)
---
 usr.sbin/pmcannotate/pmcannotate.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/usr.sbin/pmcannotate/pmcannotate.c b/usr.sbin/pmcannotate/pmcannotate.c
index 03f384d3f531..f3ffeed92738 100644
--- a/usr.sbin/pmcannotate/pmcannotate.c
+++ b/usr.sbin/pmcannotate/pmcannotate.c
@@ -434,11 +434,6 @@ fqueue_getall(const char *bin, char *temp, int asmf)
 		start = agg->ag_ostart;
 		end = agg->ag_oend;
 
-		/*
-		 * Fix-up the end address in order to show it in the objdump's
-		 * trace.
-		 */
-		end++;
 		if (asmf)
 			snprintf(tmpf, sizeof(tmpf),
 			    "objdump --start-address=%p "



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207131647.26DGli2T052328>