[2/3] perf scripts python: arm-cs-trace-disasm.py: set start vm addr of exectable file to 0
Message ID | 20231214123304.34087-3-tianruidong@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8507535dys; Thu, 14 Dec 2023 04:33:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyygGh4yIcgIYHmpRxBIT6LXM94azLDuM09zxldb7n05pe+GYdOB8ac5gJj9J5fmyinKDj X-Received: by 2002:a17:902:6e16:b0:1d3:6c2e:3e98 with SMTP id u22-20020a1709026e1600b001d36c2e3e98mr200344plk.116.1702557215891; Thu, 14 Dec 2023 04:33:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702557215; cv=none; d=google.com; s=arc-20160816; b=Fb2XUC0JlUlCnTBfYtl31tIRVtTdf4NcaOon5HMAis5cXhyUCMy+mcfZNZELdfsZN5 fSof35rUy2vwnY+hQ+nVYv6CgsU2dFFKddczN1yfsxyBCoxjdjlyx4LbtWGcXDYxnqAl koDlu9lBYYyn4yj8E1Ltje1Lf2uivNcrGsEWrpn1c+XamDZ8iNHdo+rQI+4nC9IIL1M9 BnsCV9KAvmJVdEiujoaS+tDvYlSPPWDybig7rQA4kBqs6A8EcyNpPn1uy0r9+l3yOWN/ gGe0IR31KzuzzgD9qUdgjyYmb3qh/pRTaRUv3r5MpDCOPnj4P4oaK8hBYx2dGBlXEK/D 4iBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=m3mUXWMvE1CbiBSf6/fyaZFBnvN1JIgT1dnBWraAosw=; fh=2C1f0j/nzSygmX2ABc+8OQYD53hkUy28AVWbjAwc8E0=; b=AIjSRKa5QptTd0vLoUXhGxfiKpB6ojvZySENCLSq1Nrjm5L+doxyd6O0zONRaTx0wj CR9E66m4Qf+n1bEFMFGTTVQA3tmV/sjR2NWE07rLTS9wwoV7Flv86zCWzuIs4d5qTUmQ 6ZXjGC+sGhERbs7IUfeqLGnWunYZr1XH7Cgp3xTzhkFbz47xVElukweLLdSQNw88oaWN /rxI8NWcvM1RfcVt5bfEdPckG25gOSnWIC7eKd2wdUAR4/fyqXj+kOZxbfXrdZEFATou Oo4MAPJYzm2j5+7d4NFXgQzV59+l8wNHGSOazpc5Do2Ng1CPIzQ4HTjxLBN7sY2rNm9A 0LMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e1-20020a17090301c100b001d0ad56d893si2405647plh.473.2023.12.14.04.33.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 04:33:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8BE5C809221A; Thu, 14 Dec 2023 04:33:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573055AbjLNMdV (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Thu, 14 Dec 2023 07:33:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573076AbjLNMdU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Dec 2023 07:33:20 -0500 Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E0DF116; Thu, 14 Dec 2023 04:33:24 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R571e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=tianruidong@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0VyUUufW_1702557199; Received: from localhost(mailfrom:tianruidong@linux.alibaba.com fp:SMTPD_---0VyUUufW_1702557199) by smtp.aliyun-inc.com; Thu, 14 Dec 2023 20:33:21 +0800 From: Ruidong Tian <tianruidong@linux.alibaba.com> To: linux-kernel@vger.kernel.org Cc: james.clark@arm.com, 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, Ruidong Tian <tianruidong@linux.alibaba.com> Subject: [PATCH 2/3] perf scripts python: arm-cs-trace-disasm.py: set start vm addr of exectable file to 0 Date: Thu, 14 Dec 2023 20:33:03 +0800 Message-Id: <20231214123304.34087-3-tianruidong@linux.alibaba.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20231214123304.34087-1-tianruidong@linux.alibaba.com> References: <20231214123304.34087-1-tianruidong@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Dec 2023 04:33:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785260635545762572 X-GMAIL-MSGID: 1785260635545762572 |
Series |
perf scripts python: arm-cs-trace-disasm.py:
|
|
Commit Message
Ruidong Tian
Dec. 14, 2023, 12:33 p.m. UTC
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(-)
Comments
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>
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)