linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Clark <james.clark@arm.com>
To: Ruidong Tian <tianruidong@linux.alibaba.com>,
	linux-kernel@vger.kernel.org
Cc: coresight@lists.linaro.org, suzuki.poulose@arm.com,
	mike.leach@linaro.org, alexander.shishkin@linux.intel.com,
	linux-arm-kernel@lists.infradead.org, adrian.hunter@intel.com,
	linux-perf-users@vger.kernel.org, leo.yan@linaro.org,
	al.grant@arm.com, mathieu.poirier@linaro.org, tor@ti.com,
	acme@redhat.com
Subject: Re: [PATCH 2/3] perf scripts python: arm-cs-trace-disasm.py: set start vm addr of exectable file to 0
Date: Wed, 20 Dec 2023 12:06:59 +0000	[thread overview]
Message-ID: <a3ae638f-8efc-70d9-75fd-9473db3de24d@arm.com> (raw)
In-Reply-To: <20231214123304.34087-3-tianruidong@linux.alibaba.com>



On 14/12/2023 12:33, Ruidong Tian wrote:
> For exectable ELF file, which e_type is ET_EXEC, dso start address is a
> absolute address other than offset. Just set vm_start to zero when dso
> start is 0x400000, which means it is a exectable file.
> 
> Signed-off-by: Ruidong Tian <tianruidong@linux.alibaba.com>
> ---
>  tools/perf/scripts/python/arm-cs-trace-disasm.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py
> index 46bf6b02eea1..c9e14af5b58c 100755
> --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py
> +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py
> @@ -260,8 +260,9 @@ def process_event(param_dict):
>  
>  	if (options.objdump_name != None):
>  		# It doesn't need to decrease virtual memory offset for disassembly
> -		# for kernel dso, so in this case we set vm_start to zero.
> -		if (dso == "[kernel.kallsyms]"):
> +		# for kernel dso and executable file dso, so in this case we set
> +		# vm_start to zero.
> +		if (dso == "[kernel.kallsyms]" or dso_start == 0x400000):
>  			dso_vm_start = 0
>  		else:
>  			dso_vm_start = int(dso_start)

I confirmed that this fixes the disassembly for static binaries. It
would have been nice to check the type of the file rather than using a
magic number, but it's not that easy and I don't really see a chance of
the number having a false positive.

I wonder if it's worth putting a fixes tag on this one? For the other
ones I'd say no tag as they have a chance of breaking things.

Reviewed-by: James Clark <james.clark@arm.com>

  reply	other threads:[~2023-12-20 12:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 12:33 [PATCH 0/3] perf scripts python: arm-cs-trace-disasm.py: Ruidong Tian
2023-12-14 12:33 ` [PATCH 1/3] perf scripts python: arm-cs-trace-disasm.py: print dso base address Ruidong Tian
2023-12-20 10:44   ` James Clark
2023-12-22  7:29     ` Ruidong Tian
2023-12-24  8:33       ` Leo Yan
2023-12-14 12:33 ` [PATCH 2/3] perf scripts python: arm-cs-trace-disasm.py: set start vm addr of exectable file to 0 Ruidong Tian
2023-12-20 12:06   ` James Clark [this message]
2023-12-14 12:33 ` [PATCH 3/3] perf scripts python: arm-cs-trace-disasm.py: do not ignore disam first sample Ruidong Tian
2023-12-18 20:28   ` Arnaldo Carvalho de Melo
2023-12-20 11:15   ` James Clark
2023-12-20 17:31 ` [PATCH 0/3] perf scripts python: arm-cs-trace-disasm.py: Arnaldo Carvalho de Melo
2024-01-10  2:56 ` [PATCH v2 0/1] perf scripts python: arm-cs-trace-disasm.py: print correct disasm info Ruidong Tian
2024-01-10  2:56   ` [PATCH v2 1/1] perf scripts python: arm-cs-trace-disasm.py: add option to print virtual address Ruidong Tian
2024-01-10 12:55     ` Leo Yan
2024-01-10 13:48       ` Ruidong Tian
2024-01-16  2:08 ` [PATCH v3 0/1] perf scripts python: arm-cs-trace-disasm.py: print correct disasm info Ruidong Tian
2024-01-16  2:08   ` [PATCH v3 1/1] perf scripts python: arm-cs-trace-disasm.py: add option to print virtual address Ruidong Tian
2024-01-17 10:16     ` James Clark
2024-01-16  2:08   ` [PATCH v3 2/3] perf scripts python: arm-cs-trace-disasm.py: set start vm addr of exectable file to 0 Ruidong Tian
2024-01-17 10:12     ` James Clark
2024-01-16  2:08   ` Ruidong Tian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a3ae638f-8efc-70d9-75fd-9473db3de24d@arm.com \
    --to=james.clark@arm.com \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=al.grant@arm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=suzuki.poulose@arm.com \
    --cc=tianruidong@linux.alibaba.com \
    --cc=tor@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).